PowerPress Podcasting plugin by Blubrry - Version 4.0.9

Version Description

  • Releaesd on 6/20/2013
  • PowerPress 5.0 is coming! If you would like to beta test, please contact Angelo at cio [at] rawovice dot com. Beta testing starts when WordPress 3.6 is released, PowerPress 5.0 will utilize some new features in WordPress 3.6.
  • The PowerPress Version Updates Survey results will be posted in the coming weeks. Based on user feedback, we will release minor updates within 7 days if necessary, major releases between 1-3 months apart, and new features will be included in the plguin but disabled by default.
  • Fixed logic for displaying statistics in dashboard to time out after 1 second (was previously 15 seconds) so if there's a network issue between the server and blubrry.com the dashboard still loads promptly. (Thanks Michael Hansen for bringing to our attention!)
  • Added new filter powerpress_feed_auth for other plugins to filter feed authentication. (Thanks amereservant for the feature suggestion!)
  • Added new define POWERPRESS_AUTO_DETECT_ONCE, edits to existing episodes will use the specify option if this define is set to true. (Thanks amereservant for the feature suggestion!)
  • Fixed bug with ID3 tagging not correctly incrementing the track number for episodes. This only affected Blubrry hosting customers who had this option turned on. (Thanks RWPeck for bringing to our attention!)
  • Mobile devices now use the same HTML5 player as the regular desktop HTML5 player found in PowerPress. This is due to reports that some mobile devices are now pre-loading media on pages, this will cut down on such bandwidth. (Thanks Daniel for bringing to our attention)
  • Added new define POWERPRESS_POST_TYPES, when set, only the post types specified are given podcasting episode entry boxes. Multiple post types are separated by commas. Example with added movies custom post type added: 'page,post,movies'. This will bypass the default behavior of adding episode boxes to all post types with post or page capability.
  • Fixed bug with unchecking iTunes Closed Captioned option not saving. (Thanks davidcross for reporting bug)
Download this release

Release Info

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

Code changes from version 4.0.8 to 4.0.9

powerpress-feed-auth.php CHANGED
@@ -3,27 +3,32 @@
3
 
4
  function powerpress_feed_auth($feed_slug)
5
  {
6
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
7
-
8
- if( !isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) )
9
- powerpress_feed_auth_basic( $FeedSettings['title'] );
10
-
11
- $user = $_SERVER['PHP_AUTH_USER'];
12
- $password = $_SERVER['PHP_AUTH_PW'];
13
-
14
- $user = wp_authenticate($user, $password);
15
-
16
- if( !is_wp_error($user) )
17
  {
18
- // Check capability...
19
- if( $user->has_cap( $FeedSettings['premium'] ) )
20
- return; // Nice, let us continue...
21
 
22
- powerpress_feed_auth_basic( $FeedSettings['title'], __('Access Denied', 'powerpress') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
-
25
- // user authenticated here
26
- powerpress_feed_auth_basic( $FeedSettings['title'], __('Authorization Failed', 'powerpress') );
27
  }
28
 
29
  function powerpress_feed_auth_basic($realm_name, $error = false )
3
 
4
  function powerpress_feed_auth($feed_slug)
5
  {
6
+ // See if a filter exists to perform the authentication...
7
+ $authenticated = apply_filters('powerpress_feed_auth', false, 'channel', $feed_slug);
8
+ if( !$authenticated )
 
 
 
 
 
 
 
 
9
  {
10
+ $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
 
 
11
 
12
+ if( !isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) )
13
+ powerpress_feed_auth_basic( $FeedSettings['title'] );
14
+
15
+ $user = $_SERVER['PHP_AUTH_USER'];
16
+ $password = $_SERVER['PHP_AUTH_PW'];
17
+
18
+ $user = wp_authenticate($user, $password);
19
+
20
+ if( !is_wp_error($user) )
21
+ {
22
+ // Check capability...
23
+ if( $user->has_cap( $FeedSettings['premium'] ) )
24
+ return; // Nice, let us continue...
25
+
26
+ powerpress_feed_auth_basic( $FeedSettings['title'], __('Access Denied', 'powerpress') );
27
+ }
28
+
29
+ // user authenticated here
30
+ powerpress_feed_auth_basic( $FeedSettings['title'], __('Authorization Failed', 'powerpress') );
31
  }
 
 
 
32
  }
33
 
34
  function powerpress_feed_auth_basic($realm_name, $error = false )
powerpress-player.php CHANGED
@@ -1382,7 +1382,7 @@ function powerpressplayer_build_html5mobile($media_url, $EpisodeData)
1382
  case 'ogv': {
1383
  // Video
1384
  if( $html5 )
1385
- $content .= powerpressplayer_build_html5video($media_url, $EpisodeData, true);
1386
  else
1387
  $content .= powerpressplayer_build_playimage($media_url, $EpisodeData, true);
1388
  }; break;
@@ -1391,7 +1391,7 @@ function powerpressplayer_build_html5mobile($media_url, $EpisodeData)
1391
  case 'oga': {
1392
  // Audio
1393
  if( $html5 )
1394
- $content .= powerpressplayer_build_html5audio($media_url, $EpisodeData, true);
1395
  else
1396
  $content .= powerpressplayer_build_playimageaudio($media_url, true);
1397
  }; break;
1382
  case 'ogv': {
1383
  // Video
1384
  if( $html5 )
1385
+ $content .= powerpressplayer_build_html5video($media_url, $EpisodeData);
1386
  else
1387
  $content .= powerpressplayer_build_playimage($media_url, $EpisodeData, true);
1388
  }; break;
1391
  case 'oga': {
1392
  // Audio
1393
  if( $html5 )
1394
+ $content .= powerpressplayer_build_html5audio($media_url, $EpisodeData);
1395
  else
1396
  $content .= powerpressplayer_build_playimageaudio($media_url, true);
1397
  }; break;
powerpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://create.blubrry.com/resources/powerpress/
5
  Description: <a href="http://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
- Version: 4.0.8
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
@@ -33,7 +33,7 @@ if( !function_exists('add_action') )
33
  die("access denied.");
34
 
35
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
36
- define('POWERPRESS_VERSION', '4.0.8' );
37
 
38
  // Translation support:
39
  if ( !defined('POWERPRESS_ABSPATH') )
@@ -395,9 +395,15 @@ function powerpress_rss2_head()
395
  $cat_ID = get_query_var('cat');
396
 
397
  $Feed = get_option('powerpress_feed'); // Get the main feed settings
398
- if( is_category() )
399
  {
400
- $CustomFeed = get_option('powerpress_cat_feed_'.$cat_ID); // Get the custom podcast feed settings saved in the database
 
 
 
 
 
 
401
  if( $CustomFeed )
402
  $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
403
  }
@@ -504,7 +510,7 @@ function powerpress_rss2_head()
504
  else // Use the default image
505
  {
506
  echo "\t". '<image>' .PHP_EOL;
507
- if( is_category() && !empty($Feed['title']) )
508
  echo "\t\t".'<title>' . esc_html( get_bloginfo_rss('name') ) . '</title>'.PHP_EOL;
509
  else
510
  echo "\t\t".'<title>' . esc_html( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
@@ -640,7 +646,7 @@ function powerpress_rss2_item()
640
 
641
  // Check and see if we're working with a podcast episode
642
  $custom_enclosure = false;
643
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() )
644
  {
645
  $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
646
  $custom_enclosure = true;
@@ -835,8 +841,7 @@ function powerpress_filter_rss_enclosure($content)
835
  if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
836
  return $content; // Another podcasting plugin is enabled...
837
 
838
-
839
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() )
840
  return ''; // We will handle this enclosure in the powerpress_rss2_item() function
841
 
842
  $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches);
@@ -890,6 +895,11 @@ function powerpress_bloginfo_rss($content, $field = '')
890
  {
891
  if( is_category() )
892
  $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
 
 
 
 
 
893
  else
894
  $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
895
  //$Feed = true;
@@ -1255,6 +1265,49 @@ function powerpress_load_general_feed_settings()
1255
  $powerpress_feed['podcast_embed_in_feed'] = true;
1256
  return;
1257
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1258
 
1259
  $feed_slug = get_query_var('feed');
1260
 
@@ -1386,7 +1439,7 @@ function powerpress_is_custom_podcast_feed()
1386
 
1387
  function powerpress_posts_join($join)
1388
  {
1389
- if( is_category() )
1390
  return $join;
1391
 
1392
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) && !is_category() )
@@ -1403,7 +1456,7 @@ add_filter('posts_join', 'powerpress_posts_join' );
1403
 
1404
  function powerpress_posts_where($where)
1405
  {
1406
- if( is_category() )
1407
  return $where;
1408
 
1409
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) )
@@ -1430,7 +1483,7 @@ add_filter('posts_where', 'powerpress_posts_where' );
1430
  // Add the groupby needed for enclosures only
1431
  function powerpress_posts_groupby($groupby)
1432
  {
1433
- if( is_category() )
1434
  return $groupby;
1435
 
1436
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) )
@@ -1956,7 +2009,7 @@ function powerpress_add_redirect_url($MediaURL, $GeneralSettings = false)
1956
  if( preg_match('/^http\:/i', $MediaURL) === false )
1957
  return $MediaURL; // If the user is hosting media not via http (e.g. https or ftp) then we can't handle the redirect
1958
 
1959
- $NewURL = $MediaURL;
1960
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
1961
  {
1962
  global $powerpress_general_settings;
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://create.blubrry.com/resources/powerpress/
5
  Description: <a href="http://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
+ Version: 4.0.9
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
33
  die("access denied.");
34
 
35
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
36
+ define('POWERPRESS_VERSION', '4.0.9' );
37
 
38
  // Translation support:
39
  if ( !defined('POWERPRESS_ABSPATH') )
395
  $cat_ID = get_query_var('cat');
396
 
397
  $Feed = get_option('powerpress_feed'); // Get the main feed settings
398
+ if( !empty($powerpress_feed['category']) )
399
  {
400
+ $CustomFeed = get_option('powerpress_cat_feed_'.$powerpress_feed['category']); // Get the custom podcast feed settings saved in the database
401
+ if( $CustomFeed )
402
+ $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
403
+ }
404
+ else if( !empty($powerpress_feed['term_taxonomy_id']) )
405
+ {
406
+ $CustomFeed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id']); // Get the taxonomy podcast settings saved in the database
407
  if( $CustomFeed )
408
  $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
409
  }
510
  else // Use the default image
511
  {
512
  echo "\t". '<image>' .PHP_EOL;
513
+ if( (is_category() || is_tax() || is_tag() ) && !empty($Feed['title']) )
514
  echo "\t\t".'<title>' . esc_html( get_bloginfo_rss('name') ) . '</title>'.PHP_EOL;
515
  else
516
  echo "\t\t".'<title>' . esc_html( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
646
 
647
  // Check and see if we're working with a podcast episode
648
  $custom_enclosure = false;
649
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() && !is_tax() && !is_tag() )
650
  {
651
  $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
652
  $custom_enclosure = true;
841
  if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
842
  return $content; // Another podcasting plugin is enabled...
843
 
844
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() && !is_tag() && !is_tax() )
 
845
  return ''; // We will handle this enclosure in the powerpress_rss2_item() function
846
 
847
  $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches);
895
  {
896
  if( is_category() )
897
  $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
898
+ else if( is_tax() || is_tag() ) {
899
+ global $powerpress_feed;
900
+ if( !empty($powerpress_feed['term_taxonomy_id']) )
901
+ $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
902
+ }
903
  else
904
  $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
905
  //$Feed = true;
1265
  $powerpress_feed['podcast_embed_in_feed'] = true;
1266
  return;
1267
  }
1268
+ else if( ( defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($Powerpress['taxonomy_podcasting']) ) && ( is_tag() || is_tax() ) )
1269
+ {
1270
+ // We need to get the term_id and the tax_id (tt_id)
1271
+ $term_slug = get_query_var('term');
1272
+ $taxonomy = get_query_var('taxonomy');
1273
+ $term = term_exists($term_slug, $taxonomy);
1274
+
1275
+ if( !empty($term['term_taxonomy_id']) )
1276
+ {
1277
+ $FeedCustom = get_option('powerpress_taxonomy_'.$term['term_taxonomy_id'] ); // Get custom feed specific settings
1278
+ if( $FeedCustom )
1279
+ {
1280
+ $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1281
+
1282
+ $powerpress_feed = array();
1283
+ $powerpress_feed['is_custom'] = true;
1284
+ $powerpress_feed['term_taxonomy_id'] = $term['term_taxonomy_id'];
1285
+ $powerpress_feed['process_podpress'] = false; // Taxonomy feeds will not originate from Podpress
1286
+ $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1287
+ $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1288
+ $explicit_array = array("no", "yes", "clean");
1289
+ $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1290
+ if( $Feed['itunes_talent_name'] )
1291
+ $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1292
+ else
1293
+ $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
1294
+ $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1295
+ $powerpress_feed['posts_per_rss'] = false;
1296
+ if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1297
+ $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1298
+ if( $Feed['feed_redirect_url'] != '' )
1299
+ $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1300
+ if( $Feed['itunes_author_post'] == true )
1301
+ $powerpress_feed['itunes_author_post'] = true;
1302
+ if( $Feed['rss_language'] != '' )
1303
+ $powerpress_feed['rss_language'] = $Feed['rss_language'];
1304
+
1305
+ if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1306
+ $powerpress_feed['podcast_embed_in_feed'] = true;
1307
+ return;
1308
+ }
1309
+ }
1310
+ }
1311
 
1312
  $feed_slug = get_query_var('feed');
1313
 
1439
 
1440
  function powerpress_posts_join($join)
1441
  {
1442
+ if( is_category() || is_tag() || is_tax() )
1443
  return $join;
1444
 
1445
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) && !is_category() )
1456
 
1457
  function powerpress_posts_where($where)
1458
  {
1459
+ if( is_category() || is_tag() || is_tax() )
1460
  return $where;
1461
 
1462
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) )
1483
  // Add the groupby needed for enclosures only
1484
  function powerpress_posts_groupby($groupby)
1485
  {
1486
+ if( is_category() || is_tag() || is_tax() )
1487
  return $groupby;
1488
 
1489
  if( is_feed() && (powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' ) )
2009
  if( preg_match('/^http\:/i', $MediaURL) === false )
2010
  return $MediaURL; // If the user is hosting media not via http (e.g. https or ftp) then we can't handle the redirect
2011
 
2012
+ $NewURL = apply_filters('powerpress_redirect_url', $MediaURL);
2013
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
2014
  {
2015
  global $powerpress_general_settings;
powerpressadmin-categoryfeeds.php CHANGED
@@ -25,7 +25,7 @@ function powerpress_admin_categoryfeeds()
25
  <p>
26
  <?php echo sprintf( __('If you are looking to organize episodes by file or format, please use %s.', 'powerpress'),
27
  '<a href="'. admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') .'" title="'. __('Custom Podcast Channels') .'">'. __('Custom Podcast Channels') .'</a>'); ?>
28
- </p>'<style type="text/css">
29
  .column-url {
30
  width: 40%;
31
  }
@@ -83,7 +83,14 @@ function powerpress_admin_categoryfeeds()
83
  $count = 0;
84
  while( list($null, $cat_ID) = each($Feeds) )
85
  {
 
 
86
  $category = get_category_to_edit($cat_ID);
 
 
 
 
 
87
 
88
 
89
  $columns = powerpress_admin_customfeeds_columns();
@@ -170,15 +177,16 @@ function powerpress_admin_categoryfeeds()
170
  <div class="form-wrap">
171
  <h3><?php echo __('Add Podcast Settings to existing Category Feed', 'powerpress'); ?></h3>
172
  <input type="hidden" name="action" value="powerpress-addcategoryfeed" />
 
173
  <?php
174
  //wp_original_referer_field(true, 'previous');
175
- wp_nonce_field('powerpress-add-category-feed');
176
  ?>
177
 
178
  <div class="form-field form-required">
179
  <label for="feed_name"><?php echo __('Category', 'powerpress') ?></label>
180
  <?php
181
- wp_dropdown_categories( array('class'=>'category-list', 'show_option_none'=>__('Select Category', 'powerpress'), 'orderby'=>'name', 'hide_empty'=>0, 'hierarchical'=>1, 'name'=>'cat', 'id'=>'cat_id' ) );
182
  ?>
183
 
184
 
25
  <p>
26
  <?php echo sprintf( __('If you are looking to organize episodes by file or format, please use %s.', 'powerpress'),
27
  '<a href="'. admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') .'" title="'. __('Custom Podcast Channels') .'">'. __('Custom Podcast Channels') .'</a>'); ?>
28
+ </p><style type="text/css">
29
  .column-url {
30
  width: 40%;
31
  }
83
  $count = 0;
84
  while( list($null, $cat_ID) = each($Feeds) )
85
  {
86
+ if( empty($cat_ID) )
87
+ continue;
88
  $category = get_category_to_edit($cat_ID);
89
+ if( is_wp_error($category) ) {
90
+ // $cat_ID does not existing
91
+ continue;
92
+ }
93
+ //var_dump($category);
94
 
95
 
96
  $columns = powerpress_admin_customfeeds_columns();
177
  <div class="form-wrap">
178
  <h3><?php echo __('Add Podcast Settings to existing Category Feed', 'powerpress'); ?></h3>
179
  <input type="hidden" name="action" value="powerpress-addcategoryfeed" />
180
+ <input type="hidden" name="taxonomy" value="category" />
181
  <?php
182
  //wp_original_referer_field(true, 'previous');
183
+ wp_nonce_field('powerpress-add-taxonomy-feed');
184
  ?>
185
 
186
  <div class="form-field form-required">
187
  <label for="feed_name"><?php echo __('Category', 'powerpress') ?></label>
188
  <?php
189
+ wp_dropdown_categories( array('class'=>'category-list', 'show_option_none'=>__('Select Category', 'powerpress'), 'orderby'=>'name', 'hide_empty'=>0, 'hierarchical'=>1, 'name'=>'term', 'id'=>'term_id' ) );
190
  ?>
191
 
192
 
powerpressadmin-dashboard.php CHANGED
@@ -115,37 +115,60 @@ function powerpress_dashboard_stats_content()
115
  if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
116
  return;
117
 
118
- $content = false;
119
  $UserPass = ( !empty($Settings['blubrry_auth']) ? $Settings['blubrry_auth']:'');
120
  $Keyword = ( !empty($Settings['blubrry_program_keyword']) ? $Settings['blubrry_program_keyword']:'');
121
  $StatsCached = get_option('powerpress_stats');
122
- if( $StatsCached && $StatsCached['updated'] > (time()-(60*60*3)) )
 
 
123
  $content = $StatsCached['content'];
 
 
124
 
125
- if( !$content )
 
126
  {
127
- if( !$UserPass )
128
- {
129
- $content = sprintf('<p>'. __('Wait a sec! This feature is only available to Blubrry Podcast Community members. Join our community to get %s and access to other valuable %s.', 'powerpress') .'</p>',
130
- '<a href="http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/" target="_blank">'. __('Free Podcast Statistics') . '</a>',
131
- '<a href="http://create.blubrry.com/resources/" target="_blank">'. __('Services', 'powerpress') . '</a>' );
132
- $content .= ' ';
133
- $content .= sprintf('<p>'. __('Our %s integrated PowerPress makes podcast publishing simple. Check out the %s on our exciting three-step publishing system!', 'powerpress') .'</p>',
134
- '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Podcast Hosting', 'powerpress') .'</a>',
135
- '<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/blubrry-hosting-with-powerpress/" target="_blank">'. __('Video', 'powerpress') .'</a>' );
136
- }
137
- else
138
- {
139
  $api_url = sprintf('%s/stats/%s/summary.html?nobody=1', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Keyword);
140
  $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
141
 
142
- $content = powerpress_remote_fopen($api_url, $UserPass);
143
- if( $content )
144
- update_option('powerpress_stats', array('updated'=>time(), 'content'=>$content) );
145
- else
146
- $content = __('Error: An error occurred authenticating user.', 'powerpress');
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
 
 
 
 
 
149
  ?>
150
  <div>
151
  <?php
115
  if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
116
  return;
117
 
118
+ $content = '';
119
  $UserPass = ( !empty($Settings['blubrry_auth']) ? $Settings['blubrry_auth']:'');
120
  $Keyword = ( !empty($Settings['blubrry_program_keyword']) ? $Settings['blubrry_program_keyword']:'');
121
  $StatsCached = get_option('powerpress_stats');
122
+ if( empty($StatsCached) )
123
+ $StatsCached = array();
124
+ if( !empty($StatsCached['content']) )
125
  $content = $StatsCached['content'];
126
+ if( empty($StatsCached['updated']) )
127
+ $StatsCached['updated'] = 1; // Some time
128
 
129
+ // If no content or it's been over 3 hours...
130
+ if( $UserPass && time() > ($StatsCached['updated']+(60*60*3)) )
131
  {
 
 
 
 
 
 
 
 
 
 
 
 
132
  $api_url = sprintf('%s/stats/%s/summary.html?nobody=1', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Keyword);
133
  $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
134
 
135
+ $new_content = powerpress_remote_fopen($api_url, $UserPass, array(), 2); // Only give this 2 seconds to return results
136
+ if( $new_content )
137
+ {
138
+ update_option('powerpress_stats', array('updated'=>time(), 'content'=>$new_content) );
139
+ $content = $new_content;
140
+ }
141
+ else
142
+ {
143
+ if( empty($StatsCached['retry_count']) )
144
+ $StatsCached['retry_count'] = 1;
145
+ else if( $StatsCached['retry_count'] < 24 )
146
+ $StatsCached['retry_count']++;
147
+
148
+ if( $StatsCached['retry_count'] > 12 ) // After 36 hours, if we keep failing to authenticate then lets clear the data and display the authentication notice.
149
+ {
150
+ $content = '';
151
+ }
152
+ // Update the updated flag so it will not try again for 3 hours...
153
+ update_option('powerpress_stats', array('updated'=>time(), 'content'=>$content, 'retry_count'=>$StatsCached['retry_count'] ) );
154
+ }
155
+ }
156
+
157
+ if( !$UserPass )
158
+ {
159
+ $content = sprintf('<p>'. __('Wait a sec! This feature is only available to Blubrry Podcast Community members. Join our community to get %s and access to other valuable %s.', 'powerpress') .'</p>',
160
+ '<a href="http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/" target="_blank">'. __('Free Podcast Statistics') . '</a>',
161
+ '<a href="http://create.blubrry.com/resources/" target="_blank">'. __('Services', 'powerpress') . '</a>' );
162
+ $content .= ' ';
163
+ $content .= sprintf('<p>'. __('Our %s integrated PowerPress makes podcast publishing simple. Check out the %s on our exciting three-step publishing system!', 'powerpress') .'</p>',
164
+ '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Podcast Hosting', 'powerpress') .'</a>',
165
+ '<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/blubrry-hosting-with-powerpress/" target="_blank">'. __('Video', 'powerpress') .'</a>' );
166
  }
167
+ else if( empty($content) )
168
+ {
169
+ $content = sprintf(__('Error: A network or authentication error occurred. To verify your account, click the link &quot;click here to configure Blubrry Statistics and Hosting services&quot; found in the %s tab.', 'powerpress'), '<a href="'. admin_url("admin.php?page=powerpress/powerpressadmin_basic.php") .'#tab2">'.__('Services &amp; Statistics'.'</a>', 'powerprss') );
170
+ }
171
+
172
  ?>
173
  <div>
174
  <?php
powerpressadmin-editfeed.php CHANGED
@@ -138,52 +138,93 @@ function powerpress_admin_capabilities()
138
 
139
 
140
  // powerpressadmin_editfeed.php
141
- function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
 
142
  {
143
  $SupportUploads = powerpressadmin_support_uploads();
144
  $General = powerpress_get_settings('powerpress_general');
 
 
145
 
 
146
 
147
- if( $feed_slug )
148
  {
149
- $FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
150
- if( !$FeedSettings )
151
- {
152
- $FeedSettings = array();
153
- $FeedSettings['title'] = '';
154
- if( !empty($General['custom_feeds'][$feed_slug]) )
155
- $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
156
- }
157
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
158
-
159
- if( !isset($General['custom_feeds'][$feed_slug]) )
160
- $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
161
- }
162
- else if( $cat_ID )
163
- {
164
- $FeedSettings = powerpress_get_settings('powerpress_cat_feed_'.$cat_ID);
165
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
166
- }
167
- else
168
- {
169
- $FeedSettings = powerpress_get_settings('powerpress_feed');
170
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
 
173
- $FeedTitle = __('Feed Settings', 'powerpress');
174
- if( $feed_slug )
175
- {
176
- $FeedTitle = sprintf( 'Edit Podcast Channel: %s', $General['custom_feeds'][$feed_slug]);
177
- echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
178
- }
179
- else if( $cat_ID )
180
- {
181
- $category = get_category_to_edit($cat_ID);
182
- $FeedTitle = sprintf( __('Edit Category Feed: %s', 'powerpress'), $category->name);
183
- echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
184
- }
185
 
186
- echo '<h2>'. $FeedTitle .'</h2>';
187
 
188
  if( $cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories'])) )
189
  {
@@ -200,7 +241,7 @@ function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
200
  <li><a href="#feed_tab_appearance"><span><?php echo htmlspecialchars(__('Media Appearance', 'powerpress')); ?></span></a></li>
201
  <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
202
  <?php } ?>
203
- <?php if( $cat_ID ) { ?>
204
  <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
205
  <?php } ?>
206
  </ul>
@@ -210,7 +251,7 @@ function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
210
  <?php
211
  //powerpressadmin_edit_feed_general($FeedSettings, $General);
212
  //powerpressadmin_edit_feed_settings($FeedSettings, $General);
213
- powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID, $feed_slug );
214
  ?>
215
  </div>
216
 
@@ -219,7 +260,7 @@ function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
219
  //powerpressadmin_edit_itunes_general($General);
220
  if( $feed_slug != 'podcast' )
221
  powerpressadmin_edit_itunes_general($General, $FeedSettings, $feed_slug, $cat_ID);
222
- powerpressadmin_edit_itunes_feed($FeedSettings, $General, $feed_slug, $cat_ID);
223
  ?>
224
  </div>
225
 
@@ -233,7 +274,7 @@ function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
233
  <div id="feed_tab_appearance" class="powerpress_tab">
234
  <?php
235
  //powerpressadmin_appearance($General);
236
- powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug);
237
  ?>
238
  </div>
239
 
@@ -244,10 +285,10 @@ function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
244
  </div>
245
  <?php } ?>
246
 
247
- <?php if( $cat_ID ) { ?>
248
  <div id="feed_tab_other" class="powerpress_tab">
249
  <?php
250
- powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID)
251
  ?>
252
  </div>
253
  <?php } ?>
@@ -390,7 +431,7 @@ function powerpressadmin_edit_feed_general($FeedSettings, $General)
390
  <?php
391
  }
392
 
393
- function powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID = false, $feed_slug = false)
394
  {
395
  $SupportUploads = powerpressadmin_support_uploads();
396
  if( !isset($FeedSettings['posts_per_rss']) )
@@ -402,9 +443,29 @@ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID = f
402
  if( !isset($FeedSettings['title']) )
403
  $FeedSettings['title'] = '';
404
  if( !isset($FeedSettings['rss_language']) )
405
- $FeedSettings['rss_language'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
 
407
- if( $cat_ID || $feed_slug )
408
  {
409
  ?>
410
  <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
@@ -414,16 +475,12 @@ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID = f
414
  <?php echo __('Feed URL', 'powerpress'); ?>
415
  </th>
416
  <td>
417
- <?php if( $cat_ID ) { ?>
418
- <p style="margin-top: 0;"><a href="<?php echo get_category_feed_link($cat_ID); ?>" target="_blank"><?php echo get_category_feed_link($cat_ID); ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode( str_replace('&amp;', '&', get_category_feed_link($cat_ID))); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a></p>
419
- <?php } else { ?>
420
- <p style="margin-top: 0;"><a href="<?php echo get_feed_link($feed_slug); ?>" target="_blank"><?php echo get_feed_link($feed_slug); ?></a><?php if( empty($FeedSettings['premium']) ) { ?> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_feed_link($feed_slug)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a><?php } ?></p>
421
- <?php
422
  if( !empty($FeedSettings['premium']) )
423
  {
424
  echo __('WARNING: This feed is password protected, it cannot be accessed by public services such as feedvalidator.org or the iTunes podcast directory.', 'powerpress');
425
  } ?>
426
- <?php } ?>
427
  </td>
428
  </tr>
429
  </table>
@@ -434,7 +491,7 @@ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID = f
434
  <table class="form-table">
435
 
436
  <?php
437
- if( $feed_slug || $cat_ID )
438
  {
439
  ?>
440
  <tr valign="top">
@@ -448,7 +505,7 @@ if( $feed_slug || $cat_ID )
448
  <?php } else { ?>
449
  (<?php echo __('leave blank to use blog title', 'powerpress'); ?>)
450
  <?php } ?>
451
- <?php if( $cat_ID ) {
452
  $category = get_category_to_edit($cat_ID);
453
  $CategoryName = htmlspecialchars($category->name);
454
  ?>
@@ -506,11 +563,7 @@ if( $feed_slug || $cat_ID )
506
 
507
  <p><?php echo __('Use this option to redirect this feed to a hosted feed service such as FeedBurner.', 'powerpress'); ?></p>
508
  <?php
509
- if( $cat_ID )
510
- $link = get_category_feed_link($cat_ID);
511
- else
512
- $link = get_feed_link($feed_slug);
513
-
514
  if( strstr($link, '?') )
515
  $link .= "&redirect=no";
516
  else
@@ -528,7 +581,7 @@ else
528
  </th>
529
  <td>
530
  <input type="text" name="Feed[posts_per_rss]"style="width: 50px;" value="<?php echo ( !empty($FeedSettings['posts_per_rss'])? $FeedSettings['posts_per_rss']:''); ?>" maxlength="5" /> <?php echo __('episodes / posts per feed (leave blank to use blog default', 'powerpress'); ?>: <?php form_option('posts_per_rss'); ?>)
531
- <?php if( !$feed_slug && !$cat_ID ) { ?>
532
  <p style="margin-top: 5px; margin-bottomd: 0;"><?php echo __('Note: Setting above applies only to podcast channel feeds', 'powerpress'); ?></p>
533
  <?php } ?>
534
  <p style="margin-top: 5px; margin-bottomd: 0;"><?php echo __('WARNING: Setting this value larger than 10 may cause feed timeout errors and delay podcast directory listings from updating.', 'powerpress'); ?></p>
@@ -652,14 +705,14 @@ if( isset($Languages[ $rss_language ]) )
652
  }
653
 
654
 
655
- function powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID = false)
656
  {
657
  if( !isset($FeedSettings['redirect']) )
658
  $FeedSettings['redirect'] = '';
659
  if( !isset($FeedSettings['premium_label']) )
660
  $FeedSettings['premium_label'] = '';
661
 
662
- if( $cat_ID )
663
  {
664
  ?>
665
  <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
@@ -674,13 +727,17 @@ function powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $
674
  </th>
675
  <td>
676
  <input type="text" style="width: 60%;" name="Feed[redirect]" value="<?php echo $FeedSettings['redirect']; ?>" maxlength="250" />
 
677
  <p><?php echo __('Note: Category Media Redirect URL is applied to category feeds and pages only. The redirect will also apply to single pages if this is the only category associated with the blog post.', 'powerpress'); ?></p>
 
 
 
678
  </td>
679
  </tr>
680
  </table>
681
  <?php
682
  }
683
- else // end if category, else channel...
684
  {
685
  ?>
686
 
@@ -889,7 +946,7 @@ function powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_sl
889
 
890
  }
891
 
892
- function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $feed_slug=false, $cat_ID=false)
893
  {
894
  $SupportUploads = powerpressadmin_support_uploads();
895
  if( !isset($FeedSettings['itunes_subtitle']) )
@@ -1189,6 +1246,12 @@ while( list($value,$desc) = each($explicit) )
1189
  $FeedName = trim($FeedName).' '.__('feed', 'powerpress');
1190
  $FeedURL = get_feed_link($feed_slug);
1191
  }
 
 
 
 
 
 
1192
 
1193
  echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL);
1194
  ?>
138
 
139
 
140
  // powerpressadmin_editfeed.php
141
+ // function powerpress_admin_editfeed($feed_slug=false, $cat_ID = false, $term_taxonomy_id = false)
142
+ function powerpress_admin_editfeed($type='', $type_value = '')
143
  {
144
  $SupportUploads = powerpressadmin_support_uploads();
145
  $General = powerpress_get_settings('powerpress_general');
146
+ $FeedAttribs = array('type'=>$type, 'channel'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
147
+ $feed_slug=false; $cat_ID = false; $term_taxonomy_id = false;
148
 
149
+ $FeedTitle = __('Feed Settings', 'powerpress');
150
 
151
+ switch( $type )
152
  {
153
+ case 'channel': {
154
+ $feed_slug = $type_value;
155
+ $FeedAttribs['channel'] = $type_value;
156
+ $FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
157
+ if( !$FeedSettings )
158
+ {
159
+ $FeedSettings = array();
160
+ $FeedSettings['title'] = '';
161
+ if( !empty($General['custom_feeds'][$feed_slug]) )
162
+ $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
163
+ }
164
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
165
+
166
+ if( !isset($General['custom_feeds'][$feed_slug]) )
167
+ $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
168
+
169
+ $FeedTitle = sprintf( 'Podcast Settings for Channel: %s', $General['custom_feeds'][$feed_slug]);
170
+ echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
171
+
172
+ }; break;
173
+ case 'category': {
174
+ $cat_ID = $type_value;
175
+ $FeedAttribs['category_id'] = $type_value;
176
+ $FeedSettings = powerpress_get_settings('powerpress_cat_feed_'.$cat_ID);
177
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
178
+
179
+ $category = get_category_to_edit($cat_ID);
180
+ $FeedTitle = sprintf( __('Podcast Settings for Category: %s', 'powerpress'), htmlspecialchars($category->name) );
181
+ echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
182
+
183
+ }; break;
184
+ case 'ttid': {
185
+ $term_taxonomy_id = $type_value;
186
+ $FeedAttribs['term_taxonomy_id'] = $type_value;
187
+ $FeedSettings = powerpress_get_settings('powerpress_taxonomy_'.$term_taxonomy_id);
188
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
189
+
190
+ global $wpdb;
191
+ $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = $term_taxonomy_id", ARRAY_A);
192
+ if( !empty( $term_info[0]['term_id']) ) {
193
+ $term_ID = $term_info[0]['term_id'];
194
+ $taxonomy_type = $term_info[0]['taxonomy'];
195
+ $FeedAttribs['term_id'] = $term_ID;
196
+ $FeedAttribs['taxonomy_type'] = $taxonomy_type;
197
+
198
+ $term_object = get_term_to_edit($term_ID, $taxonomy_type);
199
+ $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), htmlspecialchars($term_object->name));
200
+ }
201
+ else
202
+ {
203
+ $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), 'Term ID '.htmlspecialchars($term_taxonomy_id));
204
+ }
205
+ echo sprintf('<input type="hidden" name="ttid" value="%s" />', $term_taxonomy_id);
206
+
207
+ }; break;
208
+ case 'post_type': {
209
+
210
+ $FeedAttribs['post_type'] = $type_value;
211
+ $FeedSettings = powerpress_get_settings('powerpress_post_type_'.$FeedAttribs['post_type']);
212
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
213
+
214
+ //$category = get_category_to_edit($cat_ID);
215
+ $PostTypeTitle = 'TODO';
216
+ $FeedTitle = sprintf( __('Podcast Settings for Post Type: %s', 'powerpress'), htmlspecialchars($PostTypeTitle) );
217
+ echo sprintf('<input type="hidden" name="post_type" value="%s" />', $FeedAttribs['post_type']);
218
+
219
+ }; break;
220
+ default: {
221
+ $FeedSettings = powerpress_get_settings('powerpress_feed');
222
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
223
+ }; break;
224
  }
225
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
227
+ echo '<h2>'. $FeedTitle .'</h2>';
228
 
229
  if( $cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories'])) )
230
  {
241
  <li><a href="#feed_tab_appearance"><span><?php echo htmlspecialchars(__('Media Appearance', 'powerpress')); ?></span></a></li>
242
  <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
243
  <?php } ?>
244
+ <?php if( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type') ) ) { ?>
245
  <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
246
  <?php } ?>
247
  </ul>
251
  <?php
252
  //powerpressadmin_edit_feed_general($FeedSettings, $General);
253
  //powerpressadmin_edit_feed_settings($FeedSettings, $General);
254
+ powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID, $feed_slug, $FeedAttribs );
255
  ?>
256
  </div>
257
 
260
  //powerpressadmin_edit_itunes_general($General);
261
  if( $feed_slug != 'podcast' )
262
  powerpressadmin_edit_itunes_general($General, $FeedSettings, $feed_slug, $cat_ID);
263
+ powerpressadmin_edit_itunes_feed($FeedSettings, $General, $feed_slug, $cat_ID, $FeedAttribs);
264
  ?>
265
  </div>
266
 
274
  <div id="feed_tab_appearance" class="powerpress_tab">
275
  <?php
276
  //powerpressadmin_appearance($General);
277
+ powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug, $FeedAttribs);
278
  ?>
279
  </div>
280
 
285
  </div>
286
  <?php } ?>
287
 
288
+ <?php if( $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'ttid' ) { ?>
289
  <div id="feed_tab_other" class="powerpress_tab">
290
  <?php
291
+ powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID, $FeedAttribs)
292
  ?>
293
  </div>
294
  <?php } ?>
431
  <?php
432
  }
433
 
434
+ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $cat_ID = false, $feed_slug = false, $FeedAttribs = array() )
435
  {
436
  $SupportUploads = powerpressadmin_support_uploads();
437
  if( !isset($FeedSettings['posts_per_rss']) )
443
  if( !isset($FeedSettings['title']) )
444
  $FeedSettings['title'] = '';
445
  if( !isset($FeedSettings['rss_language']) )
446
+ $FeedSettings['rss_language'] = '';
447
+
448
+ $feed_link = '';
449
+ switch( $FeedAttribs['type'])
450
+ {
451
+ case 'category': {
452
+ $feed_link = get_category_feed_link($FeedAttribs['category_id']);
453
+ }; break;
454
+ case 'ttid': {
455
+ $feed_link = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
456
+ }; break;
457
+ case 'post_type': {
458
+ $feed_link = get_post_type_archive_feed_link($FeedAttribs['post_type'], 'podcast');
459
+ }; break;
460
+ case 'channel': {
461
+ $feed_link = get_feed_link($FeedAttribs['channel']);
462
+ }; break;
463
+ default: {
464
+ $feed_link = get_feed_link();
465
+ }; break;
466
+ }
467
 
468
+ if( $FeedAttribs['type'] == 'channel' && !empty($FeedAttribs['type']) )
469
  {
470
  ?>
471
  <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
475
  <?php echo __('Feed URL', 'powerpress'); ?>
476
  </th>
477
  <td>
478
+ <p style="margin-top: 0;"><a href="<?php echo $feed_link; ?>" target="_blank"><?php echo $feed_link; ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode( str_replace('&amp;', '&', $feed_link)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a></p>
479
+ <?php
 
 
 
480
  if( !empty($FeedSettings['premium']) )
481
  {
482
  echo __('WARNING: This feed is password protected, it cannot be accessed by public services such as feedvalidator.org or the iTunes podcast directory.', 'powerpress');
483
  } ?>
 
484
  </td>
485
  </tr>
486
  </table>
491
  <table class="form-table">
492
 
493
  <?php
494
+ if( !empty($FeedAttribs['type']) )
495
  {
496
  ?>
497
  <tr valign="top">
505
  <?php } else { ?>
506
  (<?php echo __('leave blank to use blog title', 'powerpress'); ?>)
507
  <?php } ?>
508
+ <?php if( $FeedAttribs['type'] == 'ttid' ) { } else if( $cat_ID ) {
509
  $category = get_category_to_edit($cat_ID);
510
  $CategoryName = htmlspecialchars($category->name);
511
  ?>
563
 
564
  <p><?php echo __('Use this option to redirect this feed to a hosted feed service such as FeedBurner.', 'powerpress'); ?></p>
565
  <?php
566
+ $link = $feed_link;
 
 
 
 
567
  if( strstr($link, '?') )
568
  $link .= "&redirect=no";
569
  else
581
  </th>
582
  <td>
583
  <input type="text" name="Feed[posts_per_rss]"style="width: 50px;" value="<?php echo ( !empty($FeedSettings['posts_per_rss'])? $FeedSettings['posts_per_rss']:''); ?>" maxlength="5" /> <?php echo __('episodes / posts per feed (leave blank to use blog default', 'powerpress'); ?>: <?php form_option('posts_per_rss'); ?>)
584
+ <?php if( empty($FeedAttribs['type']) ) { ?>
585
  <p style="margin-top: 5px; margin-bottomd: 0;"><?php echo __('Note: Setting above applies only to podcast channel feeds', 'powerpress'); ?></p>
586
  <?php } ?>
587
  <p style="margin-top: 5px; margin-bottomd: 0;"><?php echo __('WARNING: Setting this value larger than 10 may cause feed timeout errors and delay podcast directory listings from updating.', 'powerpress'); ?></p>
705
  }
706
 
707
 
708
+ function powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID = false, $FeedAttribs = array() )
709
  {
710
  if( !isset($FeedSettings['redirect']) )
711
  $FeedSettings['redirect'] = '';
712
  if( !isset($FeedSettings['premium_label']) )
713
  $FeedSettings['premium_label'] = '';
714
 
715
+ if( !empty($FeedAttribs['type']) && ($FeedAttribs['type'] == 'ttid' || $FeedAttribs['type'] == 'category') )
716
  {
717
  ?>
718
  <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
727
  </th>
728
  <td>
729
  <input type="text" style="width: 60%;" name="Feed[redirect]" value="<?php echo $FeedSettings['redirect']; ?>" maxlength="250" />
730
+ <?php if( $FeedAttribs['type'] == 'category' ) { ?>
731
  <p><?php echo __('Note: Category Media Redirect URL is applied to category feeds and pages only. The redirect will also apply to single pages if this is the only category associated with the blog post.', 'powerpress'); ?></p>
732
+ <?php } else if( $FeedAttribs['type'] == 'ttid' ) { ?>
733
+ <p><?php echo __('Note: Media Redirect URL is applied to this podcast feed only. The redirect will NOT apply to pages.', 'powerpress'); ?></p>
734
+ <?php } ?>
735
  </td>
736
  </tr>
737
  </table>
738
  <?php
739
  }
740
+ else if( $feed_slug ) // end if category, else channel...
741
  {
742
  ?>
743
 
946
 
947
  }
948
 
949
+ function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $feed_slug=false, $cat_ID=false, $FeedAttribs = array() )
950
  {
951
  $SupportUploads = powerpressadmin_support_uploads();
952
  if( !isset($FeedSettings['itunes_subtitle']) )
1246
  $FeedName = trim($FeedName).' '.__('feed', 'powerpress');
1247
  $FeedURL = get_feed_link($feed_slug);
1248
  }
1249
+ else if( $FeedAttribs['type'] == 'ttid' )
1250
+ {
1251
+ $term_object = get_term_to_edit($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type']);
1252
+ $FeedName = sprintf( __('%s taxonomy term feed', 'powerpress'), htmlspecialchars($term_object->name) );
1253
+ $FeedURL = get_term_feed_link($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type'], 'rss2');
1254
+ }
1255
 
1256
  echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL);
1257
  ?>
powerpressadmin-metabox.php CHANGED
@@ -116,6 +116,14 @@ function powerpress_meta_box($object, $box)
116
  }
117
  }
118
 
 
 
 
 
 
 
 
 
119
  if( $FeedSlug == 'podcast' && !$iTunesDuration ) // Get the iTunes duration the old way (very old way)
120
  $iTunesDuration = get_post_meta($object->ID, 'itunes:duration', true);
121
 
116
  }
117
  }
118
 
119
+ if( defined('POWERPRESS_AUTO_DETECT_ONCE') && POWERPRESS_AUTO_DETECT_ONCE != false )
120
+ {
121
+ if( $EnclosureLength )
122
+ $GeneralSettings['set_size'] = 1; // specify
123
+ if( $iTunesDuration )
124
+ $GeneralSettings['set_duration'] = 1; // specify
125
+ }
126
+
127
  if( $FeedSlug == 'podcast' && !$iTunesDuration ) // Get the iTunes duration the old way (very old way)
128
  $iTunesDuration = get_post_meta($object->ID, 'itunes:duration', true);
129
 
powerpressadmin-tags.php CHANGED
@@ -182,9 +182,10 @@ function powerpressadmin_tag_option($tag, $value, $label, $default_desc )
182
 
183
  if( $track )
184
  {
 
185
  ?><br />
186
- <input type="radio" name="General[<?php echo $tag; ?>]" value="1" <?php if( $value != '' ) echo 'checked'; ?> /> <?php echo __('Specify', 'powerpress'); ?>:
187
- <input type="text" name="TagValues[<?php echo $tag; ?>]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo ($value?$value:'1'); ?>" maxlength="5" />
188
  <?php
189
  echo __('(value entered increments every episode)', 'powerpress');
190
  }
182
 
183
  if( $track )
184
  {
185
+ $PowerPressTrackNumber = get_option('powerpress_track_number');
186
  ?><br />
187
+ <input type="radio" name="General[<?php echo $tag; ?>]" value="1" <?php if( !empty($value) ) echo 'checked'; ?> /> <?php echo __('Specify', 'powerpress'); ?>:
188
+ <input type="text" name="PowerPressTrackNumber" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo ( !empty($PowerPressTrackNumber) ?$PowerPressTrackNumber:'1'); ?>" maxlength="5" />
189
  <?php
190
  echo __('(value entered increments every episode)', 'powerpress');
191
  }
powerpressadmin.php CHANGED
@@ -102,6 +102,7 @@ function powerpress_admin_init()
102
  $General = (isset($_POST['General'])?$_POST['General']:false);
103
  $FeedSlug = (isset($_POST['feed_slug'])?$_POST['feed_slug']:false);
104
  $Category = (isset($_POST['cat'])?$_POST['cat']:false);
 
105
 
106
  // New iTunes image
107
  if( !empty($_POST['itunes_image_checkbox']) )
@@ -417,6 +418,8 @@ function powerpress_admin_init()
417
  $General['episode_box_author'] = 0;
418
  if( !isset($General['episode_box_explicit'] ) )
419
  $General['episode_box_explicit'] = 0;
 
 
420
  if( !isset($General['episode_box_order'] ) )
421
  $General['episode_box_order'] = 0;
422
 
@@ -481,6 +484,9 @@ function powerpress_admin_init()
481
  $TagValues = $_POST['TagValues'];
482
  $GeneralPosted = $_POST['General'];
483
 
 
 
 
484
  // Set all the tag values...
485
  while( list($key,$value) = each($GeneralPosted) )
486
  {
@@ -489,6 +495,10 @@ function powerpress_admin_init()
489
  // Special case, we are uploading new coverart image
490
  if( !empty($_POST['coverart_image_checkbox']) && $key == 'tag_coverart' )
491
  continue;
 
 
 
 
492
 
493
  if( !empty($value) )
494
  $General[$key] = $TagValues[$key];
@@ -563,6 +573,8 @@ function powerpress_admin_init()
563
  $Feed = powerpress_stripslashes($Feed);
564
  if( $Category )
565
  powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
 
 
566
  else
567
  powerpress_save_settings($Feed, 'powerpress_feed'.($FeedSlug?'_'.$FeedSlug:'') );
568
  }
@@ -652,46 +664,85 @@ function powerpress_admin_init()
652
  $_GET['feed_slug'] = $key;
653
  }
654
  }; break;
 
 
 
 
 
 
 
655
  case 'powerpress-addcategoryfeed': {
656
- check_admin_referer('powerpress-add-category-feed');
657
- $cat_ID = ( isset($_POST['cat'])? $_POST['cat'] : $_GET['cat'] );
658
 
659
- $Settings = get_option('powerpress_general');
660
- /*
661
- $key = sanitize_title($_POST['feed_slug']);
662
- $value = $_POST['feed_name'];
663
- $value = powerpress_stripslashes($value);
664
- */
665
 
666
- $category = get_category($cat_ID);
667
- /*
668
- if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
669
- {
670
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
671
- } else */
672
- if( $cat_ID == false )
 
 
673
  {
674
- powerpress_page_message_add_error( __('You must select a category to continue.', 'powerpress') );
 
 
 
675
  }
676
- else if( $category == false )
677
  {
678
- powerpress_page_message_add_error( __('Error obtaining category information.', 'powerpress') );
679
  }
680
- else
681
  {
 
682
  if( !is_array($Settings['custom_cat_feeds']) )
683
  $Settings['custom_cat_feeds'] = array();
684
 
685
- if( !in_array($cat_ID, $Settings['custom_cat_feeds']) )
686
  {
687
- $Settings['custom_cat_feeds'][] = $cat_ID;
688
  powerpress_save_settings($Settings);
689
  }
690
 
691
  powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
692
 
693
  $_GET['action'] = 'powerpress-editcategoryfeed';
694
- $_GET['cat'] = $cat_ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  }
696
  }; break;
697
  case 'powerpress-ping-sites': {
@@ -762,7 +813,7 @@ function powerpress_admin_init()
762
 
763
  }; break;
764
  case 'powerpress-addcategoryfeed': {
765
- check_admin_referer('powerpress-add-category-feed');
766
  $cat_ID = $_GET['cat'];
767
 
768
  $Settings = get_option('powerpress_general');
@@ -841,6 +892,20 @@ function powerpress_admin_init()
841
 
842
  powerpress_page_message_add_notice( __('Removed podcast settings for category feed successfully.', 'powerpress') );
843
  }; break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844
  case 'powerpress-podpress-settings': {
845
  check_admin_referer('powerpress-podpress-settings');
846
 
@@ -990,6 +1055,11 @@ add_action( 'admin_notices', 'powerpress_admin_notices' );
990
 
991
  function powerpress_save_settings($SettingsNew=false, $field = 'powerpress_general' )
992
  {
 
 
 
 
 
993
  // Save general settings
994
  if( $SettingsNew )
995
  {
@@ -1028,6 +1098,8 @@ function powerpress_save_settings($SettingsNew=false, $field = 'powerpress_gener
1028
  unset($Settings['episode_box_subtitle']);
1029
  if( isset($Settings['episode_box_summary'] ) && $Settings['episode_box_summary'] == 0 )
1030
  unset($Settings['episode_box_summary']);
 
 
1031
  if( isset($Settings['episode_box_author'] ) && $Settings['episode_box_author'] == 0 )
1032
  unset($Settings['episode_box_author']);
1033
  if( isset($Settings['episode_box_explicit'] ) && $Settings['episode_box_explicit'] == 0 )
@@ -1128,11 +1200,20 @@ function powerpress_admin_menu()
1128
  { // Otherwise we're using a version of wordpress that is not supported.
1129
 
1130
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-metabox.php');
1131
- $page_types = powerpress_admin_get_post_types_by_capability_type('page');
1132
- while( list($null,$page_type) = each($page_types) )
1133
- add_meta_box('powerpress-podcast', __('Podcast Episode', 'powerpress'), 'powerpress_meta_box', $page_type, 'normal');
 
 
 
 
 
 
 
 
 
 
1134
 
1135
- $post_types = powerpress_admin_get_post_types_by_capability_type('post');
1136
  if( isset($Powerpress['custom_feeds']) )
1137
  {
1138
  $FeedDefaultPodcast = get_option('powerpress_feed_podcast');
@@ -1215,6 +1296,10 @@ function powerpress_admin_menu()
1215
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Channels', 'powerpress'), __('Podcast Channels', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
1216
  if( !empty($Powerpress['cat_casting']) )
1217
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcasting', 'powerpress'), __('Category Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
 
 
 
 
1218
  if( !empty($Powerpress['podpress_stats']) )
1219
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PodPress Stats', 'powerpress'), __('PodPress Stats', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_podpress-stats.php', 'powerpress_admin_page_podpress_stats');
1220
  if( !empty($Powerpress['blubrry_hosting']) )
@@ -2121,7 +2206,7 @@ function powerpress_cat_row_actions($actions, $object)
2121
  }
2122
  else
2123
  {
2124
- $edit_link = admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;from_categories=1&amp;action=powerpress-addcategoryfeed&amp;cat=".$cat_id, 'powerpress-add-category-feed');
2125
  $actions['powerpress'] = '<a href="' . $edit_link . '" title="'. __('Add Blubrry PowerPress Podcasting Settings', 'powerpress') .'">' . str_replace(' ', '&nbsp;', __('Add Podcasting', 'powerpress')) . '</a>';
2126
  }
2127
  return $actions;
@@ -2130,23 +2215,37 @@ function powerpress_cat_row_actions($actions, $object)
2130
  add_filter('cat_row_actions', 'powerpress_cat_row_actions', 1,2);
2131
  add_filter('tag_row_actions', 'powerpress_cat_row_actions', 1,2);
2132
 
2133
-
2134
- function powerpress_delete_category($cat_ID)
2135
  {
2136
- $Settings = get_option('powerpress_general');
2137
- if( isset($Settings['custom_cat_feeds']) )
2138
  {
2139
- $key = array_search($cat_ID, $Settings['custom_cat_feeds']);
2140
- if( $key !== false )
2141
  {
2142
- unset( $Settings['custom_cat_feeds'][$key] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2143
  powerpress_save_settings($Settings); // Delete the feed from the general settings
2144
  }
 
2145
  }
2146
- delete_option('powerpress_cat_feed_'.$cat_ID); // Delete the actual feed settings
2147
  }
2148
 
2149
- add_action('delete_category', 'powerpress_delete_category');
2150
 
2151
 
2152
  function powerpress_edit_category_form($cat)
@@ -2294,7 +2393,7 @@ function powerpress_admin_page_customfeeds()
2294
  powerpress_admin_page_header('powerpress/powerpressadmin_customfeeds.php');
2295
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2296
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2297
- powerpress_admin_editfeed($_GET['feed_slug']);
2298
  powerpress_admin_page_footer();
2299
  }; break;
2300
  default: {
@@ -2316,7 +2415,7 @@ function powerpress_admin_page_categoryfeeds()
2316
  powerpress_admin_page_header('powerpress/powerpressadmin_categoryfeeds.php');
2317
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2318
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2319
- powerpress_admin_editfeed(false, $_GET['cat']);
2320
  powerpress_admin_page_footer();
2321
  }; break;
2322
  default: {
@@ -2328,6 +2427,55 @@ function powerpress_admin_page_categoryfeeds()
2328
  }
2329
  }
2330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2331
  // Admin page, advanced mode: tools
2332
  function powerpress_admin_page_tools()
2333
  {
@@ -2989,9 +3137,18 @@ function powerpress_write_tags($file, $post_title)
2989
  {
2990
  if( !empty($Settings[ 'tag_'.$field ]) )
2991
  {
2992
- $PostArgs[ $field ] = $Settings[ 'tag_'.$field ];
2993
  if( $field == 'track' )
2994
- powerpress_save_settings(array('tag_track'=>$NewNumber), 'powerpress_general');
 
 
 
 
 
 
 
 
 
 
2995
  }
2996
  else
2997
  {
102
  $General = (isset($_POST['General'])?$_POST['General']:false);
103
  $FeedSlug = (isset($_POST['feed_slug'])?$_POST['feed_slug']:false);
104
  $Category = (isset($_POST['cat'])?$_POST['cat']:false);
105
+ $term_taxonomy_id = (isset($_POST['ttid'])?$_POST['ttid']:false);
106
 
107
  // New iTunes image
108
  if( !empty($_POST['itunes_image_checkbox']) )
418
  $General['episode_box_author'] = 0;
419
  if( !isset($General['episode_box_explicit'] ) )
420
  $General['episode_box_explicit'] = 0;
421
+ if( !isset($General['episode_box_closed_captioned'] ) )
422
+ $General['episode_box_closed_captioned'] = 0;
423
  if( !isset($General['episode_box_order'] ) )
424
  $General['episode_box_order'] = 0;
425
 
484
  $TagValues = $_POST['TagValues'];
485
  $GeneralPosted = $_POST['General'];
486
 
487
+ if( !empty($_POST['PowerPressTrackNumber']) ) {
488
+ update_option('powerpress_track_number', $_POST['PowerPressTrackNumber']);
489
+ }
490
  // Set all the tag values...
491
  while( list($key,$value) = each($GeneralPosted) )
492
  {
495
  // Special case, we are uploading new coverart image
496
  if( !empty($_POST['coverart_image_checkbox']) && $key == 'tag_coverart' )
497
  continue;
498
+
499
+ // Specail case, the track is saved in a separate column in the database.
500
+ if( $key == 'tag_track' )
501
+ continue;
502
 
503
  if( !empty($value) )
504
  $General[$key] = $TagValues[$key];
573
  $Feed = powerpress_stripslashes($Feed);
574
  if( $Category )
575
  powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
576
+ else if ( $term_taxonomy_id )
577
+ powerpress_save_settings($Feed, 'powerpress_taxonomy_'.$term_taxonomy_id);
578
  else
579
  powerpress_save_settings($Feed, 'powerpress_feed'.($FeedSlug?'_'.$FeedSlug:'') );
580
  }
664
  $_GET['feed_slug'] = $key;
665
  }
666
  }; break;
667
+ case 'powerpress-addtaxonomyfeed': {
668
+ if( !empty($_POST['cancel']) )
669
+ unset($_POST['taxonomy']);
670
+
671
+ if( empty($_POST['add_podcasting']) )
672
+ break; // We do not handle this situation
673
+ }
674
  case 'powerpress-addcategoryfeed': {
675
+
676
+ check_admin_referer('powerpress-add-taxonomy-feed');
677
 
 
 
 
 
 
 
678
 
679
+
680
+
681
+ $taxonomy_type = ( isset($_POST['taxonomy'])? $_POST['taxonomy'] : $_GET['taxonomy'] );
682
+ $term_ID = ( isset($_POST['term'])? $_POST['term'] : $_GET['term'] );
683
+
684
+
685
+ $term_object = get_term( $term_ID, $taxonomy_type, OBJECT, 'edit');
686
+
687
+ if( empty($term_ID) )
688
  {
689
+ if( $taxonomy_type == 'category' )
690
+ powerpress_page_message_add_error( __('You must select a category to continue.', 'powerpress') );
691
+ else
692
+ powerpress_page_message_add_error( __('You must select a term to continue.', 'powerpress') );
693
  }
694
+ else if( $term_object == false )
695
  {
696
+ powerpress_page_message_add_error( __('Error obtaining term information.', 'powerpress') );
697
  }
698
+ else if( $taxonomy_type == 'category' )
699
  {
700
+ $Settings = get_option('powerpress_general');
701
  if( !is_array($Settings['custom_cat_feeds']) )
702
  $Settings['custom_cat_feeds'] = array();
703
 
704
+ if( !in_array($term_ID, $Settings['custom_cat_feeds']) )
705
  {
706
+ $Settings['custom_cat_feeds'][] = $term_ID;
707
  powerpress_save_settings($Settings);
708
  }
709
 
710
  powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
711
 
712
  $_GET['action'] = 'powerpress-editcategoryfeed';
713
+ $_GET['cat'] = $term_ID;
714
+ }
715
+ else
716
+ {
717
+
718
+
719
+ //$term_info = term_exists($term_ID, $taxonomy_type);
720
+ $tt_id = $term_object->term_taxonomy_id;
721
+ //var_dump($term_info);
722
+ //exit;
723
+ // if( !empty($term_info['term_taxonomy_id']) )
724
+ // $tt_id = $term_info['term_taxonomy_id'];
725
+
726
+ if( !$tt_id )
727
+ {
728
+
729
+ }
730
+ else
731
+ {
732
+ $Settings = get_option('powerpress_taxonomy_podcasting');
733
+
734
+ if( !isset($Settings[ $tt_id ]) )
735
+ {
736
+ $Settings[ $tt_id ] = true;
737
+ powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // add the feed to the taxonomy podcasting list
738
+ }
739
+
740
+ powerpress_page_message_add_notice( __('Please configure your taxonomy podcast now.', 'powerpress') );
741
+
742
+ $_GET['action'] = 'powerpress-edittaxonomyfeed';
743
+ $_GET['term'] = $term_ID;
744
+ $_GET['ttid'] = $tt_id;
745
+ }
746
  }
747
  }; break;
748
  case 'powerpress-ping-sites': {
813
 
814
  }; break;
815
  case 'powerpress-addcategoryfeed': {
816
+ check_admin_referer('powerpress-add-taxonomy-feed');
817
  $cat_ID = $_GET['cat'];
818
 
819
  $Settings = get_option('powerpress_general');
892
 
893
  powerpress_page_message_add_notice( __('Removed podcast settings for category feed successfully.', 'powerpress') );
894
  }; break;
895
+ case 'powerpress-delete-taxonomy-feed': {
896
+ $tt_ID = $_GET['ttid'];
897
+ check_admin_referer('powerpress-delete-taxonomy-feed-'.$tt_ID);
898
+
899
+ $Settings = get_option('powerpress_taxonomy_podcasting');
900
+ if( !empty($Settings[ $tt_ID ]) )
901
+ {
902
+ unset( $Settings[ $tt_ID ] );
903
+ powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // Delete the feed from the general settings
904
+ }
905
+ delete_option('powerpress_taxonomy_'.$tt_ID); // Delete the actual feed settings
906
+
907
+ powerpress_page_message_add_notice( __('Removed podcast settings for term successfully.', 'powerpress') );
908
+ }; break;
909
  case 'powerpress-podpress-settings': {
910
  check_admin_referer('powerpress-podpress-settings');
911
 
1055
 
1056
  function powerpress_save_settings($SettingsNew=false, $field = 'powerpress_general' )
1057
  {
1058
+ if( $field == 'powerpress_taxonomy_podcasting' ) { // No merging settings for these fields...
1059
+ update_option($field, $SettingsNew);
1060
+ return;
1061
+ }
1062
+
1063
  // Save general settings
1064
  if( $SettingsNew )
1065
  {
1098
  unset($Settings['episode_box_subtitle']);
1099
  if( isset($Settings['episode_box_summary'] ) && $Settings['episode_box_summary'] == 0 )
1100
  unset($Settings['episode_box_summary']);
1101
+ if( isset($Settings['episode_box_closed_captioned'] ) && $Settings['episode_box_closed_captioned'] == 0 )
1102
+ unset($Settings['episode_box_closed_captioned']);
1103
  if( isset($Settings['episode_box_author'] ) && $Settings['episode_box_author'] == 0 )
1104
  unset($Settings['episode_box_author']);
1105
  if( isset($Settings['episode_box_explicit'] ) && $Settings['episode_box_explicit'] == 0 )
1200
  { // Otherwise we're using a version of wordpress that is not supported.
1201
 
1202
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-metabox.php');
1203
+ if( !defined('POWERPRESS_POST_TYPES') )
1204
+ {
1205
+ $page_types = powerpress_admin_get_post_types_by_capability_type('page');
1206
+ while( list($null,$page_type) = each($page_types) )
1207
+ add_meta_box('powerpress-podcast', __('Podcast Episode', 'powerpress'), 'powerpress_meta_box', $page_type, 'normal');
1208
+
1209
+ $post_types = powerpress_admin_get_post_types_by_capability_type('post');
1210
+ }
1211
+ else
1212
+ {
1213
+ $post_type_string = str_replace(' ', '',POWERPRESS_POST_TYPES); // Get all the spaces out
1214
+ $post_types = explode(',', $post_type_string);
1215
+ }
1216
 
 
1217
  if( isset($Powerpress['custom_feeds']) )
1218
  {
1219
  $FeedDefaultPodcast = get_option('powerpress_feed_podcast');
1296
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Channels', 'powerpress'), __('Podcast Channels', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
1297
  if( !empty($Powerpress['cat_casting']) )
1298
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcasting', 'powerpress'), __('Category Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
1299
+ ////if( defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($Powerpress['taxonomy_podcasting']) )
1300
+ //// add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Taxonomy Podcasting', 'powerpress'), __('Taxonomy Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_taxonomyfeeds.php', 'powerpress_admin_page_taxonomyfeeds');
1301
+ ////if( defined('POWERPRESS_POSTTYPE_PODCASTING') || !empty($Powerpress['posttype_podcasting']) )
1302
+ //// add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Post Type Podcasting', 'powerpress'), __('Post Type Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_posttypefeeds.php', 'powerpress_admin_page_posttypefeeds');
1303
  if( !empty($Powerpress['podpress_stats']) )
1304
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PodPress Stats', 'powerpress'), __('PodPress Stats', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_podpress-stats.php', 'powerpress_admin_page_podpress_stats');
1305
  if( !empty($Powerpress['blubrry_hosting']) )
2206
  }
2207
  else
2208
  {
2209
+ $edit_link = admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;from_categories=1&amp;action=powerpress-addcategoryfeed&amp;taxonomy=category&amp;cat=".$cat_id, 'powerpress-add-taxonomy-feed');
2210
  $actions['powerpress'] = '<a href="' . $edit_link . '" title="'. __('Add Blubrry PowerPress Podcasting Settings', 'powerpress') .'">' . str_replace(' ', '&nbsp;', __('Add Podcasting', 'powerpress')) . '</a>';
2211
  }
2212
  return $actions;
2215
  add_filter('cat_row_actions', 'powerpress_cat_row_actions', 1,2);
2216
  add_filter('tag_row_actions', 'powerpress_cat_row_actions', 1,2);
2217
 
2218
+ // Handles category and all other taxonomy terms
2219
+ function powerpress_delete_term($term_id, $tt_id, $taxonomy)
2220
  {
2221
+ if( $taxonomy == 'category' )
 
2222
  {
2223
+ $Settings = get_option('powerpress_general');
2224
+ if( isset($Settings['custom_cat_feeds']) )
2225
  {
2226
+ $key = array_search($term_id, $Settings['custom_cat_feeds']);
2227
+ if( $key !== false )
2228
+ {
2229
+ unset( $Settings['custom_cat_feeds'][$key] );
2230
+ powerpress_save_settings($Settings); // Delete the feed from the general settings
2231
+ }
2232
+ }
2233
+ delete_option('powerpress_cat_feed_'.$term_id); // Delete the actual feed settings
2234
+ }
2235
+ else // All other taxonomies handled here
2236
+ {
2237
+ $Settings = get_option('powerpress_taxonomy_podcasting');
2238
+
2239
+ if( isset($Settings[ $tt_id ]) )
2240
+ {
2241
+ unset( $Settings[ $tt_id ] );
2242
  powerpress_save_settings($Settings); // Delete the feed from the general settings
2243
  }
2244
+ delete_option('powerpress_taxonomy_'.$tt_id); // Delete the actual feed settings
2245
  }
 
2246
  }
2247
 
2248
+ add_action('delete_term', 'powerpress_delete_term');
2249
 
2250
 
2251
  function powerpress_edit_category_form($cat)
2393
  powerpress_admin_page_header('powerpress/powerpressadmin_customfeeds.php');
2394
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2395
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2396
+ powerpress_admin_editfeed('channel', $_GET['feed_slug']);
2397
  powerpress_admin_page_footer();
2398
  }; break;
2399
  default: {
2415
  powerpress_admin_page_header('powerpress/powerpressadmin_categoryfeeds.php');
2416
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2417
  require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2418
+ powerpress_admin_editfeed('category', $_GET['cat']);
2419
  powerpress_admin_page_footer();
2420
  }; break;
2421
  default: {
2427
  }
2428
  }
2429
 
2430
+ // Taxonomy Feeds
2431
+ function powerpress_admin_page_taxonomyfeeds()
2432
+ {
2433
+ $Action = (!empty($_GET['action'])? $_GET['action'] : false);
2434
+ switch( $Action )
2435
+ {
2436
+ case 'powerpress-edittaxonomyfeed' : {
2437
+ if( !empty($_GET['ttid']) )
2438
+ {
2439
+ powerpress_admin_page_header('powerpress/powerpressadmin_taxonomyfeeds.php');
2440
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2441
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2442
+ powerpress_admin_editfeed('ttid', $_GET['ttid']);
2443
+ powerpress_admin_page_footer();
2444
+ }
2445
+ }; break;
2446
+ default: {
2447
+ powerpress_admin_page_header('powerpress/powerpressadmin_taxonomyfeeds.php', 'powerpress-add-taxonomyfeed');
2448
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-taxonomyfeeds.php');
2449
+ powerpress_admin_taxonomyfeeds();
2450
+ powerpress_admin_page_footer(false);
2451
+ };
2452
+ }
2453
+ }
2454
+
2455
+ // Custom Post Type Feeds
2456
+ function powerpress_admin_page_posttypefeeds()
2457
+ {
2458
+ $Action = (!empty($_GET['action'])? $_GET['action'] : false);
2459
+ switch( $Action )
2460
+ {
2461
+ case 'powerpress-editcategoryfeed' : {
2462
+ if( !empty($_GET['post_type']) ) {
2463
+ powerpress_admin_page_header('powerpress/powerpressadmin_posttypefeeds.php');
2464
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-editfeed.php');
2465
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-basic.php');
2466
+ powerpress_admin_editfeed('post_type', $_GET['post_type']);
2467
+ powerpress_admin_page_footer();
2468
+ }
2469
+ }; break;
2470
+ default: {
2471
+ powerpress_admin_page_header('powerpress/powerpressadmin_posttypefeeds.php', 'powerpress-add-posttypefeed');
2472
+ require_once( POWERPRESS_ABSPATH .'/powerpressadmin-posttypefeeds.php');
2473
+ powerpress_admin_categoryfeeds();
2474
+ powerpress_admin_page_footer(false);
2475
+ };
2476
+ }
2477
+ }
2478
+
2479
  // Admin page, advanced mode: tools
2480
  function powerpress_admin_page_tools()
2481
  {
3137
  {
3138
  if( !empty($Settings[ 'tag_'.$field ]) )
3139
  {
 
3140
  if( $field == 'track' )
3141
+ {
3142
+ $TrackNumber = get_option('powerpress_track_number');
3143
+ if( empty($TrackNumber) )
3144
+ $TrackNumber = 1;
3145
+ $PostArgs[ $field ] = $TrackNumber;
3146
+ update_option('powerpress_track_number', ($TrackNumber+1) );
3147
+ }
3148
+ else
3149
+ {
3150
+ $PostArgs[ $field ] = $Settings[ 'tag_'.$field ];
3151
+ }
3152
  }
3153
  else
3154
  {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Angelo Mandato, Blubrry.com
3
  Tags: podcasting, podcast, podcaster, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, webm, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, podlove, podcast.de
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
- Stable tag: 4.0.8
7
 
8
  Blubrry PowerPress brings the essential features for podcasting to WordPress including full iTunes support, web audio/video media players and more.
9
 
@@ -15,7 +15,7 @@ Blubrry PowerPress brings the essential features for podcasting to WordPress. De
15
  PowerPress 4.0 includes all of the latest [Apple iTunes podcasting specifications](http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/). Don't be left behind, upgrade to PowerPress 4.0 today!
16
 
17
  = Currently Using PodPress? =
18
- Switching to PowerPress is seamless, just enable PowerPress then disable PodPress and you're done! Switching plugins is that easy! Visit **[Migrating from PodPress to PowerPress](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-podpress-to-powerpress/)** for details.
19
 
20
  = PowerPress Key Features =
21
  - HTML5 video support: Add both mp4 and webm media to each episode for maximum platform compatibility
@@ -159,11 +159,23 @@ To install Blubrry PowerPress manually, follow these steps:
159
  * PowerPress 3.0+ is not compatible with WordPress 2.8.x and 2.9.x. Please upgrade to WordPress 3.0 or newer to install PowerPress.
160
  * Translation support is now complete. Please visit the following link if you would like to have a version in your language: [http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/translating-powerpress/](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/translating-powerpress/)
161
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  = 4.0.8 =
164
  * Released on 4/19/2013
165
- * **[PowerPress Version Updates Survey](https://docs.google.com/forms/d/1_sWoSwutK7VjvqaEQNV5Ww0-c0kVUUnDKqOtjbP-DXs/viewform?pli=1)** - please participate, only 4 questions!
166
- * **[Blubrry Create](http://create.blubrry.com) site launched! Site includes our [Podcasting Manual](http://create.blubrry.com/manual/)**, [Blubrry Resources](http://create.blubrry.com/resources/) and [Support Options](http://create.blubrry.com/support/).
167
  * Completely rewrote logic added in 4.0.7 to fix the conflict with Yoast Google Analytics plugin. This sholud solve the issues folks have been having when using this plugin with PowerPress.
168
  * Flow Player Classic audio player height changed from 24 to 22 when Firefox detected, displays correctly in Firefox with this custom height.
169
  * Added code to prevent possible "Empty delimiter" warning for strstr function calls in plugin.
@@ -602,7 +614,7 @@ To install Blubrry PowerPress manually, follow these steps:
602
 
603
  = 0.9.9 =
604
  * Released on 9/12/2009
605
- * No longer checking content type returned from servers, check effected video podcasters who have no control of their servers.
606
  * Added Media URL redirect warning when redirects exceed 5, previously this was an error.
607
  * Better detection used when server does not support HTTP URL connections, we now display a message when `allow_url_fopen` setting is disabled and cURL library not available.
608
  * Blubrry Services Integration, added message when authentication failed and display error when web server does not support Blubrry services.
3
  Tags: podcasting, podcast, podcaster, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, webm, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, podlove, podcast.de
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
+ Stable tag: 4.0.9
7
 
8
  Blubrry PowerPress brings the essential features for podcasting to WordPress including full iTunes support, web audio/video media players and more.
9
 
15
  PowerPress 4.0 includes all of the latest [Apple iTunes podcasting specifications](http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/). Don't be left behind, upgrade to PowerPress 4.0 today!
16
 
17
  = Currently Using PodPress? =
18
+ Switching to PowerPress is seamless, just enable PowerPress then disable PodPress and you're done! Switching plugins is that easy! Visit [Migrating from PodPress to PowerPress](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-podpress-to-powerpress/) for details.
19
 
20
  = PowerPress Key Features =
21
  - HTML5 video support: Add both mp4 and webm media to each episode for maximum platform compatibility
159
  * PowerPress 3.0+ is not compatible with WordPress 2.8.x and 2.9.x. Please upgrade to WordPress 3.0 or newer to install PowerPress.
160
  * Translation support is now complete. Please visit the following link if you would like to have a version in your language: [http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/translating-powerpress/](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/translating-powerpress/)
161
 
162
+ = 4.0.9 =
163
+ * Releaesd on 6/20/2013
164
+ * PowerPress 5.0 is coming! If you would like to beta test, please contact Angelo at cio [at] rawovice dot com. Beta testing starts when WordPress 3.6 is released, PowerPress 5.0 will utilize some new features in WordPress 3.6.
165
+ * The PowerPress Version Updates Survey results will be posted in the coming weeks. Based on user feedback, we will release minor updates within 7 days if necessary, major releases between 1-3 months apart, and new features will be included in the plguin but disabled by default.
166
+ * Fixed logic for displaying statistics in dashboard to time out after 1 second (was previously 15 seconds) so if there's a network issue between the server and blubrry.com the dashboard still loads promptly. (Thanks Michael Hansen for bringing to our attention!)
167
+ * Added new filter `powerpress_feed_auth` for other plugins to filter feed authentication. (Thanks amereservant for the feature suggestion!)
168
+ * Added new define `POWERPRESS_AUTO_DETECT_ONCE`, edits to existing episodes will use the specify option if this define is set to true. (Thanks amereservant for the feature suggestion!)
169
+ * Fixed bug with ID3 tagging not correctly incrementing the track number for episodes. This only affected Blubrry hosting customers who had this option turned on. (Thanks RWPeck for bringing to our attention!)
170
+ * Mobile devices now use the same HTML5 player as the regular desktop HTML5 player found in PowerPress. This is due to reports that some mobile devices are now pre-loading media on pages, this will cut down on such bandwidth. (Thanks Daniel for bringing to our attention)
171
+ * Added new define `POWERPRESS_POST_TYPES`, when set, only the post types specified are given podcasting episode entry boxes. Multiple post types are separated by commas. Example with added movies custom post type added: `'page,post,movies'`. This will bypass the default behavior of adding episode boxes to all post types with `post` or `page` capability.
172
+ * Fixed bug with unchecking iTunes Closed Captioned option not saving. (Thanks davidcross for reporting bug)
173
+
174
 
175
  = 4.0.8 =
176
  * Released on 4/19/2013
177
+ * PowerPress Version Updates Survey - Thanks everyone for participating!
178
+ * [Blubrry Create](http://create.blubrry.com) site launched! Site includes our [Podcasting Manual](http://create.blubrry.com/manual/), [Blubrry Resources](http://create.blubrry.com/resources/) and [Support Options](http://create.blubrry.com/support/).
179
  * Completely rewrote logic added in 4.0.7 to fix the conflict with Yoast Google Analytics plugin. This sholud solve the issues folks have been having when using this plugin with PowerPress.
180
  * Flow Player Classic audio player height changed from 24 to 22 when Firefox detected, displays correctly in Firefox with this custom height.
181
  * Added code to prevent possible "Empty delimiter" warning for strstr function calls in plugin.
614
 
615
  = 0.9.9 =
616
  * Released on 9/12/2009
617
+ * No longer checking content type returned from servers, check affected video podcasters who have no control of their servers.
618
  * Added Media URL redirect warning when redirects exceed 5, previously this was an error.
619
  * Better detection used when server does not support HTTP URL connections, we now display a message when `allow_url_fopen` setting is disabled and cURL library not available.
620
  * Blubrry Services Integration, added message when authentication failed and display error when web server does not support Blubrry services.