PowerPress Podcasting plugin by Blubrry - Version 0.3.1

Version Description

Download this release

Release Info

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

Code changes from version 0.3.0 to 0.3.1

Files changed (2) hide show
  1. powerpress.php +44 -11
  2. readme.txt +4 -1
powerpress.php CHANGED
@@ -7,6 +7,7 @@ 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.
@@ -33,10 +34,21 @@ License: Apache License version 2.0 (http://www.apache.org/licenses/)
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
 
 
 
 
 
 
 
 
 
 
40
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
41
  if( !defined('POWERPRESS_PLUGIN_PATH') )
42
  define('POWERPRESS_PLUGIN_PATH', '/wp-content/plugins/powerpress/');
@@ -91,6 +103,12 @@ function powerpress_content($content)
91
  if( !isset($Powerpress['podcast_link']) )
92
  $Powerpress['podcast_link'] = 1;
93
 
 
 
 
 
 
 
94
  // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
95
  if( $Powerpress['display_player'] == 0 )
96
  return $content;
@@ -226,9 +244,12 @@ function powerpress_rss2_head()
226
 
227
  echo '<!-- podcast_generator="Blubrry Powerpress/'. POWERPRESS_VERSION .'" -->'.PHP_EOL;
228
 
229
- if( defined('POWERPRESS_NEW_FEED_URL') )
230
- echo "\t<itunes:new-feed-url>".POWERPRESS_NEW_FEED_URL.'</itunes:new-feed-url>'.PHP_EOL;
231
-
 
 
 
232
  if( $Feed['itunes_summary'] )
233
  echo "\t".'<itunes:summary>'. htmlentities( $Feed['itunes_summary'], ENT_NOQUOTES, 'UTF-8') .'</itunes:summary>'.PHP_EOL;
234
  else
@@ -261,9 +282,9 @@ function powerpress_rss2_head()
261
  if( $Feed['copyright'] )
262
  echo "\t".'<copyright>'. str_replace( array('&copy;', '(c)', '(C)'), '&#xA9;', htmlentities($Feed['copyright'], ENT_NOQUOTES, 'UTF-8')) . '</copyright>'.PHP_EOL;
263
  if( $Feed['itunes_subtitle'] )
264
- echo "\t".'<itunes:subtitle>' . htmlentities($Feed['itunes_subtitle'], ENT_NOQUOTES, 'UTF-8') . '</itunes:subtitle>'.PHP_EOL;
265
  if( $Feed['itunes_keywords'] )
266
- echo "\t".'<itunes:keywords>' . htmlentities($Feed['itunes_keywords'], ENT_NOQUOTES, 'UTF-8') . '</itunes:keywords>'.PHP_EOL;
267
  if( $Feed['itunes_talent_name'] && $Feed['email'] )
268
  echo "\t".'<managingEditor>'. $Feed['email'] .' ('. htmlentities($Feed['itunes_talent_name'], ENT_NOQUOTES, 'UTF-8') .')</managingEditor>'.PHP_EOL;
269
  if( $Feed['rss2_image'] )
@@ -437,7 +458,7 @@ function powerpress_rss2_item()
437
  for($c = 0; $c < count($tagobject) && $c < 12; $c++) // iTunes only accepts up to 12 keywords
438
  $tags[] = htmlentities($tagobject[$c]->name, ENT_NOQUOTES, 'UTF-8');
439
 
440
- echo "\t\t<itunes:keywords>" . implode(",", $tags) . '</itunes:keywords>'.PHP_EOL;
441
  }
442
 
443
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
@@ -450,12 +471,12 @@ function powerpress_rss2_item()
450
  $excerpt_no_html = strip_tags($post->post_excerpt);
451
 
452
  if( $excerpt_no_html )
453
- echo "\t\t<itunes:subtitle>". powerpress_smart_trim($excerpt_no_html, 250, true) .'</itunes:subtitle>'.PHP_EOL;
454
  else
455
- echo "\t\t<itunes:subtitle>". powerpress_smart_trim($content_no_html, 250, true) .'</itunes:subtitle>'.PHP_EOL;
456
 
457
  if( defined('POWERPRESS_ITEM_SUMMARY') )
458
- echo "\t\t<itunes:summary>". powerpress_smart_trim($content_no_html, 4000) .'</itunes:summary>'.PHP_EOL;
459
  if( $powerpress_itunes_talent_name )
460
  echo "\t\t<itunes:author>" . $powerpress_itunes_talent_name . '</itunes:author>'.PHP_EOL;
461
 
@@ -640,6 +661,18 @@ function powerpress_get_root_url()
640
  return get_bloginfo('url') . POWERPRESS_PLUGIN_PATH;
641
  }
642
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  function powerpress_smart_trim($value, $char_limit = 250, $remove_new_lines = false)
644
  {
645
  if( strlen($value) > $char_limit )
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
10
+ 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.
11
  2008-09-24 - v0.3.0: Added important feeds list in feed settings, logic to prevent stats redirect duplication and added podcast only feed.
12
  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.
13
  2008-08-05 - v0.2.0: First beta release of Blubrry Powerpress plugin.
34
  is interpreted as GPL version 3.0 for compatibility with Apache 2.0 license.
35
  */
36
 
37
+ define('POWERPRESS_VERSION', '0.3.1' );
38
+
39
+ // Include the <itunes:summary> tag in each rss <item> tag.
40
+ //define('POWERPRESS_ITEM_SUMMARY', true); // Note, this is not necessary, itunes will use the description value if not present
41
  // Please place define above in your wp-config.php.
42
 
43
+ // include <itunes:new-feed-url> tag in Main RSS feed:
44
+ //define('POWERPRESS_NEW_FEED_URL', 'http://www.your-site.com/path/to/feed/');
45
+
46
+ // include <itunes:new-feed-url> tag in Podcast specific RSS feed:
47
+ //define('POWERPRESS_NEW_FEED_URL_PODCAST', 'http://www.your-site.com/path/to/podcast/feed/');
48
+
49
+ // Display Powerpress player only for previously created Podpress episodes.
50
+ // define('POWERPRESS_USE_PLAYER_FOR_PODPRESS_EPISODES', true);
51
+
52
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
53
  if( !defined('POWERPRESS_PLUGIN_PATH') )
54
  define('POWERPRESS_PLUGIN_PATH', '/wp-content/plugins/powerpress/');
103
  if( !isset($Powerpress['podcast_link']) )
104
  $Powerpress['podcast_link'] = 1;
105
 
106
+ if( defined('POWERPRESS_USE_PLAYER_FOR_PODPRESS_EPISODES') )
107
+ {
108
+ if( !isset($podPressMedia) )
109
+ return $content;
110
+ }
111
+
112
  // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
113
  if( $Powerpress['display_player'] == 0 )
114
  return $content;
244
 
245
  echo '<!-- podcast_generator="Blubrry Powerpress/'. POWERPRESS_VERSION .'" -->'.PHP_EOL;
246
 
247
+ // add the itunes:new-feed-url tag to feed
248
+ if( defined('POWERPRESS_NEW_FEED_URL') && ($feed == 'feed' || $feed == 'rss2') )
249
+ echo "\t<itunes:new-feed-url>". constant('POWERPRESS_NEW_FEED_URL') .'</itunes:new-feed-url>'.PHP_EOL;
250
+ else if( defined('POWERPRESS_NEW_FEED_URL_'.strtoupper($feed) ) )
251
+ echo "\t<itunes:new-feed-url>". constant( 'POWERPRESS_NEW_FEED_URL_'.strtoupper($feed) ) .'</itunes:new-feed-url>'.PHP_EOL;
252
+
253
  if( $Feed['itunes_summary'] )
254
  echo "\t".'<itunes:summary>'. htmlentities( $Feed['itunes_summary'], ENT_NOQUOTES, 'UTF-8') .'</itunes:summary>'.PHP_EOL;
255
  else
282
  if( $Feed['copyright'] )
283
  echo "\t".'<copyright>'. str_replace( array('&copy;', '(c)', '(C)'), '&#xA9;', htmlentities($Feed['copyright'], ENT_NOQUOTES, 'UTF-8')) . '</copyright>'.PHP_EOL;
284
  if( $Feed['itunes_subtitle'] )
285
+ echo "\t".'<itunes:subtitle>' . powerpress_format_itunes_value($Feed['itunes_subtitle']) . '</itunes:subtitle>'.PHP_EOL;
286
  if( $Feed['itunes_keywords'] )
287
+ echo "\t".'<itunes:keywords>' . powerpress_format_itunes_value($Feed['itunes_keywords']) . '</itunes:keywords>'.PHP_EOL;
288
  if( $Feed['itunes_talent_name'] && $Feed['email'] )
289
  echo "\t".'<managingEditor>'. $Feed['email'] .' ('. htmlentities($Feed['itunes_talent_name'], ENT_NOQUOTES, 'UTF-8') .')</managingEditor>'.PHP_EOL;
290
  if( $Feed['rss2_image'] )
458
  for($c = 0; $c < count($tagobject) && $c < 12; $c++) // iTunes only accepts up to 12 keywords
459
  $tags[] = htmlentities($tagobject[$c]->name, ENT_NOQUOTES, 'UTF-8');
460
 
461
+ echo "\t\t<itunes:keywords>" . powerpress_format_itunes_value(implode(",", $tags)) . '</itunes:keywords>'.PHP_EOL;
462
  }
463
 
464
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
471
  $excerpt_no_html = strip_tags($post->post_excerpt);
472
 
473
  if( $excerpt_no_html )
474
+ echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value(powerpress_smart_trim($excerpt_no_html, 250, true)) .'</itunes:subtitle>'.PHP_EOL;
475
  else
476
+ echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value(powerpress_smart_trim($content_no_html, 250, true)) .'</itunes:subtitle>'.PHP_EOL;
477
 
478
  if( defined('POWERPRESS_ITEM_SUMMARY') )
479
+ echo "\t\t<itunes:summary>". powerpress_format_itunes_value(powerpress_smart_trim($content_no_html, 4000)) .'</itunes:summary>'.PHP_EOL;
480
  if( $powerpress_itunes_talent_name )
481
  echo "\t\t<itunes:author>" . $powerpress_itunes_talent_name . '</itunes:author>'.PHP_EOL;
482
 
661
  return get_bloginfo('url') . POWERPRESS_PLUGIN_PATH;
662
  }
663
 
664
+ function powerpress_format_itunes_value($value)
665
+ {
666
+ $value = htmlentities($value, ENT_NOQUOTES, 'UTF-8');
667
+ $value = str_replace('&quot;', '', $value);
668
+ $value = str_replace('&amp;', '', $value);
669
+ $value = str_replace('&lt;', '', $value);
670
+ $value = str_replace('&gt;', '', $value);
671
+ $value = str_replace('&nbsp;', '', $value);
672
+ $value = str_replace('&', '', $value); // Last attempt to fix, just remove the &
673
+ return $result;
674
+ }
675
+
676
  function powerpress_smart_trim($value, $char_limit = 250, $remove_new_lines = false)
677
  {
678
  if( strlen($value) > $char_limit )
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.3.0
7
 
8
  Add podcasting support to your blog.
9
 
@@ -59,5 +59,8 @@ Fixed bugs: itunes:subtitle bug, itunes:summary is now enabled by default, add e
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/
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.1
7
 
8
  Add podcasting support to your blog.
9
 
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
+ 0.3.1 released on 10/02/2008
63
+ Fixed bug and added enhancements: 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.
64
+
65
  == Feedback ==
66
  http://www.blubrry.com/powerpress/