PowerPress Podcasting plugin by Blubrry - Version 0.9.10

Version Description

  • Released on 9/21/2009
  • Fixed code that detects media information when encountering redirects. Bug only affected users who did not have cURL configured in PHP.
  • Updated code for obtaining the uploads directory.
  • Added new Diagnostics page, diagnostics test checks if blog can obtain media information from media URLs, if you can ping iTunes, if you can upload podcast artwork and system information. Option also included to email the results to a specific address.
  • New Diagnostics page accessible via PowerPress > Tools > Diagnostics.
  • When 'PodPress Episodes' setting enabled, we now process downloads with podpress_trac in the URL. This fixes issue for some users who have old podpress media links in their blog posts after PodPress is disabled.
  • When 'PodPress Episodes' setting enabled, we now insert a player for the PodPress [display_podcast] shortcode.
  • To eliminate confusion, the Mp3 Tags settings page does not appear unless you've configured Blubrry Services with hosting.
  • New define added POWERPRESS_DO_ENCLOSE_FIX, when defined true in the wp-config.php, PowerPress will add the Media URL to your podcast episodes as a comment in your post content to prevent WordPress do_enclose() function from deleting them later. Learn more about bug here: http://core.trac.wordpress.org/ticket/10511
  • Changed language from "Pinging iTunes" to "Update iTunes Listing" to clear up confusion what the feature does.
  • Shortocde [powerpress] now includes download and play in new window links.
  • Simplified logic for pulling PodPress stored episode data.
  • Updated some grammar and setting labels so they are easier to understand.
  • Fixed bug with the "Use blog post author's name for individual episodes setting".
  • Added Sample Rate and Channel Mode warnings, a warning is now printed if sample rate is not 22Khz or 44Khz and Channel mode is not stereo or joint stereo.
Download this release

Release Info

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

Code changes from version 0.9.9 to 0.9.10

mp3info.class.php CHANGED
@@ -12,6 +12,7 @@
12
  var $m_RedirectLimit = 12; // Number of times to do the 302 redirect
13
  var $m_UserAgent = 'Blubrry PowerPress/1.0';
14
  var $m_error = '';
 
15
  var $m_ContentLength = false;
16
  var $m_RedirectCount = 0;
17
 
@@ -61,6 +62,16 @@
61
  $this->m_error = $msg;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
64
  /*
65
  Get the length in bytes of the file to download.
66
  */
@@ -94,7 +105,7 @@
94
  // The following code relies on fopen_url capability.
95
  if( $RedirectCount > $this->m_RedirectLimit )
96
  {
97
- $this->SetError( 'Download exceeded redirect limit of '.$this->m_RedirectLimit .'.' );
98
  return false;
99
  }
100
 
@@ -102,6 +113,14 @@
102
  $this->m_RedirectCount = $RedirectCount;
103
 
104
  $urlParts = parse_url($url);
 
 
 
 
 
 
 
 
105
  if( !isset( $urlParts['path']) )
106
  $urlParts['path'] = '/';
107
  if( !isset( $urlParts['port']) )
@@ -124,6 +143,7 @@
124
  $ContentLength = false;
125
  $ContentType = false;
126
  $ReturnCode = 0;
 
127
  // Loop through the headers
128
  while( !feof($fp) )
129
  {
@@ -133,25 +153,27 @@
133
  if ($line == "\r\n")
134
  break; // Okay we're ending the headers, now onto the content
135
 
 
136
  $line = rtrim($line); // Clean out the new line characters
137
 
138
  list($key, $value) = explode(':', $line, 2);
139
  $key = trim($key);
140
  $value = trim($value);
141
 
142
- if( preg_match('/^HTTPS?\/\d\.\d (\d{3})(.*)/i', $line, $matches) )
 
 
 
 
143
  {
144
  $ReturnCode = $matches[1];
145
- if( $ReturnCode < 200 || $ReturnCode > 250 )
146
  {
 
147
  $this->SetError('HTTP '.$ReturnCode.$matches[2]);
148
  return false;
149
  }
150
  }
151
- else if( stristr($line, '301 Moved Permanently') || stristr($line, '302 Found') || stristr($line, '307 Temporary Redirect') )
152
- {
153
- $Redirect = true; // We are dealing with a redirect, lets handle it
154
- }
155
  else
156
  {
157
  switch( strtolower($key) )
@@ -215,8 +237,19 @@
215
  /*
216
  Alternative method (curl) for downloading portion of a media file
217
  */
218
- function DownloadCurl($url)
219
  {
 
 
 
 
 
 
 
 
 
 
 
220
  $curl = curl_init();
221
  // First, get the content-length...
222
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
@@ -227,15 +260,22 @@
227
  curl_setopt($curl, CURLOPT_NOBODY, true );
228
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
229
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
 
230
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
231
- curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
 
 
 
 
 
 
232
  $Headers = curl_exec($curl);
233
-
234
  $ContentLength = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
235
  $HttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
236
  $ContentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
237
  $ErrorMsg = curl_error($curl);
238
- $this->m_RedirectCount = curl_getinfo($curl, CURLINFO_REDIRECT_COUNT);
 
239
 
240
  if( $HttpCode < 200 || $HttpCode > 250 )
241
  {
@@ -244,7 +284,21 @@
244
  case 301:
245
  case 302:
246
  case 307: {
247
- $this->SetError( 'Download exceeded redirect limit of '.$this->m_RedirectLimit .'.' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }; break;
249
  default: {
250
  $this->SetError( curl_error($curl) );
@@ -280,8 +334,15 @@
280
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
281
  curl_setopt($curl, CURLOPT_NOBODY, false );
282
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
 
283
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
284
- curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
 
 
 
 
 
 
285
  curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
286
  curl_setopt($curl, CURLOPT_HTTPHEADER,array('Range: bytes=0-'.($this->m_DownloadBytesLimit - 1) ));
287
  //curl_setopt($curl, CURLINFO_HEADER_OUT, true); // For debugging
@@ -350,7 +411,7 @@
350
  if( $FileInfo )
351
  {
352
  // Remove extra data that is not necessary for us to return...
353
- unset($FileInfo['mpeg']);
354
  unset($FileInfo['audio']);
355
  if( isset($FileInfo['id3v2']) )
356
  unset($FileInfo['id3v2']);
@@ -358,6 +419,23 @@
358
  unset($FileInfo['id3v1']);
359
 
360
  $FileInfo['playtime_seconds'] = round($FileInfo['playtime_seconds']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  return $FileInfo;
362
  }
363
 
12
  var $m_RedirectLimit = 12; // Number of times to do the 302 redirect
13
  var $m_UserAgent = 'Blubrry PowerPress/1.0';
14
  var $m_error = '';
15
+ var $m_warnings = array();
16
  var $m_ContentLength = false;
17
  var $m_RedirectCount = 0;
18
 
62
  $this->m_error = $msg;
63
  }
64
 
65
+ function GetWarnings()
66
+ {
67
+ return $this->m_warnings;
68
+ }
69
+
70
+ function AddWarning($msg)
71
+ {
72
+ $this->m_warnings[] = $msg;
73
+ }
74
+
75
  /*
76
  Get the length in bytes of the file to download.
77
  */
105
  // The following code relies on fopen_url capability.
106
  if( $RedirectCount > $this->m_RedirectLimit )
107
  {
108
+ $this->SetError( 'Download exceeded redirect limit of '.$this->m_RedirectLimit .' (fopen).' );
109
  return false;
110
  }
111
 
113
  $this->m_RedirectCount = $RedirectCount;
114
 
115
  $urlParts = parse_url($url);
116
+ if( !isset( $urlParts['host']) )
117
+ {
118
+ if( empty($url) )
119
+ $this->SetError( 'Unable to obtain host name from URL.' );
120
+ else
121
+ $this->SetError( 'Unable to obtain host name from the URL: '.$url );
122
+ return false;
123
+ }
124
  if( !isset( $urlParts['path']) )
125
  $urlParts['path'] = '/';
126
  if( !isset( $urlParts['port']) )
143
  $ContentLength = false;
144
  $ContentType = false;
145
  $ReturnCode = 0;
146
+ $headers = '';
147
  // Loop through the headers
148
  while( !feof($fp) )
149
  {
153
  if ($line == "\r\n")
154
  break; // Okay we're ending the headers, now onto the content
155
 
156
+ $headers .= $line;
157
  $line = rtrim($line); // Clean out the new line characters
158
 
159
  list($key, $value) = explode(':', $line, 2);
160
  $key = trim($key);
161
  $value = trim($value);
162
 
163
+ if( stristr($line, '301 Moved Permanently') || stristr($line, '302 Found') || stristr($line, '307 Temporary Redirect') )
164
+ {
165
+ $Redirect = true; // We are dealing with a redirect, lets handle it
166
+ }
167
+ else if( preg_match('/^HTTPS?\/\d\.\d (\d{3})(.*)/i', $line, $matches) )
168
  {
169
  $ReturnCode = $matches[1];
170
+ if( $ReturnCode < 200 || $ReturnCode > 206 )
171
  {
172
+ fclose($fp);
173
  $this->SetError('HTTP '.$ReturnCode.$matches[2]);
174
  return false;
175
  }
176
  }
 
 
 
 
177
  else
178
  {
179
  switch( strtolower($key) )
237
  /*
238
  Alternative method (curl) for downloading portion of a media file
239
  */
240
+ function DownloadCurl($url, $RedirectCount = 0)
241
  {
242
+ // In case we are dealing with a restriction with a server that does not allow cURL to do redirects itself...
243
+ if ( ini_get('safe_mode') || ini_get('open_basedir') )
244
+ {
245
+ if( $RedirectCount > $this->m_RedirectLimit )
246
+ {
247
+ $this->SetError( 'Download exceeded redirect limit of '.$this->m_RedirectLimit .' (cURL in safe mode).' );
248
+ return false;
249
+ }
250
+ $this->m_RedirectCount = $RedirectCount;
251
+ }
252
+
253
  $curl = curl_init();
254
  // First, get the content-length...
255
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
260
  curl_setopt($curl, CURLOPT_NOBODY, true );
261
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
262
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
263
+ {
264
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
265
+ curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
266
+ }
267
+ else
268
+ {
269
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
270
+ curl_setopt($curl, CURLOPT_MAXREDIRS, 0 ); // We will attempt to handle redirects ourself
271
+ }
272
  $Headers = curl_exec($curl);
 
273
  $ContentLength = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
274
  $HttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
275
  $ContentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
276
  $ErrorMsg = curl_error($curl);
277
+ if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
278
+ $this->m_RedirectCount = curl_getinfo($curl, CURLINFO_REDIRECT_COUNT);
279
 
280
  if( $HttpCode < 200 || $HttpCode > 250 )
281
  {
284
  case 301:
285
  case 302:
286
  case 307: {
287
+ if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
288
+ {
289
+ $this->SetError( 'Download exceeded redirect limit of '.$this->m_RedirectLimit .' (cURL).' );
290
+ }
291
+ else
292
+ {
293
+ $redirect_url = false;
294
+ if( preg_match('/^location:(.*)$/im', $Headers, $matches) )
295
+ $redirect_url = trim($matches[1]);
296
+
297
+ if( $redirect_url )
298
+ return $this->DownloadCurl($redirect_url, $RedirectCount +1);
299
+ else
300
+ $this->SetError( sprintf(__('Unable to obtain HTTP %d redirect URL.'), $HttpCode) );
301
+ }
302
  }; break;
303
  default: {
304
  $this->SetError( curl_error($curl) );
334
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
335
  curl_setopt($curl, CURLOPT_NOBODY, false );
336
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
337
+ {
338
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
339
+ curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
340
+ }
341
+ else
342
+ {
343
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
344
+ curl_setopt($curl, CURLOPT_MAXREDIRS, 0 );
345
+ }
346
  curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
347
  curl_setopt($curl, CURLOPT_HTTPHEADER,array('Range: bytes=0-'.($this->m_DownloadBytesLimit - 1) ));
348
  //curl_setopt($curl, CURLINFO_HEADER_OUT, true); // For debugging
411
  if( $FileInfo )
412
  {
413
  // Remove extra data that is not necessary for us to return...
414
+ //unset($FileInfo['mpeg']);
415
  unset($FileInfo['audio']);
416
  if( isset($FileInfo['id3v2']) )
417
  unset($FileInfo['id3v2']);
419
  unset($FileInfo['id3v1']);
420
 
421
  $FileInfo['playtime_seconds'] = round($FileInfo['playtime_seconds']);
422
+
423
+ if( isset($FileInfo['mpeg']['audio']) && $FileInfo['mpeg']['audio'] )
424
+ {
425
+ $Audio = $FileInfo['mpeg']['audio'];
426
+ if( $Audio['sample_rate'] != 22050 && $Audio['sample_rate'] != 44100 )
427
+ {
428
+ // Add warning here
429
+ $this->AddWarning( sprintf(__('Sample Rate %dKhz may cause playback issues, we recommend 22Khz or 44Khz for maximum player compatibility.'), $Audio['sample_rate']/1000 ) );
430
+ }
431
+
432
+ if( stristr($Audio['channelmode'], 'stereo' ) === false )
433
+ {
434
+ // Add warning here
435
+ $this->AddWarning( sprintf(__('Channel Mode \'%s\' may cause playback issues, we recommend \'joint stereo\' for maximum player compatibility.'), trim($Audio['channelmode']) ) );
436
+ }
437
+ }
438
+
439
  return $FileInfo;
440
  }
441
 
powerpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
- Version: 0.9.9
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', '0.9.9' );
37
 
38
  /////////////////////////////////////////////////////
39
  // The following define options should be placed in your
@@ -79,7 +79,10 @@ function powerpress_content($content)
79
  global $post, $g_powerpress_excerpt_post_id;
80
 
81
  if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
82
- return;
 
 
 
83
 
84
  if( is_feed() )
85
  return $content; // We don't want to do anything to the feed
@@ -168,57 +171,15 @@ function powerpress_content($content)
168
  {
169
  // Get the enclosure data
170
  $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
171
-
172
- //$enclosureData = get_post_meta($post->ID, 'enclosure', true);
173
- $duration = false;
174
- $EnclosureURL = '';
175
- $EnclosureSize = '';
176
- $EnclosureType = '';
177
 
178
- if( !$EpisodeData )
179
- {
180
- if( $GeneralSettings['process_podpress'] && $feed_slug == 'podcast' )
181
- {
182
- //$podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
183
- $podPressMedia = powerpress_get_post_meta($post->ID, 'podPressMedia');
184
-
185
- if( $podPressMedia )
186
- {
187
- if( !is_array($podPressMedia) )
188
- {
189
- // Sometimes the stored data gets messed up, we can fix it here:
190
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
191
- $podPressMedia = @unserialize($podPressMedia);
192
- }
193
-
194
- if( is_array($podPressMedia) && isset($podPressMedia[0]) && isset($podPressMedia[0]['URI']) )
195
- {
196
- $EnclosureURL = $podPressMedia[0]['URI'];
197
- if( isset($podPressMedia[0]['size']) )
198
- $EnclosureSize = $podPressMedia[0]['size'];
199
- $EnclosureType = '';
200
- }
201
- }
202
- if( !$EnclosureURL )
203
- continue;
204
-
205
- if( strpos($EnclosureURL, 'http://' ) !== 0 && strpos($EnclosureURL, 'https://' ) !== 0 )
206
- $EnclosureURL = rtrim($GeneralSettings['default_url'], '/') .'/'. $EnclosureURL;
207
-
208
- // Add redirects to Media URL
209
- $EnclosureURL = powerpress_add_redirect_url($EnclosureURL, $GeneralSettings);
210
- }
211
- }
212
- else
213
- {
214
- $EnclosureURL = $EpisodeData['url']; // Already includes redirect
215
- $EnclosureSize = $EpisodeData['size'];
216
- $EnclosureType = $EpisodeData['type'];
217
- $duration = $EpisodeData['duration']; // Always set, though may be set to false
218
- }
219
 
220
  // Just in case, if there's no URL lets escape!
221
- if( !$EnclosureURL )
222
  continue;
223
 
224
  // If the player is not already inserted in the body of the post using the shortcode...
@@ -230,58 +191,10 @@ function powerpress_content($content)
230
  if( $EpisodeData && isset($EpisodeData['embed']) )
231
  $new_content .= $EpisodeData['embed'];
232
  if( !isset($EpisodeData['no_player']) )
233
- $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EnclosureURL, 'p'), array('feed'=>$feed_slug, 'type'=>$EpisdoeData['type']) );
234
- }
235
- }
236
-
237
- // Build links for player
238
- $player_links = '';
239
- switch( $GeneralSettings['player_function'] )
240
- {
241
- case 1: // Play on page and new window
242
- case 3: // Play in new window only
243
- case 5: { // Play in page and new window
244
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_pinw('{$post->ID}-{$feed_slug}');\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
245
- }; break;
246
- case 2:
247
- case 4:{ // Play in/on page only
248
- }; break;
249
- }//end switch
250
-
251
- if( $GeneralSettings['podcast_link'] == 1 )
252
- {
253
- if( $player_links )
254
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
255
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a>".PHP_EOL;
256
- }
257
- else if( $GeneralSettings['podcast_link'] == 2 )
258
- {
259
- if( $player_links )
260
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
261
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).") ".PHP_EOL;
262
- }
263
- else if( $GeneralSettings['podcast_link'] == 3 )
264
- {
265
- if( $duration == false )
266
- $duration = get_post_meta($post->ID, 'itunes:duration', true);
267
- if( $player_links )
268
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
269
- if( $duration && ltrim($duration, '0:') != '' )
270
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (". htmlspecialchars(POWERPRESS_DURATION_TEXT) .": " . powerpress_readable_duration($duration) ." &#8212; ".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
271
- else
272
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
273
- }
274
-
275
- if( $player_links && empty($GeneralSettings['disable_player'][$feed_slug]) )
276
- {
277
- if( count($GeneralSettings['custom_feeds']) > 1 && $feed_slug != 'podcast' )
278
- {
279
- $new_content .= '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .' ('. htmlspecialchars($feed_slug) .'): '. $player_links . '</p>'.PHP_EOL;
280
- }
281
- else
282
- {
283
- $new_content .= '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .': '. $player_links . '</p>'.PHP_EOL;
284
  }
 
 
285
  }
286
  }
287
 
@@ -306,8 +219,6 @@ add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORI
306
 
307
  function powerpress_header()
308
  {
309
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
310
- return;
311
  // PowerPress settings:
312
  $Powerpress = get_option('powerpress_general');
313
 
@@ -577,7 +488,6 @@ add_action('rss2_head', 'powerpress_rss2_head');
577
  function powerpress_rss2_item()
578
  {
579
  global $post, $powerpress_feed;
580
- $duration = false;
581
 
582
  // are we processing a feed that powerpress should handle
583
  if( !powerpress_is_podcast_feed() )
@@ -593,114 +503,59 @@ function powerpress_rss2_item()
593
  $custom_enclosure = false;
594
  if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() )
595
  {
596
- $enclosureData = get_post_meta($post->ID, '_'. get_query_var('feed') .':enclosure', true);
597
  $custom_enclosure = true;
598
  }
599
  else
600
  {
601
- $enclosureData = get_post_meta($post->ID, 'enclosure', true);
602
- }
603
-
604
- if( !$enclosureData )
605
- {
606
- $EnclosureURL = '';
607
- if( $powerpress_feed['process_podpress'] )
608
  {
609
- //$podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
610
- $podPressMedia = powerpress_get_post_meta($post->ID, 'podPressMedia');
611
-
612
- if( !is_array($podPressMedia) )
613
- {
614
- // Sometimes the stored data gets messed up, we can fix it here:
615
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
616
- $podPressMedia = @unserialize($podPressMedia);
617
- }
618
-
619
- if( $podPressMedia && isset($podPressMedia[0]) && isset($podPressMedia[0]['URI']) )
620
- {
621
- $EnclosureURL = $podPressMedia[0]['URI'];
622
- if( strpos($EnclosureURL, 'http://' ) !== 0 && strpos($EnclosureURL, 'https://' ) !== 0 )
623
- $EnclosureURL = $powerpress_feed['default_url'] . $EnclosureURL;
624
- if( isset($podPressMedia[0]['size']) )
625
- $EnclosureSize = $podPressMedia[0]['size'];
626
- if( isset($podPressMedia[0]['duration']) )
627
- $duration = $podPressMedia[0]['duration'];
628
- $EnclosureType = false;
629
- $UrlParts = parse_url($EnclosureURL);
630
- if( $UrlParts['path'] )
631
- {
632
- // using functions that already exist in Wordpress when possible:
633
- $ContentType = powerpress_get_contenttype($UrlParts['path']);
634
- if( $ContentType )
635
- $EnclosureType = $ContentType;
636
- }
637
-
638
- if( $EnclosureType && $EnclosureSize && $EnclosureURL )
639
- echo "\t\t".'<enclosure url="' . trim(htmlspecialchars($EnclosureURL)) . '" length="'. $EnclosureSize .'" type="'. $EnclosureType .'" />'.PHP_EOL;
640
- else
641
- return;
642
- }
643
- else
644
- return;
645
  }
646
- else
647
- return;
648
  }
649
 
650
- // Split the episode information into parts...
651
- list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = explode("\n", $enclosureData, 4);
652
- $EnclosureURL = trim($EnclosureURL);
653
- $EnclosureType = trim($EnclosureType);
654
- $EnclosureSize = trim($EnclosureSize);
 
655
 
656
- // Check that the content type is a valid one...
657
- if( strstr($EnclosureType, '/') == false )
658
- $EnclosureType = powerpress_get_contenttype($EnclosureURL);
659
-
660
- $author = (isset($powerpress_feed['itunes_author_post'])?get_the_author() :$powerpress_feed['itunes_talent_name']);
661
  $explicit = $powerpress_feed['explicit'];
662
  $summary = false;
663
  $subtitle = false;
664
  $keywords = false;
665
  $block = $powerpress_feed['block'];
666
 
667
- if( $Serialized )
668
  {
669
- $EpisodeData = unserialize($Serialized);
670
- if( isset( $EpisodeData['duration'] ) )
671
- $duration = $EpisodeData['duration'];
672
- if( $powerpress_feed['itunes_custom'] )
 
 
 
673
  {
674
- if( isset( $EpisodeData['summary'] ) )
675
- $summary = $EpisodeData['summary'];
676
- if( isset( $EpisodeData['subtitle'] ) )
677
- $subtitle = $EpisodeData['subtitle'];
678
- if( isset( $EpisodeData['keywords'] ) )
679
- $keywords = $EpisodeData['keywords'];
680
- if( isset( $EpisodeData['explicit'] ) )
681
- {
682
- $explicit_array = array("no", "yes", "clean");
683
- $explicit = $explicit_array[$EpisodeData['explicit']];
684
- }
685
-
686
- // Code for future use:
687
- if( isset( $EpisodeData['author'] ) )
688
- $author = $EpisodeData['author'];
689
- if( isset( $EpisodeData['block'] ) )
690
- $block = $EpisodeData['block'];
691
  }
 
 
 
 
 
 
692
  }
693
-
694
- if( !$duration && !$custom_enclosure )
695
- $duration = get_post_meta($post->ID, 'itunes:duration', true);
696
 
697
  if( $custom_enclosure ) // We need to add the enclosure tag here...
698
  {
699
- $ModifiedURL = powerpress_add_redirect_url($EnclosureURL);
700
  echo "\t". sprintf('<enclosure url="%s" length="%d" type="%s" />%s',
701
- $ModifiedURL,
702
- $EnclosureSize,
703
- $EnclosureType,
704
  PHP_EOL);
705
  }
706
 
@@ -723,13 +578,18 @@ function powerpress_rss2_item()
723
  if( $keywords )
724
  echo "\t\t<itunes:keywords>" . powerpress_format_itunes_value($keywords, 'keywords') . '</itunes:keywords>'.PHP_EOL;
725
 
726
- // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
727
- $content_no_html = $post->post_content;
728
- $content_no_html = strip_shortcodes( $content_no_html );
729
- $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
730
- $content_no_html = strip_tags($content_no_html);
731
-
732
- $excerpt_no_html = strip_tags($post->post_excerpt);
 
 
 
 
 
733
 
734
  if( $subtitle )
735
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
@@ -738,7 +598,6 @@ function powerpress_rss2_item()
738
  else
739
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($content_no_html, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
740
 
741
-
742
  if( $summary )
743
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
744
  else if( $powerpress_feed['enhance_itunes_summary'] )
@@ -750,12 +609,14 @@ function powerpress_rss2_item()
750
 
751
  if( $author )
752
  echo "\t\t<itunes:author>" . wp_specialchars($author) . '</itunes:author>'.PHP_EOL;
 
 
753
 
754
  if( $explicit )
755
  echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
756
 
757
- if( $duration && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', ltrim($duration, '0:') ) ) // Include duration if it is valid
758
- echo "\t\t<itunes:duration>" . ltrim($duration, '0:') . '</itunes:duration>'.PHP_EOL;
759
 
760
  if( $block && $block == 'yes' )
761
  echo "\t\t<itunes:block>yes</itunes:block>\n";
@@ -915,18 +776,26 @@ add_action('template_redirect', 'powerpress_template_redirect', 0);
915
 
916
  function powerpress_init()
917
  {
918
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
919
- return false; // Another podcasting plugin is enabled...
920
 
921
  // Translation support loaded:
922
- load_plugin_textdomain('powerpress', false, dirname(plugin_basename(__FILE__)));
923
-
924
  if( isset($_GET['powerpress_pinw']) )
925
- powerpress_do_pinw($_GET['powerpress_pinw']);
926
 
927
- add_feed('podcast', 'powerpress_do_podcast_feed');
 
928
 
929
- $GeneralSettings = get_option('powerpress_general');
 
 
 
 
 
 
 
 
930
  if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
931
  {
932
  while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
@@ -1034,11 +903,13 @@ function powerpress_load_general_feed_settings()
1034
  $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1035
  if( $Feed['feed_redirect_url'] != '' )
1036
  $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
 
 
1037
  if( $Feed['rss_language'] != '' )
1038
  $powerpress_feed['rss_language'] = $Feed['rss_language'];
1039
  return;
1040
  }
1041
-
1042
  // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
1043
  switch( $FeedSettingsBasic['apply_to'] )
1044
  {
@@ -1080,6 +951,8 @@ function powerpress_load_general_feed_settings()
1080
  else
1081
  $powerpress_feed['enhance_itunes_summary'] = @$FeedSettingsBasic['enhance_itunes_summary'];
1082
  $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
 
 
1083
  $powerpress_feed['rss_language'] = ''; // Cannot set the language setting in simple mode
1084
  }; break;
1085
  // All other cases we let fall through
@@ -1247,8 +1120,11 @@ function powerpress_player_filter($content, $media_url, $ExtraData = array() )
1247
  $parts = pathinfo($media_url);
1248
  // Hack to use the audio/mp3 content type to set extension to mp3, some folks use tinyurl.com to mp3 files which remove the file extension...
1249
  // This hack only covers mp3s.
1250
- if( isset($EpisdoeData['type']) && $EpisdoeData['type'] == 'audio/mpeg' && $parts['extension'] != 'mp3' )
1251
  $parts['extension'] = 'mp3';
 
 
 
1252
 
1253
  switch( strtolower($parts['extension']) )
1254
  {
@@ -1442,11 +1318,15 @@ function powerpress_shortcode_handler( $attributes, $content = null )
1442
  }
1443
  else if( $feed )
1444
  {
1445
- $EpisdoeData = powerpress_get_enclosure_data($post->ID, $feed);
1446
- if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1447
- $return = $EpisdoeData['embed'];
1448
- if( !isset($EpisdoeData['no_player']) )
1449
- $return = apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisdoeData['url'], 'p'), array('feed'=>$feed, 'image'=>$image, 'type'=>$EpisdoeData['type']) );
 
 
 
 
1450
  }
1451
  else
1452
  {
@@ -1459,12 +1339,18 @@ function powerpress_shortcode_handler( $attributes, $content = null )
1459
  if( isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) )
1460
  continue;
1461
 
1462
- $EpisdoeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
1463
- if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1464
- $return .= $EpisdoeData['embed'];
1465
-
1466
- if( !isset($EpisdoeData['no_player']) )
1467
- $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisdoeData['url'], 'p'), array('feed'=>$feed_slug, 'image'=>$image, 'type'=>$EpisdoeData['type']) );
 
 
 
 
 
 
1468
  }
1469
  }
1470
 
@@ -1478,6 +1364,36 @@ add_shortcode('powerpress', 'powerpress_shortcode_handler');
1478
  Helper functions:
1479
  */
1480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1481
  function the_powerpress_content()
1482
  {
1483
  echo get_the_powerpress_content();
@@ -1488,10 +1404,15 @@ function get_the_powerpress_content()
1488
  return powerpress_content('');
1489
  }
1490
 
1491
- function powerpress_do_pinw($pinw)
1492
  {
1493
  list($post_id, $feed_slug) = split('-', $pinw, 2);
1494
- $EpisdoeData = powerpress_get_enclosure_data($post_id, $feed_slug);
 
 
 
 
 
1495
 
1496
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
1497
  ?>
@@ -1508,17 +1429,17 @@ body { font-size: 13px; font-family: Arial, Helvetica, sans-serif; }
1508
  <div style="margin: 5px;">
1509
  <?php
1510
 
1511
- if( !$EpisdoeData )
1512
  {
1513
  echo '<p>Unable to retrieve media information.</p>';
1514
  }
1515
- else if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1516
  {
1517
- echo $EpisdoeData['embed'];
1518
  }
1519
- else // if( !isset($EpisdoeData['no_player']) ) // Even if there is no player set, if the play in new window option is enabled then it should play here...
1520
  {
1521
- echo apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisdoeData['url'], 'p'), array('feed'=>$feed_slug, 'autoplay'=>true, 'type'=>$EpisdoeData['type']) );
1522
  }
1523
 
1524
  ?>
@@ -2055,12 +1976,8 @@ function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast')
2055
  if( $Serialized )
2056
  {
2057
  $ExtraData = unserialize($Serialized);
2058
- if( isset($ExtraData['duration']) )
2059
- $Data['duration'] = $ExtraData['duration'];
2060
- if( isset($ExtraData['embed']) )
2061
- $Data['embed'] = $ExtraData['embed'];
2062
- if( isset($ExtraData['no_player']) )
2063
- $Data['no_player'] = 1;
2064
  }
2065
 
2066
  // Check that the content type is a valid one...
@@ -2069,6 +1986,123 @@ function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast')
2069
 
2070
  return $Data;
2071
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2072
  /*
2073
  End Helper Functions
2074
  */
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
+ Version: 0.9.10
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', '0.9.10' );
37
 
38
  /////////////////////////////////////////////////////
39
  // The following define options should be placed in your
79
  global $post, $g_powerpress_excerpt_post_id;
80
 
81
  if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
82
+ return $content;
83
+
84
+ if( defined('POWERPRESS_DO_ENCLOSE_FIX') )
85
+ $content = preg_replace('/\<!--.*added by PowerPress.*-->/im', '', $content );
86
 
87
  if( is_feed() )
88
  return $content; // We don't want to do anything to the feed
171
  {
172
  // Get the enclosure data
173
  $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
 
 
 
 
 
 
174
 
175
+ if( !$EpisodeData && $GeneralSettings['process_podpress'] && $feed_slug == 'podcast' )
176
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
177
+
178
+ if( !$EpisodeData || !$EpisodeData['url'] )
179
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
  // Just in case, if there's no URL lets escape!
182
+ if( !$EpisodeData['url'] )
183
  continue;
184
 
185
  // If the player is not already inserted in the body of the post using the shortcode...
191
  if( $EpisodeData && isset($EpisodeData['embed']) )
192
  $new_content .= $EpisodeData['embed'];
193
  if( !isset($EpisodeData['no_player']) )
194
+ $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('feed'=>$feed_slug, 'type'=>$EpisodeData['type']) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
196
+
197
+ $new_content .= powerpress_get_player_links($post->ID, $feed_slug, $EpisodeData);
198
  }
199
  }
200
 
219
 
220
  function powerpress_header()
221
  {
 
 
222
  // PowerPress settings:
223
  $Powerpress = get_option('powerpress_general');
224
 
488
  function powerpress_rss2_item()
489
  {
490
  global $post, $powerpress_feed;
 
491
 
492
  // are we processing a feed that powerpress should handle
493
  if( !powerpress_is_podcast_feed() )
503
  $custom_enclosure = false;
504
  if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() )
505
  {
506
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
507
  $custom_enclosure = true;
508
  }
509
  else
510
  {
511
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, 'podcast');
512
+ if( !$EpisodeData && isset($powerpress_feed['process_podpress']) && $powerpress_feed['process_podpress'] )
 
 
 
 
 
513
  {
514
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
515
+ $custom_enclosure = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
 
 
517
  }
518
 
519
+ if( !$EpisodeData || !$EpisodeData['url'] )
520
+ return;
521
+
522
+ $author = $powerpress_feed['itunes_talent_name'];
523
+ if( isset($powerpress_feed['itunes_author_post']) )
524
+ $author = get_the_author();
525
 
 
 
 
 
 
526
  $explicit = $powerpress_feed['explicit'];
527
  $summary = false;
528
  $subtitle = false;
529
  $keywords = false;
530
  $block = $powerpress_feed['block'];
531
 
532
+ if( $powerpress_feed['itunes_custom'] )
533
  {
534
+ if( isset( $EpisodeData['summary'] ) && strlen($EpisodeData['summary']) > 1 )
535
+ $summary = $EpisodeData['summary'];
536
+ if( isset( $EpisodeData['subtitle'] ) && strlen($EpisodeData['subtitle']) > 1 )
537
+ $subtitle = $EpisodeData['subtitle'];
538
+ if( isset( $EpisodeData['keywords'] ) && strlen($EpisodeData['keywords']) > 1 )
539
+ $keywords = $EpisodeData['keywords'];
540
+ if( isset( $EpisodeData['explicit'] ) && is_numeric($EpisodeData['explicit']) )
541
  {
542
+ $explicit_array = array("no", "yes", "clean");
543
+ $explicit = $explicit_array[$EpisodeData['explicit']];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  }
545
+
546
+ // Code for future use:
547
+ if( isset( $EpisodeData['author'] ) && strlen($EpisodeData['author']) > 1 )
548
+ $author = $EpisodeData['author'];
549
+ if( isset( $EpisodeData['block'] ) )
550
+ $block = $EpisodeData['block'];
551
  }
 
 
 
552
 
553
  if( $custom_enclosure ) // We need to add the enclosure tag here...
554
  {
 
555
  echo "\t". sprintf('<enclosure url="%s" length="%d" type="%s" />%s',
556
+ $EpisodeData['url'],
557
+ $EpisodeData['size'],
558
+ $EpisodeData['type'],
559
  PHP_EOL);
560
  }
561
 
578
  if( $keywords )
579
  echo "\t\t<itunes:keywords>" . powerpress_format_itunes_value($keywords, 'keywords') . '</itunes:keywords>'.PHP_EOL;
580
 
581
+ $excerpt_no_html = '';
582
+ $content_no_html = '';
583
+ if( !$subtitle || !$summary )
584
+ $excerpt_no_html = strip_tags($post->post_excerpt);
585
+ if( (!$subtitle && !$excerpt_no_html) || (!$summary && !$powerpress_feed['enhance_itunes_summary'] && !$excerpt_no_html ) )
586
+ {
587
+ // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
588
+ $content_no_html = $post->post_content;
589
+ $content_no_html = strip_shortcodes( $content_no_html );
590
+ $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
591
+ $content_no_html = strip_tags($content_no_html);
592
+ }
593
 
594
  if( $subtitle )
595
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
598
  else
599
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($content_no_html, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
600
 
 
601
  if( $summary )
602
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
603
  else if( $powerpress_feed['enhance_itunes_summary'] )
609
 
610
  if( $author )
611
  echo "\t\t<itunes:author>" . wp_specialchars($author) . '</itunes:author>'.PHP_EOL;
612
+ else
613
+ echo "\t\t<itunes:author>".'NO AUTHOR</itunes:author>'.PHP_EOL;
614
 
615
  if( $explicit )
616
  echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
617
 
618
+ if( $EpisodeData['duration'] && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', ltrim($EpisodeData['duration'], '0:') ) ) // Include duration if it is valid
619
+ echo "\t\t<itunes:duration>" . ltrim($EpisodeData['duration'], '0:') . '</itunes:duration>'.PHP_EOL;
620
 
621
  if( $block && $block == 'yes' )
622
  echo "\t\t<itunes:block>yes</itunes:block>\n";
776
 
777
  function powerpress_init()
778
  {
779
+ $GeneralSettings = get_option('powerpress_general');
 
780
 
781
  // Translation support loaded:
782
+ // load_plugin_textdomain('powerpress', false, dirname(plugin_basename(__FILE__)));
783
+
784
  if( isset($_GET['powerpress_pinw']) )
785
+ powerpress_do_pinw($_GET['powerpress_pinw'], @$GeneralSettings['process_podpress']);
786
 
787
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
788
+ return false; // Another podcasting plugin is enabled...
789
 
790
+ // If we are to process podpress data..
791
+ if( isset($GeneralSettings['process_podpress']) && $GeneralSettings['process_podpress'] )
792
+ {
793
+ powerpress_podpress_redirect_check();
794
+ add_shortcode('display_podcast', 'powerpress_shortcode_handler');
795
+ }
796
+
797
+ // Add the podcast feeds;
798
+ add_feed('podcast', 'powerpress_do_podcast_feed');
799
  if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
800
  {
801
  while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
903
  $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
904
  if( $Feed['feed_redirect_url'] != '' )
905
  $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
906
+ if( $Feed['itunes_author_post'] == true )
907
+ $powerpress_feed['itunes_author_post'] = true;
908
  if( $Feed['rss_language'] != '' )
909
  $powerpress_feed['rss_language'] = $Feed['rss_language'];
910
  return;
911
  }
912
+
913
  // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
914
  switch( $FeedSettingsBasic['apply_to'] )
915
  {
951
  else
952
  $powerpress_feed['enhance_itunes_summary'] = @$FeedSettingsBasic['enhance_itunes_summary'];
953
  $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
954
+ if( $FeedSettingsBasic['itunes_author_post'] == true )
955
+ $powerpress_feed['itunes_author_post'] = true;
956
  $powerpress_feed['rss_language'] = ''; // Cannot set the language setting in simple mode
957
  }; break;
958
  // All other cases we let fall through
1120
  $parts = pathinfo($media_url);
1121
  // Hack to use the audio/mp3 content type to set extension to mp3, some folks use tinyurl.com to mp3 files which remove the file extension...
1122
  // This hack only covers mp3s.
1123
+ if( isset($EpisodeData['type']) && $EpisodeData['type'] == 'audio/mpeg' && $parts['extension'] != 'mp3' )
1124
  $parts['extension'] = 'mp3';
1125
+
1126
+ if( !defined('POWERPRESS_PLAYER') )
1127
+ $Settings['player'] = 'default'; // Use the defaul player in case the POWERPRESS_PLAYER is not defined
1128
 
1129
  switch( strtolower($parts['extension']) )
1130
  {
1318
  }
1319
  else if( $feed )
1320
  {
1321
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed);
1322
+ if( isset($EpisodeData['embed']) && $EpisodeData['embed'] )
1323
+ $return = $EpisodeData['embed'];
1324
+
1325
+ if( !isset($EpisodeData['no_player']) )
1326
+ {
1327
+ $return = apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('feed'=>$feed, 'image'=>$image, 'type'=>$EpisodeData['type']) );
1328
+ $return .= powerpress_get_player_links($post->ID, $feed, $EpisodeData );
1329
+ }
1330
  }
1331
  else
1332
  {
1339
  if( isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) )
1340
  continue;
1341
 
1342
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
1343
+ if( !$EpisodeData )
1344
+ continue;
1345
+
1346
+ if( isset($EpisodeData['embed']) && $EpisodeData['embed'] )
1347
+ $return .= $EpisodeData['embed'];
1348
+
1349
+ if( !isset($EpisodeData['no_player']) )
1350
+ {
1351
+ $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('feed'=>$feed_slug, 'image'=>$image, 'type'=>$EpisodeData['type']) );
1352
+ $return .= powerpress_get_player_links($post->ID, $feed_slug, $EpisodeData );
1353
+ }
1354
  }
1355
  }
1356
 
1364
  Helper functions:
1365
  */
1366
 
1367
+ function powerpress_podpress_redirect_check()
1368
+ {
1369
+ if( preg_match('/podpress_trac\/([^\/]+)\/([^\/]+)\/([^\/]+)\/(.*)$/', $_SERVER['REQUEST_URI'], $matches) )
1370
+ {
1371
+ $post_id = $matches[2];
1372
+ $mediaNum = $matches[3];
1373
+ //$filename = $matches[4];
1374
+ //$method = $matches[1];
1375
+
1376
+ if( is_numeric($post_id) && is_numeric($mediaNum))
1377
+ {
1378
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post_id, $mediaNum);
1379
+ if( $EpisodeData && isset($EpisodeData['url']) )
1380
+ {
1381
+ if( strpos($EpisodeData['url'], 'http://' ) !== 0 && strpos($EpisodeData['url'], 'https://' ) !== 0 )
1382
+ {
1383
+ die('Error occurred obtaining the URL for the requested media file.');
1384
+ exit;
1385
+ }
1386
+
1387
+ $EnclosureURL = str_replace(' ', '%20', $EpisodeData['url']);
1388
+ header('Location: '.$EnclosureURL, true, 302);
1389
+ header('Content-Length: 0');
1390
+ exit;
1391
+ }
1392
+ // Let the WordPress 404 page load as normal
1393
+ }
1394
+ }
1395
+ }
1396
+
1397
  function the_powerpress_content()
1398
  {
1399
  echo get_the_powerpress_content();
1404
  return powerpress_content('');
1405
  }
1406
 
1407
+ function powerpress_do_pinw($pinw, $process_podpress)
1408
  {
1409
  list($post_id, $feed_slug) = split('-', $pinw, 2);
1410
+ $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
1411
+
1412
+ if( $EpisodeData == false && $process_podpress && $feed_slug == 'podcast' )
1413
+ {
1414
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post_id);
1415
+ }
1416
 
1417
  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
1418
  ?>
1429
  <div style="margin: 5px;">
1430
  <?php
1431
 
1432
+ if( !$EpisodeData )
1433
  {
1434
  echo '<p>Unable to retrieve media information.</p>';
1435
  }
1436
+ else if( isset($EpisodeData['embed']) && $EpisodeData['embed'] )
1437
  {
1438
+ echo $EpisodeData['embed'];
1439
  }
1440
+ else // if( !isset($EpisodeData['no_player']) ) // Even if there is no player set, if the play in new window option is enabled then it should play here...
1441
  {
1442
+ echo apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('feed'=>$feed_slug, 'autoplay'=>true, 'type'=>$EpisodeData['type']) );
1443
  }
1444
 
1445
  ?>
1976
  if( $Serialized )
1977
  {
1978
  $ExtraData = unserialize($Serialized);
1979
+ while( list($key,$value) = each($ExtraData) )
1980
+ $Data[ $key ] = $value;
 
 
 
 
1981
  }
1982
 
1983
  // Check that the content type is a valid one...
1986
 
1987
  return $Data;
1988
  }
1989
+
1990
+ function powerpress_get_enclosure_data_podpress($post_id, $mediaNum = 0, $include_premium = false)
1991
+ {
1992
+ $podPressMedia = powerpress_get_post_meta($post_id, 'podPressMedia');
1993
+ if( $podPressMedia )
1994
+ {
1995
+
1996
+ if( !is_array($podPressMedia) )
1997
+ {
1998
+ // Sometimes the stored data gets messed up, we can fix it here:
1999
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
2000
+ $podPressMedia = @unserialize($podPressMedia);
2001
+ }
2002
+
2003
+
2004
+ if( is_array($podPressMedia) && isset($podPressMedia[$mediaNum]) && isset($podPressMedia[$mediaNum]['URI']) )
2005
+ {
2006
+ if( $include_premium == false && isset($podPressMedia[$mediaNum]['premium_only']) && ($podPressMedia[$mediaNum]['premium_only'] == 'on' || $podPressMedia[$mediaNum]['premium_only'] == true) )
2007
+ return false;
2008
+
2009
+ $Data = array();
2010
+ $Data['duration'] = 0;
2011
+ $Data['url'] = '';
2012
+ $Data['size'] = 0;
2013
+ $Data['type'] = '';
2014
+
2015
+ $Data['url'] = $podPressMedia[$mediaNum]['URI'];
2016
+ if( isset($podPressMedia[$mediaNum]['size']) )
2017
+ $Data['size'] = $podPressMedia[$mediaNum]['size'];
2018
+ if( isset($PodPressSettings[$mediaNum]['duration']) )
2019
+ $Data['duration'] = $podPressMedia[$mediaNum]['duration'];
2020
+
2021
+
2022
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
2023
+ {
2024
+ $PodPressSettings = get_option('podPress_config');
2025
+ if( $PodPressSettings && isset($PodPressSettings['mediaWebPath']) )
2026
+ $Data['url'] = rtrim($PodpressSettings['mediaWebPath'], '/') . '/' . ltrim($Data['url'], '/');
2027
+ unset($PodPressSettings);
2028
+ }
2029
+
2030
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
2031
+ {
2032
+ $Settings = get_option('powerpress_general');
2033
+ if( $Settings && isset($Settings['default_url']) )
2034
+ $Data['url'] = rtrim($Settings['default_url'], '/') . '/' . ltrim($Data['url'], '/');
2035
+ }
2036
+
2037
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
2038
+ return false;
2039
+
2040
+ $Data['type'] = powerpress_get_contenttype($Data['url']); // Detect the content type
2041
+ $Data['url'] = powerpress_add_redirect_url($Data['url']); // Add redirects to Media URL
2042
+ return $Data;
2043
+ }
2044
+ }
2045
+ return false;
2046
+ }
2047
+
2048
+ function powerpress_get_player_links($post_id, $feed_slug = 'podcast', $EpisodeData = false)
2049
+ {
2050
+ if( !$EpisodeData && $post_id )
2051
+ $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
2052
+
2053
+ if( !$EpisodeData )
2054
+ return '';
2055
+
2056
+ $GeneralSettings = get_option('powerpress_general');
2057
+
2058
+ // Build links for player
2059
+ $player_links = '';
2060
+ switch( $GeneralSettings['player_function'] )
2061
+ {
2062
+ case 1: // Play on page and new window
2063
+ case 3: // Play in new window only
2064
+ case 5: { // Play in page and new window
2065
+ if( $post_id )
2066
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_pinw('{$post_id}-{$feed_slug}');\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
2067
+ else
2068
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_pinw('{$post_id}-{$feed_slug}');\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
2069
+ }; break;
2070
+ case 2:
2071
+ case 4:{ // Play in/on page only
2072
+ }; break;
2073
+ }//end switch
2074
+
2075
+ if( $GeneralSettings['podcast_link'] == 1 )
2076
+ {
2077
+ if( $player_links )
2078
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
2079
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a>".PHP_EOL;
2080
+ }
2081
+ else if( $GeneralSettings['podcast_link'] == 2 )
2082
+ {
2083
+ if( $player_links )
2084
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
2085
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EpisodeData['size']).") ".PHP_EOL;
2086
+ }
2087
+ else if( $GeneralSettings['podcast_link'] == 3 )
2088
+ {
2089
+ if( $player_links )
2090
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
2091
+ if( $EpisodeData['duration'] && ltrim($EpisodeData['duration'], '0:') != '' )
2092
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (". htmlspecialchars(POWERPRESS_DURATION_TEXT) .": " . powerpress_readable_duration($EpisodeData['duration']) ." &#8212; ".powerpress_byte_size($EpisodeData['size']).")".PHP_EOL;
2093
+ else
2094
+ $player_links .= "<a href=\"{$EpisodeData['url']}\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EpisodeData['size']).")".PHP_EOL;
2095
+ }
2096
+
2097
+ if( $player_links )
2098
+ {
2099
+ if( $feed_slug != 'podcast' )
2100
+ return '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .' ('. htmlspecialchars($feed_slug) .'): '. $player_links . '</p>'.PHP_EOL;
2101
+ else
2102
+ return '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .': '. $player_links . '</p>'.PHP_EOL;
2103
+ }
2104
+ return '';
2105
+ }
2106
  /*
2107
  End Helper Functions
2108
  */
powerpressadmin-appearance.php CHANGED
@@ -105,7 +105,7 @@ while( list($value,$desc) = each($linkoptions) )
105
  </tr>
106
 
107
  <tr valign="top">
108
- <th scope="row" style="background-image: url(/wp-includes/images/smilies/icon_exclaim.gif); background-position: 10px 10px; background-repeat: no-repeat; ">
109
 
110
  <div style="margin-left: 24px;"><?php _e("Hybrid Themes"); ?></div></th>
111
  <td>
105
  </tr>
106
 
107
  <tr valign="top">
108
+ <th scope="row" style="background-image: url(../wp-includes/images/smilies/icon_exclaim.gif); background-position: 10px 10px; background-repeat: no-repeat; ">
109
 
110
  <div style="margin-left: 24px;"><?php _e("Hybrid Themes"); ?></div></th>
111
  <td>
powerpressadmin-basic.php CHANGED
@@ -137,7 +137,7 @@ Once your podcast is listed on iTunes, enter your one-click subscription URL abo
137
  <tr valign="top">
138
  <th scope="row">
139
 
140
- <?php _e("Ping iTunes"); ?></th>
141
  <td>
142
  <select name="General[ping_itunes]"<?php if( $OpenSSLSupport == false ) echo ' disabled'; ?> class="bpp_input_sm">
143
  <?php
@@ -150,8 +150,8 @@ while( list($value,$desc) = each($options) )
150
  echo "\t<option value=\"$value\"". ($General['ping_itunes']==$value?' selected':''). ">$desc</option>\n";
151
 
152
  ?>
153
- </select> (Notify iTunes when you publish a new episode.)
154
- <p><input name="TestiTunesPing" type="checkbox" value="1"<?php if( $OpenSSLSupport == false ) echo ' disabled'; ?> /> Test iTunes Ping (recommended)</p>
155
  <?php if( $General['itunes_url'] ) {
156
 
157
  $ping_url = str_replace(
@@ -163,7 +163,7 @@ while( list($value,$desc) = each($options) )
163
  'http://www.itunes.com/podcast?id='),
164
  'https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?id=', $General['itunes_url']);
165
  ?>
166
- <p>You may also ping iTunes by using the following link: <a href="#" onclick="javascript: window.open('<?php echo $ping_url; ?>'); return false;" title="Ping iTunes in New Window">Ping iTunes in New Window</a></p>
167
 
168
  <?php
169
  if( preg_match('/id=(\d+)/', $General['itunes_url'], $matches) )
@@ -175,10 +175,10 @@ while( list($value,$desc) = each($options) )
175
  {
176
  $PingLog = $Logging['itunes_ping_'. $FEEDID ];
177
  ?>
178
- <h3>Latest iTunes Ping Status: <?php if( $PingLog['success'] ) echo '<span style="color: #006505;">Successful</span>'; else echo '<span style="color: #f00;">Error</span>'; ?></h3>
179
  <div style="font-size: 85%; margin-left: 20px;">
180
  <p>
181
- <?php echo sprintf( __('iTunes pinged on %s at %s'), date(get_option('date_format'), $PingLog['timestamp']), date(get_option('time_format'), $PingLog['timestamp'])); ?>
182
  <?php
183
  if( $PingLog['post_id'] )
184
  {
@@ -214,8 +214,8 @@ while( list($value,$desc) = each($options) )
214
  <?php } // End if !$OpenSSLSupport ?>
215
 
216
 
217
- <h2><?php _e("Edit Post Settings"); ?></h2>
218
- <p style="margin-bottom: 0;">Configure how the Podcast Episode entry boxes function when editing blog posts.</p>
219
  <table class="form-table">
220
  <tr valign="top">
221
  <th scope="row">
@@ -354,7 +354,7 @@ while( list($value,$desc) = each($options) )
354
  <?php _e("Blubrry Services"); ?>
355
  </th>
356
  <td>
357
- <p style="margin-top: 5px;"><span id="service_mode"><?php echo $ModeDesc; ?></span> (<strong><a href="<?php echo admin_url(); echo wp_nonce_url("admin.php?action=powerpress-jquery-account", 'powerpress-jquery-account'); ?>&KeepThis=true&TB_iframe=true&width=500&height=400&modal=true" target="_blank" class="thickbox" style="color: #3D517E;" title="Blubrry Services Integration">Click here to configure Blubrry Services</a></strong>)</p>
358
  </td>
359
  </tr>
360
 
@@ -472,4 +472,23 @@ Enter your Redirect URL issued by your media statistics service provider below.
472
 
473
  <?php
474
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  ?>
137
  <tr valign="top">
138
  <th scope="row">
139
 
140
+ <?php _e("Update iTunes Listing"); ?></th>
141
  <td>
142
  <select name="General[ping_itunes]"<?php if( $OpenSSLSupport == false ) echo ' disabled'; ?> class="bpp_input_sm">
143
  <?php
150
  echo "\t<option value=\"$value\"". ($General['ping_itunes']==$value?' selected':''). ">$desc</option>\n";
151
 
152
  ?>
153
+ </select> Notify (ping) iTunes when you publish a new episode.
154
+ <p><input name="TestiTunesPing" type="checkbox" value="1"<?php if( $OpenSSLSupport == false ) echo ' disabled'; ?> /> Test Update iTunes Listing (recommended)</p>
155
  <?php if( $General['itunes_url'] ) {
156
 
157
  $ping_url = str_replace(
163
  'http://www.itunes.com/podcast?id='),
164
  'https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?id=', $General['itunes_url']);
165
  ?>
166
+ <p>You may also update your iTunes listing by using the following link: <a href="#" onclick="javascript: window.open('<?php echo $ping_url; ?>'); return false;" title="Ping iTunes in New Window">Ping iTunes in New Window</a></p>
167
 
168
  <?php
169
  if( preg_match('/id=(\d+)/', $General['itunes_url'], $matches) )
175
  {
176
  $PingLog = $Logging['itunes_ping_'. $FEEDID ];
177
  ?>
178
+ <h3>Latest Update iTunes Listing Status: <?php if( $PingLog['success'] ) echo '<span style="color: #006505;">Successful</span>'; else echo '<span style="color: #f00;">Error</span>'; ?></h3>
179
  <div style="font-size: 85%; margin-left: 20px;">
180
  <p>
181
+ <?php echo sprintf( __('iTunes notified on %s at %s'), date(get_option('date_format'), $PingLog['timestamp']), date(get_option('time_format'), $PingLog['timestamp'])); ?>
182
  <?php
183
  if( $PingLog['post_id'] )
184
  {
214
  <?php } // End if !$OpenSSLSupport ?>
215
 
216
 
217
+ <h2><?php _e("Podcast Entry Box Options"); ?></h2>
218
+ <p style="margin-bottom: 0;">Configure how the Podcast Episode entry box functions when editing blog posts and pages.</p>
219
  <table class="form-table">
220
  <tr valign="top">
221
  <th scope="row">
354
  <?php _e("Blubrry Services"); ?>
355
  </th>
356
  <td>
357
+ <p style="margin-top: 5px;"><span id="service_mode"><?php echo $ModeDesc; ?></span> (<strong><a href="<?php echo admin_url(); echo wp_nonce_url( ($AdvancedMode?'admin':'options-general') .".php?action=powerpress-jquery-account", 'powerpress-jquery-account'); ?>&KeepThis=true&TB_iframe=true&width=500&height=400&modal=true" target="_blank" class="thickbox" style="color: #3D517E;" title="Blubrry Services Integration">Click here to configure Blubrry Services</a></strong>)</p>
358
  </td>
359
  </tr>
360
 
472
 
473
  <?php
474
  }
475
+
476
+ function powerpress_admin_basic_diagnostics()
477
+ {
478
+ ?>
479
+ <h2><?php echo __('Tools'); ?></h2>
480
+ <table class="form-table">
481
+ <tr valign="top">
482
+ <th scope="row"><?php echo __("Diagnostics"); ?></th>
483
+ <td>
484
+ <p style="margin-top: 5px;"><strong><a href="<?php echo admin_url() . ($AdvancedMode?'admin':'options-general') .'.php?page=powerpress/powerpressadmin_basic.php&amp;action=powerpress-diagnostics'; ?>"><?php _e('Diagnose Your PowerPress Installation'); ?></a></strong></p>
485
+ <p>
486
+ <?php echo __('The Diagnostics page checks to see if your server is configured to support all of the available features in Blubrry PowerPress.'); ?>
487
+ </p>
488
+ </td>
489
+ </tr>
490
+ </table>
491
+ <?php
492
+ }
493
+
494
  ?>
powerpressadmin-diagnostics.php ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // powerpressadmin-ping-sites.php
3
+
4
+ function powerpressadmin_diagnostics_process()
5
+ {
6
+ global $powerpress_diags;
7
+ $powerpress_diags = array();
8
+
9
+ // First, see if the user has cURL and/or allow_url_fopen enabled...
10
+ $powerpress_diags['detecting_media'] = array();
11
+ $powerpress_diags['detecting_media']['success'] = true;
12
+ $powerpress_diags['detecting_media']['warning'] = false;
13
+ $powerpress_diags['detecting_media']['allow_url_fopen'] = (ini_get( 'allow_url_fopen' ) != false); // fopen
14
+ $powerpress_diags['detecting_media']['curl'] = function_exists( 'curl_init' ); // cURL
15
+ $powerpress_diags['detecting_media']['message2'] = ''; // if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
16
+
17
+ // Testing:
18
+ //$powerpress_diags['detecting_media']['allow_url_fopen'] = false;
19
+ //$powerpress_diags['detecting_media']['curl'] = false;
20
+
21
+ if( $powerpress_diags['detecting_media']['curl'] )
22
+ {
23
+ $powerpress_diags['detecting_media']['message'] = 'Your web server supports the PHP cURL library.';
24
+ if( $powerpress_diags['detecting_media']['allow_url_fopen'] )
25
+ $powerpress_diags['detecting_media']['message'] .= ' '. 'Your web server is also configured with the php.ini setting \'allow_url_fopen\' enabled, but the cURL library takes precedence.';
26
+
27
+ if( ini_get('safe_mode') && ini_get('open_basedir') )
28
+ {
29
+ $powerpress_diags['detecting_media']['warning'] = true;
30
+ $powerpress_diags['detecting_media']['message2'] = __('Warning: Both php.ini settings \'safe_mode\' and \'open_basedir\' will prevent the cURL library from following redirects in URLs.');
31
+ }
32
+ else if( ini_get('safe_mode') )
33
+ {
34
+ $powerpress_diags['detecting_media']['warning'] = true;
35
+ $powerpress_diags['detecting_media']['message2'] = __('Warning: The php.ini setting \'safe_mode\' will prevent the cURL library from following redirects in URLs.');
36
+ }
37
+ else if( ini_get('open_basedir') )
38
+ {
39
+ $powerpress_diags['detecting_media']['warning'] = true;
40
+ $powerpress_diags['detecting_media']['message2'] = __('Warning: The php.ini setting \'open_basedir\' will prevent the cURL library from following redirects in URLs.');
41
+ }
42
+ }
43
+ else if( $powerpress_diags['detecting_media']['allow_url_fopen'] )
44
+ {
45
+ $powerpress_diags['detecting_media']['message'] = 'Your web server is configured with the php.ini setting \'allow_url_fopen\' enabled.';
46
+ }
47
+ else
48
+ {
49
+ $powerpress_diags['detecting_media']['success'] = false;
50
+ $powerpress_diags['detecting_media']['message'] = __('Your server must either have the php.ini setting \'allow_url_fopen\' enabled or have the PHP cURL library installed in order to detect media information.');
51
+ }
52
+
53
+ // Second, see if we can ping itunes, OpenSSL is required
54
+ $powerpress_diags['pinging_itunes'] = array();
55
+ $powerpress_diags['pinging_itunes']['success'] = true;
56
+ $powerpress_diags['pinging_itunes']['openssl'] = extension_loaded('openssl');
57
+ $powerpress_diags['pinging_itunes']['curl_ssl'] = false;
58
+ if( function_exists('curl_version') )
59
+ {
60
+ $curl_info = curl_version();
61
+ $powerpress_diags['pinging_itunes']['curl_ssl'] = ($curl_info['features'] & CURL_VERSION_SSL );
62
+ }
63
+
64
+ // testing:
65
+ //$powerpress_diags['pinging_itunes']['openssl'] = false;
66
+ //$powerpress_diags['pinging_itunes']['curl_ssl'] = false;
67
+
68
+ if( $powerpress_diags['detecting_media']['success'] == false )
69
+ {
70
+ $powerpress_diags['pinging_itunes']['success'] = false;
71
+ $powerpress_diags['pinging_itunes']['message'] = __('The problem with \'Detecting Media Information\' above needs to be resolved for this test to continue.');
72
+ }
73
+ else if( $powerpress_diags['detecting_media']['curl'] && $powerpress_diags['pinging_itunes']['curl_ssl'] )
74
+ {
75
+ $powerpress_diags['pinging_itunes']['message'] = __('Your web server supports secure HTTPS connections.');
76
+ }
77
+ else if( $powerpress_diags['detecting_media']['curl'] )
78
+ {
79
+ $powerpress_diags['pinging_itunes']['success'] = false;
80
+ $powerpress_diags['pinging_itunes']['message'] = __('Your web server\'s cURL library does not support secure HTTPS connections.');
81
+ }
82
+ else if( $powerpress_diags['pinging_itunes']['openssl'] && $powerpress_diags['detecting_media']['allow_url_fopen'] )
83
+ {
84
+ $powerpress_diags['pinging_itunes']['message'] = __('Your web server supports secure HTTPS connections.');
85
+ }
86
+ else
87
+ {
88
+ $powerpress_diags['pinging_itunes']['success'] = false;
89
+ $powerpress_diags['pinging_itunes']['message'] = __('Pinging iTunes requires the PHP OpenSSL library to be installed.');
90
+ }
91
+
92
+ // Third, see if the uploads/powerpress folder is writable
93
+ $UploadArray = wp_upload_dir();
94
+ $powerpress_diags['uploading_artwork'] = array();
95
+ $powerpress_diags['uploading_artwork']['success'] = false;
96
+ $powerpress_diags['uploading_artwork']['file_uploads'] = ini_get( 'file_uploads' );
97
+ $powerpress_diags['uploading_artwork']['writable'] = false;
98
+ $powerpress_diags['uploading_artwork']['upload_path'] = '';
99
+ $powerpress_diags['uploading_artwork']['message'] = '';
100
+
101
+ // Testing:
102
+ //$UploadArray['error'] = 'WordPres broke';
103
+ //$powerpress_diags['uploading_artwork']['file_uploads'] = false;
104
+ //$UploadArray['error'] = true;
105
+
106
+ if( $powerpress_diags['uploading_artwork']['file_uploads'] == false )
107
+ {
108
+ $powerpress_diags['uploading_artwork']['message'] = __('Your server requires the php.ini setting \'file_uploads\' enabled in order to upload podcast artwork.');
109
+ }
110
+ else if( $UploadArray['error'] === false )
111
+ {
112
+ $powerpress_diags['uploading_artwork']['upload_path'] = $UploadArray['basedir'] . '/powerpress/';
113
+
114
+ if ( !is_dir($powerpress_diags['uploading_artwork']['upload_path']) && ! wp_mkdir_p( rtrim($powerpress_diags['uploading_artwork']['upload_path'], '/') ) )
115
+ {
116
+ $powerpress_diags['uploading_artwork']['message'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), rtrim($powerpress_diags['uploading_artwork']['upload_path'], '/') );
117
+ }
118
+ else
119
+ {
120
+ $powerpress_diags['uploading_artwork']['writable'] = powerpressadmin_diagnostics_is_writable($powerpress_diags['uploading_artwork']['upload_path']);
121
+ if( $powerpress_diags['uploading_artwork']['writable'] == false )
122
+ {
123
+ $powerpress_diags['uploading_artwork']['message'] = sprintf(__('PowerPress is unable to write to the %s directory.'), $powerpress_diags['uploading_artwork']['upload_path']);
124
+ }
125
+ else
126
+ {
127
+ $powerpress_diags['uploading_artwork']['success'] = true;
128
+ $powerpress_diags['uploading_artwork']['message'] = __('You are able to upload and save artwork images for your podcasts.');
129
+ }
130
+ }
131
+ }
132
+ else
133
+ {
134
+ if( strlen($UploadArray['error']) > 2 )
135
+ $powerpress_diags['uploading_artwork']['message'] = $UploadArray['error'];
136
+ else
137
+ $powerpress_diags['uploading_artwork']['message'] = __('An error occurred obtaining the uploads directory from WordPress.');
138
+ }
139
+
140
+ // Fourth, see if we have enough memory and we're running an appropriate version of PHP
141
+ $powerpress_diags['system_info'] = array();
142
+ $powerpress_diags['system_info']['warning'] = false;
143
+ $powerpress_diags['system_info']['success'] = true;
144
+ $powerpress_diags['system_info']['php_version'] = phpversion();
145
+ $powerpress_diags['system_info']['memory_limit'] = (int) ini_get('memory_limit');
146
+
147
+ // testing:
148
+ //$powerpress_diags['system_info']['memory_limit'] = -1;
149
+ //$powerpress_diags['system_info']['memory_limit'] = 0;
150
+ //$powerpress_diags['system_info']['memory_limit'] = 16;
151
+
152
+ if( $powerpress_diags['system_info']['memory_limit'] == 0 )
153
+ {
154
+ if( version_compare($powerpress_diags['system_info']['php_version'], '5.2') > 0 )
155
+ $powerpress_diags['system_info']['memory_limit'] = 128;
156
+ else if( version_compare($powerpress_diags['system_info']['php_version'], '5.2') == 0 )
157
+ $powerpress_diags['system_info']['memory_limit'] = 16;
158
+ else
159
+ $powerpress_diags['system_info']['memory_limit'] = 8;
160
+ }
161
+ $powerpress_diags['system_info']['memory_used'] = 0;
162
+
163
+ if( version_compare($powerpress_diags['system_info']['php_version'], '5.2') > -1 )
164
+ {
165
+ $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK!'), $powerpress_diags['system_info']['php_version'] );
166
+ }
167
+ else if( version_compare($powerpress_diags['system_info']['php_version'], '5') > -1 )
168
+ {
169
+ $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK, though PHP 5.2 or newer is recommended.'), $powerpress_diags['system_info']['php_version'] );
170
+ }
171
+ else
172
+ {
173
+ $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) will work, but PHP 5.2 or newer is recommended.'), $powerpress_diags['system_info']['php_version'] );
174
+ }
175
+
176
+ $used = 0;
177
+ $total = $powerpress_diags['system_info']['memory_limit'];
178
+
179
+ if( $total == -1 )
180
+ {
181
+ $powerpress_diags['system_info']['message2'] = __('Your scripts have no limit to the amount of memory they can use.');
182
+ $used = (function_exists('memory_get_peak_usage')? memory_get_peak_usage() : ( function_exists('memory_get_usage') ? memory_get_usage() : 0 ) );
183
+ if( $used )
184
+ $powerpress_diags['system_info']['memory_used'] = round($used / 1024 / 1024, 2);
185
+ }
186
+ else if( function_exists('memory_get_peak_usage') )
187
+ {
188
+ $used = round(memory_get_peak_usage() / 1024 / 1024, 2);
189
+ $powerpress_diags['system_info']['memory_used'] = $used;
190
+ $percent = ($used/$total)*100;
191
+ $powerpress_diags['system_info']['message2'] = sprintf(__('You are using %d%% (%.01fM of %.01dM) of available memory.'), $percent, $used, $total);
192
+ }
193
+ else if( function_exists('memory_get_usage') )
194
+ {
195
+ $used = round(memory_get_usage() / 1024 / 1024, 2);
196
+ $powerpress_diags['system_info']['memory_used'] = $used;
197
+ $percent = ($used/$total)*100;
198
+ $powerpress_diags['system_info']['message2'] = sprintf(__('You are using %d%% (%.01fM of %dM) of available memory. Versions of PHP 5.2 or newer will give you a more accurate total of memory usage.'), $percent, $used, $total);
199
+ }
200
+ else
201
+ {
202
+ $powerpress_diags['system_info']['message2'] = sprintf(__('Your scripts have a total of %dM.'), $total );
203
+ }
204
+
205
+ if( $total > 0 && ($used + 4) > $total )
206
+ {
207
+ $powerpress_diags['system_info']['warning'] = true;
208
+ $powerpress_diags['system_info']['message2'] = __('Warning: ') . $powerpress_diags['system_info']['message2'];
209
+ $powerpress_diags['system_info']['message2'] .= ' ';
210
+ $powerpress_diags['system_info']['message2'] .= sprintf(__('We recommend that you have at least %dM (4M more that what is currently used) or more memory to accomodate all of your installed plugins.'), ceil($used)+4 );
211
+ }
212
+
213
+ if( isset($_GET['Email']) && strlen($_GET['Email']) > 4 )
214
+ {
215
+ check_admin_referer('powerpress-diagnostics');
216
+ $email = $_GET['Email'];
217
+ powerpressadmin_diagnostics_email($email);
218
+ powerpress_page_message_add_notice( sprintf(__('Diagnostic results sent to %s.'), $email) );
219
+ }
220
+ }
221
+
222
+ function powerpressadmin_diagnostics_email($email)
223
+ {
224
+ global $powerpress_diags, $wpmu_version, $wp_version;
225
+ $SettingsGeneral = get_option('powerpress_general');
226
+
227
+ // First we need some basic information about the blog...
228
+ $message = 'Blog Title: ' . get_bloginfo('name') . "\n";
229
+ $message .= 'Blog URL: ' . get_bloginfo('home') . "\n";
230
+ $message .= 'WordPress Version: ' . $wp_version . "\n";
231
+ if( !empty($wpmu_version) )
232
+ $message .= 'WordPress MU Version: ' . $wpmu_version . "\n";
233
+ $message .= 'System: '. $_SERVER['SERVER_SOFTWARE'] . "\n";
234
+ $message .= 'Safe node: '. ( ini_get('safe_mode')?'true':'false') ."\n";
235
+ $message .= 'Open basedir: '. ini_get('open_basedir') ."\n";
236
+
237
+ // Crutial PowerPress Settings
238
+ $message .= "\n";
239
+ $message .= "Important PowerPress Settings...\n";
240
+ $message .= "\tpowerpress version: ". POWERPRESS_VERSION ."\n";
241
+ $message .= "\tadvanced mode: ". ($SettingsGeneral['advanced_mode']?'true':'false') ."\n";
242
+ $message .= "\tepisode box mode: ". ($SettingsGeneral['episode_box_mode']==0?'normal': ($SettingsGeneral['episode_box_mode']==1?'simple':'advanced') ) ."\n";
243
+
244
+ // Detecting Media Information
245
+ $message .= "\n";
246
+ $message .= "Detecting Media Information...\n";
247
+ $message .= "\tsuccess: ". ($powerpress_diags['detecting_media']['success']?'true':'false') ."\n";
248
+ $message .= "\twarning: ". ($powerpress_diags['detecting_media']['warning']?'true':'false') ."\n";
249
+ $message .= "\tallow_url_fopen: ". ($powerpress_diags['detecting_media']['allow_url_fopen']?'true':'false') ."\n";
250
+ $message .= "\tcurl: ". ($powerpress_diags['detecting_media']['curl']?'true':'false') ."\n";
251
+ $message .= "\tmessage: ". $powerpress_diags['detecting_media']['message'] ."\n";
252
+ $message .= "\tmessage 2: ". $powerpress_diags['detecting_media']['message2'] ."\n";
253
+
254
+ // Pinging iTunes
255
+ $message .= "\n";
256
+ $message .= "Pinging iTunes...\n";
257
+ $message .= "\tsuccess: ". ($powerpress_diags['pinging_itunes']['success']?'true':'false') ."\n";
258
+ $message .= "\tcurl_ssl: ". ($powerpress_diags['pinging_itunes']['curl_ssl']?'true':'false') ."\n";
259
+ $message .= "\topenssl: ". ($powerpress_diags['pinging_itunes']['openssl']?'true':'false') ."\n";
260
+ $message .= "\tmessage: ". $powerpress_diags['pinging_itunes']['message'] ."\n";
261
+
262
+ // Uploading Artwork
263
+ $message .= "\n";
264
+ $message .= "Uploading Artwork...\n";
265
+ $message .= "\tsuccess: ". ($powerpress_diags['uploading_artwork']['success']?'true':'false') ."\n";
266
+ $message .= "\tfile_uploads: ". ($powerpress_diags['uploading_artwork']['file_uploads']?'true':'false') ."\n";
267
+ $message .= "\twritable: ". ($powerpress_diags['uploading_artwork']['writable']?'true':'false') ."\n";
268
+ $message .= "\tupload_path: ". $powerpress_diags['uploading_artwork']['upload_path'] ."\n";
269
+ $message .= "\tmessage: ". $powerpress_diags['uploading_artwork']['message'] ."\n";
270
+
271
+ // System Information
272
+ $message .= "\n";
273
+ $message .= "System Information...\n";
274
+ $message .= "\tsuccess: ". ($powerpress_diags['system_info']['success']?'true':'false') ."\n";
275
+ $message .= "\twarning: ". ($powerpress_diags['system_info']['warning']?'yes':'no') ."\n";
276
+ $message .= "\tphp_version: ". $powerpress_diags['system_info']['php_version'] ."\n";
277
+ $message .= "\tmemory_limit: ". $powerpress_diags['system_info']['memory_limit'] ."M\n";
278
+ $message .= "\tmemory_used: ". sprintf('%.01fM',$powerpress_diags['system_info']['memory_used']) ."\n";
279
+ $message .= "\tmessage: ". $powerpress_diags['system_info']['message'] ."\n";
280
+ $message .= "\tmessage 2: ". $powerpress_diags['system_info']['message2'] ."\n";
281
+
282
+ // Now lets loop through each section of diagnostics
283
+ $user_info = wp_get_current_user();
284
+ $from_email = $user_info->user_email;
285
+ $from_name = $user_info->user_nicename;
286
+ $headers = 'From: "'.$from_name.'" <'.$from_email.'>'."\n"
287
+ .'Reply-To: "'.$from_name.'" <'.$from_email.'>'."\n"
288
+ .'Return-Path: "'.$from_name.'" <'.$from_email.'>'."\n";
289
+ if( isset($_GET['CC']) )
290
+ $headers .= 'CC: "'.$from_name.'" <'.$from_email.'>'."\n";
291
+
292
+ @wp_mail($email, __('Blubrry PowerPress diagnostic results for '). get_bloginfo('name'), $message, $headers);
293
+ }
294
+
295
+ function powerpressadmin_diagnostics_is_writable($dir)
296
+ {
297
+ // Make sure we can create a file in the specified directory...
298
+ if( is_dir($dir) )
299
+ {
300
+ return is_writable($dir);
301
+ }
302
+ return false;
303
+ }
304
+
305
+ function powerpressadmin_diagnostics_status($success=true, $warning=false)
306
+ {
307
+ $img = 'yes.png';
308
+ $color = '#458045';
309
+ $text = __('Success');
310
+ if( $success == false ) // Failed takes precedence over warning
311
+ {
312
+ $img = 'no.png';
313
+ $color = '#CC0000';
314
+ $text = __('Failed');
315
+ }
316
+ else if( $warning )
317
+ {
318
+ $img = '../../../wp-includes/images/smilies/icon_exclaim.gif';
319
+ $color = '#D98500';
320
+ $text = __('Warning');
321
+ }
322
+ ?>
323
+ <img src="<?php echo admin_url(); ?>/images/<?php echo $img; ?>" style="vertical-align:text-top;" />
324
+ <strong style="color:<?php echo $color; ?>;"><?php echo $text; ?></strong>
325
+ <?php
326
+ }
327
+
328
+ function powerpressadmin_diagnostics()
329
+ {
330
+ global $powerpress_diags;
331
+ $GeneralSettings = get_option('powerpress_general');
332
+
333
+ if( empty($powerpress_diags) )
334
+ {
335
+ powerpressadmin_diagnostics_process();
336
+ powerpress_page_message_print();
337
+ }
338
+ ?>
339
+
340
+ <h2><?php echo __("Blubrry PowerPress Diagnostics"); ?></h2>
341
+ <p>
342
+ <?php echo __('The Diagnostics page checks to see if your server is configured to support all of the available features in Blubrry PowerPress.'); ?>
343
+ </p>
344
+
345
+ <h3 style="margin-bottom: 0;">Detecting Media Information</h3>
346
+ <p style="margin: 0;">The following test checks to see if your web server can make connections with other web servers to obtain file size and media duration information.
347
+ The test checks to see if either the PHP cURL library is installed or the php.ini setting 'allow_url_fopen' enabled.
348
+ </p>
349
+ <table class="form-table">
350
+ <tr valign="top">
351
+ <th scope="row">
352
+ <?php powerpressadmin_diagnostics_status($powerpress_diags['detecting_media']['success'],$powerpress_diags['detecting_media']['warning']); ?>
353
+ </th>
354
+ <td>
355
+ <p><?php echo htmlspecialchars($powerpress_diags['detecting_media']['message']); ?></p>
356
+ <?php if( $powerpress_diags['detecting_media']['message2'] ) { ?>
357
+ <p><?php echo htmlspecialchars($powerpress_diags['detecting_media']['message2']); ?></p><?php } ?>
358
+ <?php if( $powerpress_diags['detecting_media']['success'] ) { ?>
359
+ <p><?php echo __('If you are still having problems detecting media information, check with your web hosting provider if there is a firewall blocking your server.'); ?></p>
360
+ <?php } else { ?>
361
+ <p><?php echo __('Contact your web hosting provider with the information above.'); ?></p>
362
+ <?php } ?>
363
+ </td>
364
+ </tr>
365
+ </table>
366
+
367
+ <h3 style="margin-bottom: 0;"><?php echo __("Pinging iTunes"); ?></h3>
368
+ <p style="margin: 0;">The following test checks to see that your web server can make connections with Apple's secure ping server.</p>
369
+ <table class="form-table">
370
+ <tr valign="top">
371
+ <th scope="row">
372
+ <?php powerpressadmin_diagnostics_status($powerpress_diags['pinging_itunes']['success']); ?>
373
+ </th>
374
+ <td>
375
+ <p><?php echo htmlspecialchars($powerpress_diags['pinging_itunes']['message']); ?></p>
376
+ <?php if( $powerpress_diags['pinging_itunes']['success'] == false ) { ?>
377
+ <p><?php echo __('Contact your web hosting provider with the information above.'); ?></p>
378
+ <?php } ?>
379
+ </td>
380
+ </tr>
381
+ </table>
382
+
383
+ <h3 style="margin-bottom: 0;"><?php echo __("Uploading Artwork"); ?></h3>
384
+ <p style="margin: 0;">The following test checks to see that you can upload and store files on your web server.</p>
385
+ <table class="form-table">
386
+ <tr valign="top">
387
+ <th scope="row">
388
+ <?php powerpressadmin_diagnostics_status($powerpress_diags['uploading_artwork']['success']); ?>
389
+ </th>
390
+ <td>
391
+ <p><?php echo htmlspecialchars($powerpress_diags['uploading_artwork']['message']); ?></p>
392
+ </td>
393
+ </tr>
394
+ </table>
395
+
396
+ <h3 style="margin-bottom: 0;"><?php echo __("System Information"); ?></h3>
397
+ <p style="margin: 0;">The following test checks your version of PHP and memory usage.</p>
398
+ <table class="form-table">
399
+ <tr valign="top">
400
+ <th scope="row">
401
+ <?php powerpressadmin_diagnostics_status($powerpress_diags['system_info']['success'], $powerpress_diags['system_info']['warning']); ?>
402
+ </th>
403
+ <td>
404
+ <p><?php echo htmlspecialchars($powerpress_diags['system_info']['message']); ?></p>
405
+ <p><?php echo htmlspecialchars($powerpress_diags['system_info']['message2']); ?></p>
406
+ <?php if( $powerpress_diags['system_info']['warning'] ) { ?>
407
+ <p><?php echo __('Contact your web hosting provider to inquire how to increase the PHP memory limit on your web server.'); ?></p>
408
+ <?php } ?>
409
+ </td>
410
+ </tr>
411
+ </table>
412
+
413
+ <form enctype="multipart/form-data" method="get" action="<?php echo admin_url( ($GeneralSettings['advanced_mode']==1?'admin':'options-general') .'.php'); ?>">
414
+ <input type="hidden" name="action" value="powerpress-diagnostics" />
415
+ <input type="hidden" name="page" value="powerpress/powerpressadmin_<?php echo ($GeneralSettings['advanced_mode']==1?'tools':'basic'); ?>.php" />
416
+ <?php
417
+ // Print nonce
418
+ wp_nonce_field('powerpress-diagnostics');
419
+ ?>
420
+
421
+ <h3 style="margin-bottom: 0;"><?php echo __("Email Results"); ?></h3>
422
+ <p style="margin: 0;">Send the results above to the specified Email address.</p>
423
+ <table class="form-table">
424
+ <tr valign="top">
425
+ <th scope="row">
426
+ Email
427
+ </th>
428
+ <td>
429
+ <div style="margin-top: 5px;">
430
+ <input type="text" name="Email" value="" style="width: 50%;" />
431
+ <input type="submit" name="Submit" id="powerpress_save_button" class="button-primary" value="Send Results" />
432
+ </div>
433
+ <div>
434
+ <input type="checkbox" name="CC" value="1" style="vertical-align: text-top;" checked /> CC: <?php $user_info = wp_get_current_user(); echo "&quot;{$user_info->user_nicename}&quot; &lt;{$user_info->user_email}&gt;"; ?>
435
+ </div>
436
+ </td>
437
+ </tr>
438
+ </table>
439
+ </form>
440
+
441
+ <p>&nbsp;</p>
442
+
443
+ <!-- start footer -->
444
+ <?php
445
+ }
446
+
447
+ ?>
powerpressadmin-editfeed.php CHANGED
@@ -108,14 +108,17 @@ function powerpress_languages()
108
  // powerpressadmin_editfeed.php
109
  function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
110
  {
 
111
  $UploadArray = wp_upload_dir();
112
- $upload_path = rtrim( substr($UploadArray['path'], 0, 0 - strlen($UploadArray['subdir']) ), '\\/').'/powerpress/';
113
-
114
- if( !file_exists($upload_path) )
115
- $SupportUploads = @mkdir($upload_path, 0777);
116
- else
117
- $SupportUploads = true;
118
 
 
 
 
 
 
119
  $General = powerpress_get_settings('powerpress_general');
120
 
121
 
@@ -247,7 +250,7 @@ while( list($value,$desc) = each($applyoptions) )
247
 
248
  while( list($feed_slug, $feed_title) = each($Feeds) )
249
  {
250
- $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
251
  ?>
252
  <p><?php echo $feed_title; ?>: <a href="<?php echo get_feed_link($feed_slug); ?>" title="<?php echo $feed_title; ?>" target="_blank"><?php echo get_feed_link($feed_slug); ?></a>
253
  | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_feed_link($feed_slug)); ?>" title="Validate Feed" target="_blank">validate</a>
@@ -331,7 +334,7 @@ Once your podcast is listed on iTunes, enter your one-click subscription URL abo
331
  </p>
332
  <p>e.g. http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=000000000</p>
333
 
334
- <p><input name="TestiTunesPing" type="checkbox" value="1" /> Test iTunes Ping (recommended)</p>
335
  <?php if( $FeedSettings['itunes_url'] ) {
336
 
337
  $ping_url = str_replace(
@@ -343,7 +346,7 @@ Once your podcast is listed on iTunes, enter your one-click subscription URL abo
343
  'http://www.itunes.com/podcast?id='),
344
  'https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?id=', $FeedSettings['itunes_url']);
345
  ?>
346