PowerPress Podcasting plugin by Blubrry - Version 5.0.5

Version Description

  • Released on 3/2/2014
  • Added logic for Blubrry Services to use alternative API servers to address random issues with session errors.
Download this release

Release Info

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

Code changes from version 5.0.4 to 5.0.5

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: 5.0.4
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
@@ -32,7 +32,7 @@ if( !function_exists('add_action') )
32
  die("access denied.");
33
 
34
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
35
- define('POWERPRESS_VERSION', '5.0.4' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
@@ -2715,6 +2715,22 @@ function powerpress_is_mobile_client()
2715
 
2716
  return false;
2717
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2718
  /*
2719
  End Helper Functions
2720
  */
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: 5.0.5
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
32
  die("access denied.");
33
 
34
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
35
+ define('POWERPRESS_VERSION', '5.0.5' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
2715
 
2716
  return false;
2717
  }
2718
+
2719
+ function powerpress_get_api_array()
2720
+ {
2721
+ $return = array();
2722
+ if( strstr(POWERPRESS_BLUBRRY_API_URL, 'api.blubrry') == false )
2723
+ {
2724
+ $return[] = POWERPRESS_BLUBRRY_API_URL;
2725
+ }
2726
+ else
2727
+ {
2728
+ $return[] = 'http://api.blubrry.net/';
2729
+ $return[] = 'http://api.blubrry.com/';
2730
+ }
2731
+
2732
+ return $return;
2733
+ }
2734
  /*
2735
  End Helper Functions
2736
  */
powerpressadmin-dashboard.php CHANGED
@@ -129,29 +129,37 @@ function powerpress_dashboard_stats_content()
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 )
129
  // If no content or it's been over 3 hours...
130
  if( $UserPass && time() > ($StatsCached['updated']+(60*60*3)) )
131
  {
132
+ $success = false;
133
+ $api_url_array = powerpress_get_api_array();
134
+ while( list($index,$api_url) = each($api_url_array) )
135
+ {
136
+ $req_url = sprintf('%s/stats/%s/summary.html?nobody=1', rtrim($api_url, '/'), $Keyword);
137
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
138
+
139
+ $new_content = powerpress_remote_fopen($req_url, $UserPass, array(), 2); // Only give this 2 seconds to return results
140
  if( $new_content )
141
  {
142
  update_option('powerpress_stats', array('updated'=>time(), 'content'=>$new_content) );
143
  $content = $new_content;
144
+ $success = true;
145
+ break;
146
  }
147
+ }
148
+
149
+ if( $success == false )
150
+ {
151
+ if( empty($StatsCached['retry_count']) )
152
+ $StatsCached['retry_count'] = 1;
153
+ else if( $StatsCached['retry_count'] < 24 )
154
+ $StatsCached['retry_count']++;
155
+
156
+ if( $StatsCached['retry_count'] > 12 ) // After 36 hours, if we keep failing to authenticate then lets clear the data and display the authentication notice.
157
  {
158
+ $content = '';
 
 
 
 
 
 
 
 
 
 
159
  }
160
+ // Update the updated flag so it will not try again for 3 hours...
161
+ update_option('powerpress_stats', array('updated'=>time(), 'content'=>$content, 'retry_count'=>$StatsCached['retry_count'] ) );
162
+ }
163
  }
164
 
165
  if( !$UserPass )
powerpressadmin-jquery.php CHANGED
@@ -174,9 +174,16 @@ if( !isset($Settings['blubrry_auth']) )
174
  $Msg = false;
175
  if( $DeleteFile )
176
  {
177
- $api_url = sprintf('%s/media/%s/%s?format=json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'], $DeleteFile );
178
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
179
- $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth'], array(), 10, 'DELETE');
 
 
 
 
 
 
 
180
  $results = powerpress_json_decode($json_data);
181
 
182
  if( isset($results['text']) )
@@ -186,10 +193,18 @@ if( !isset($Settings['blubrry_auth']) )
186
  else
187
  $Msg = __('An unknown error occurred deleting media file.', 'powerpress');
188
  }
189
-
190
- $api_url = sprintf('%s/media/%s/index.json?quota=true&published=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
191
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
192
- $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
 
 
 
 
 
 
 
 
193
  $results = powerpress_json_decode($json_data);
194
 
195
  $FeedSlug = $_GET['podcast-feed'];
@@ -399,10 +414,17 @@ function DeleteMedia(File)
399
 
400
  // Anytime we change the password we need to test it...
401
  $auth = base64_encode( $SaveSettings['blubrry_username'] . ':' . $Password );
402
- $api_url = sprintf('%s/service/index.json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/') );
 
 
 
 
 
 
 
 
 
403
 
404
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
405
- $json_data = powerpress_remote_fopen($api_url, $auth);
406
  if( $json_data )
407
  {
408
  $results = powerpress_json_decode($json_data);
@@ -652,9 +674,17 @@ while( list($value,$desc) = each($Programs) )
652
 
653
  if( $Error == false )
654
  {
655
- $api_url = sprintf('%s/media/%s/upload_session.json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
656
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
657
- $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
 
 
 
 
 
 
 
 
658
 
659
  $results = powerpress_json_decode($json_data);
660
 
174
  $Msg = false;
175
  if( $DeleteFile )
176
  {
177
+ $json_data = false;
178
+ $api_url_array = powerpress_get_api_array();
179
+ while( list($index,$api_url) = each($api_url_array) )
180
+ {
181
+ $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'], $DeleteFile );
182
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
183
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE');
184
+ if( $json_data != false )
185
+ break;
186
+ }
187
  $results = powerpress_json_decode($json_data);
188
 
189
  if( isset($results['text']) )
193
  else
194
  $Msg = __('An unknown error occurred deleting media file.', 'powerpress');
195
  }
196
+
197
+ $json_data = false;
198
+ $api_url_array = powerpress_get_api_array();
199
+ while( list($index,$api_url) = each($api_url_array) )
200
+ {
201
+ $req_url = sprintf('%s/media/%s/index.json?quota=true&published=true', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'] );
202
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
203
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
204
+ if( $json_data != false )
205
+ break;
206
+ }
207
+
208
  $results = powerpress_json_decode($json_data);
209
 
210
  $FeedSlug = $_GET['podcast-feed'];
414
 
415
  // Anytime we change the password we need to test it...
416
  $auth = base64_encode( $SaveSettings['blubrry_username'] . ':' . $Password );
417
+ $json_data = false;
418
+ $api_url_array = powerpress_get_api_array();
419
+ while( list($index,$api_url) = each($api_url_array) )
420
+ {
421
+ $req_url = sprintf('%s/service/index.json', rtrim($api_url, '/') );
422
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
423
+ $json_data = powerpress_remote_fopen($req_url, $auth);
424
+ if( $json_data != false )
425
+ break;
426
+ }
427
 
 
 
428
  if( $json_data )
429
  {
430
  $results = powerpress_json_decode($json_data);
674
 
675
  if( $Error == false )
676
  {
677
+ $json_data = false;
678
+ $api_url_array = powerpress_get_api_array();
679
+ while( list($index,$api_url) = each($api_url_array) )
680
+ {
681
+ $req_url = sprintf('%s/media/%s/upload_session.json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'] );
682
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
683
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
684
+ if( $json_data != false )
685
+ break;
686
+ }
687
+
688
 
689
  $results = powerpress_json_decode($json_data);
690
 
powerpressadmin.php CHANGED
@@ -547,10 +547,17 @@ function powerpress_admin_init()
547
  $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
548
  if( !empty($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] !== 'false' )
549
  {
 
 
 
 
 
 
 
 
 
 
550
  // Lets try to cache the image onto Blubrry's Server...
551
- $api_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
552
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
553
- $json_data = powerpress_remote_fopen($api_url, $GeneralSettingsTemp['blubrry_auth']);
554
  $results = powerpress_json_decode($json_data);
555
 
556
  if( is_array($results) && !isset($results['error']) )
@@ -3011,9 +3018,17 @@ function powerpress_process_hosting($post_ID, $post_title)
3011
  {
3012
  // Extend the max execution time here
3013
  set_time_limit(60*20); // give it 20 minutes just in case
3014
- $api_url = sprintf('%s/media/%s/%s?format=json&publish=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($EnclosureURL) );
3015
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3016
- $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth'], array(), 60*30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
 
 
 
 
 
 
 
 
3017
  $results = powerpress_json_decode($json_data);
3018
 
3019
  if( is_array($results) && !isset($results['error']) )
@@ -3448,10 +3463,16 @@ function powerpress_write_tags($file, $post_title)
3448
  }
3449
 
3450
  // Get meta info via API
3451
- $api_url = sprintf('%s/media/%s/%s?format=json&id3=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
3452
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
 
 
 
 
 
 
 
3453
 
3454
- $content = powerpress_remote_fopen($api_url, $Settings['blubrry_auth'], $PostArgs );
3455
  if( $content )
3456
  {
3457
  $Results = powerpress_json_decode($content);
@@ -3465,10 +3486,17 @@ function powerpress_write_tags($file, $post_title)
3465
  function powerpress_get_media_info($file)
3466
  {
3467
  $Settings = get_option('powerpress_general');
 
 
 
 
 
 
 
 
 
 
3468
 
3469
- $api_url = sprintf('%s/media/%s/%s?format=json&info=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
3470
- $api_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3471
- $content = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
3472
  if( $content )
3473
  {
3474
  $Results = powerpress_json_decode($content);
547
  $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
548
  if( !empty($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] !== 'false' )
549
  {
550
+ $json_data = false;
551
+ $api_url_array = powerpress_get_api_array();
552
+ while( list($index,$api_url) = each($api_url_array) )
553
+ {
554
+ $req_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim($api_url, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
555
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
556
+ $json_data = powerpress_remote_fopen($req_url, $GeneralSettingsTemp['blubrry_auth']);
557
+ if( $json_data != false )
558
+ break;
559
+ }
560
  // Lets try to cache the image onto Blubrry's Server...
 
 
 
561
  $results = powerpress_json_decode($json_data);
562
 
563
  if( is_array($results) && !isset($results['error']) )
3018
  {
3019
  // Extend the max execution time here
3020
  set_time_limit(60*20); // give it 20 minutes just in case
3021
+ $json_data = false;
3022
+ $api_url_array = powerpress_get_api_array();
3023
+ while( list($index,$api_url) = each($api_url_array) )
3024
+ {
3025
+ $req_url = sprintf('%s/media/%s/%s?format=json&publish=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($EnclosureURL) );
3026
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3027
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 60*30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
3028
+ if( $json_data != false )
3029
+ break;
3030
+ }
3031
+
3032
  $results = powerpress_json_decode($json_data);
3033
 
3034
  if( is_array($results) && !isset($results['error']) )
3463
  }
3464
 
3465
  // Get meta info via API
3466
+ $api_url_array = powerpress_get_api_array();
3467
+ while( list($index,$api_url) = each($api_url_array) )
3468
+ {
3469
+ $req_url = sprintf('%s/media/%s/%s?format=json&id3=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
3470
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3471
+ $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $PostArgs );
3472
+ if( $content != false )
3473
+ break;
3474
+ }
3475
 
 
3476
  if( $content )
3477
  {
3478
  $Results = powerpress_json_decode($content);
3486
  function powerpress_get_media_info($file)
3487
  {
3488
  $Settings = get_option('powerpress_general');
3489
+ $content = false;
3490
+ $api_url_array = powerpress_get_api_array();
3491
+ while( list($index,$api_url) = each($api_url_array) )
3492
+ {
3493
+ $req_url = sprintf('%s/media/%s/%s?format=json&info=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
3494
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3495
+ $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
3496
+ if( $content != false )
3497
+ break;
3498
+ }
3499
 
 
 
 
3500
  if( $content )
3501
  {
3502
  $Results = powerpress_json_decode($content);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: amandato, blubrry
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.8.1
6
- Stable tag: 5.0.4
7
  Donate link: http://create.blubrry.com/
8
  License: GPLv2 or later
9
 
@@ -174,6 +174,10 @@ To install Blubrry PowerPress manually, follow these steps:
174
  * Translation support will change in PowerPress 6.0+. Translations will be packaged in a separate plugin made available on WordPress.org. This will allow us to release translations separately and more often.
175
  * We are looking for beta testers! If you would like to beta test future versions of PowerPress, please [contact us](http://www.blubrry.com/contact.php) with your name and email.
176
 
 
 
 
 
177
 
178
  = 5.0.4 =
179
  * Released on 1/30/2014
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.8.1
6
+ Stable tag: 5.0.5
7
  Donate link: http://create.blubrry.com/
8
  License: GPLv2 or later
9
 
174
  * Translation support will change in PowerPress 6.0+. Translations will be packaged in a separate plugin made available on WordPress.org. This will allow us to release translations separately and more often.
175
  * We are looking for beta testers! If you would like to beta test future versions of PowerPress, please [contact us](http://www.blubrry.com/contact.php) with your name and email.
176
 
177
+ = 5.0.5 =
178
+ * Released on 3/2/2014
179
+ * Added logic for Blubrry Services to use alternative API servers to address random issues with session errors.
180
+
181
 
182
  = 5.0.4 =
183
  * Released on 1/30/2014