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 | 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 +92 -14
- powerpress.php +267 -233
- powerpressadmin-appearance.php +1 -1
- powerpressadmin-basic.php +28 -9
- powerpressadmin-diagnostics.php +447 -0
- powerpressadmin-editfeed.php +15 -12
- powerpressadmin-podpress.php +2 -0
- powerpressadmin-tags.php +10 -6
- powerpressadmin-tools.php +11 -0
- powerpressadmin.php +114 -38
- readme.txt +26 -7
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(
|
|
|
|
|
|
|
|
|
143 |
{
|
144 |
$ReturnCode = $matches[1];
|
145 |
-
if( $ReturnCode < 200 || $ReturnCode >
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
239 |
|
240 |
if( $HttpCode < 200 || $HttpCode > 250 )
|
241 |
{
|
@@ -244,7 +284,21 @@
|
|
244 |
case 301:
|
245 |
case 302:
|
246 |
case 307: {
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
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.
|
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 |
-
|
181 |
-
|
182 |
-
|
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( !$
|
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($
|
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) ." — ".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 |
-
$
|
597 |
$custom_enclosure = true;
|
598 |
}
|
599 |
else
|
600 |
{
|
601 |
-
$
|
602 |
-
|
603 |
-
|
604 |
-
if( !$enclosureData )
|
605 |
-
{
|
606 |
-
$EnclosureURL = '';
|
607 |
-
if( $powerpress_feed['process_podpress'] )
|
608 |
{
|
609 |
-
|
610 |
-
$
|
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 |
-
|
651 |
-
|
652 |
-
|
653 |
-
$
|
654 |
-
|
|
|
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( $
|
668 |
{
|
669 |
-
$EpisodeData
|
670 |
-
|
671 |
-
|
672 |
-
|
|
|
|
|
|
|
673 |
{
|
674 |
-
|
675 |
-
|
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 |
-
$
|
702 |
-
$
|
703 |
-
$
|
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 |
-
|
727 |
-
$content_no_html =
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
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 |
-
|
|
|
928 |
|
929 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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($
|
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 |
-
$
|
1446 |
-
if( isset($
|
1447 |
-
$return = $
|
1448 |
-
|
1449 |
-
|
|
|
|
|
|
|
|
|
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 |
-
$
|
1463 |
-
if(
|
1464 |
-
|
1465 |
-
|
1466 |
-
if(
|
1467 |
-
$return .=
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
$
|
|
|
|
|
|
|
|
|
|
|
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( !$
|
1512 |
{
|
1513 |
echo '<p>Unable to retrieve media information.</p>';
|
1514 |
}
|
1515 |
-
else if( isset($
|
1516 |
{
|
1517 |
-
echo $
|
1518 |
}
|
1519 |
-
else // if( !isset($
|
1520 |
{
|
1521 |
-
echo apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($
|
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 |
-
|
2059 |
-
$Data[
|
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(']]>', ']]>', $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']) ." — ".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(
|
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("
|
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>
|
154 |
-
<p><input name="TestiTunesPing" type="checkbox" value="1"<?php if( $OpenSSLSupport == false ) echo ' disabled'; ?> /> Test iTunes
|
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
|
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
|
179 |
<div style="font-size: 85%; margin-left: 20px;">
|
180 |
<p>
|
181 |
-
<?php echo sprintf( __('iTunes
|
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("
|
218 |
-
<p style="margin-bottom: 0;">Configure how the Podcast Episode entry
|
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(
|
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&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 ""{$user_info->user_nicename}" <{$user_info->user_email}>"; ?>
|
435 |
+
</div>
|
436 |
+
</td>
|
437 |
+
</tr>
|
438 |
+
</table>
|
439 |
+
</form>
|
440 |
+
|
441 |
+
<p> </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 |
-
|
113 |
-
|
114 |
-
|
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&action=powerpress-editfeed&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
|
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 |
-
<p>You may also
|
347 |
|
348 |
<?php
|
349 |
if( preg_match('/id=(\d+)/', $FeedSettings['itunes_url'], $matches) )
|
@@ -355,10 +358,10 @@ Once your podcast is listed on iTunes, enter your one-click subscription URL abo
|
|
355 |
{
|
356 |
$PingLog = $Logging['itunes_ping_'. $FEEDID ];
|
357 |
?>
|
358 |
-
<h3>Latest iTunes
|
359 |
<div style="font-size: 85%; margin-left: 20px;">
|
360 |
<p>
|
361 |
-
<?php echo sprintf( __('iTunes
|
362 |
<?php
|
363 |
if( $PingLog['post_id'] )
|
364 |
{
|
@@ -467,7 +470,7 @@ else
|
|
467 |
|
468 |
<textarea name="Feed[itunes_summary]" rows="5" style="width:80%;" ><?php echo $FeedSettings['itunes_summary']; ?></textarea>
|
469 |
<?php if ( version_compare( '5', phpversion(), '>=' ) ) { ?>
|
470 |
-
<div><input type="checkbox" name="Feed[enhance_itunes_summary]" value="1" <?php echo ($FeedSettings['enhance_itunes_summary']?'checked ':''); ?>/>
|
471 |
</div>
|
472 |
<?php } ?>
|
473 |
</td>
|
108 |
// powerpressadmin_editfeed.php
|
109 |
function powerpress_admin_editfeed($feed_slug=false, $cat_ID =false)
|
110 |
{
|
111 |
+
$SupportUploads = false;
|
112 |
$UploadArray = wp_upload_dir();
|
113 |
+
if( false === $UploadArray['error'] )
|
114 |
+
{
|
115 |
+
$upload_path = $UploadArray['basedir'].'/powerpress/';
|
|
|
|
|
|
|
116 |
|
117 |
+
if( !file_exists($upload_path) )
|
118 |
+
$SupportUploads = @wp_mkdir_p( rtrim($upload_path, '/') );
|
119 |
+
else
|
120 |
+
$SupportUploads = true;
|
121 |
+
}
|
122 |
$General = powerpress_get_settings('powerpress_general');
|
123 |
|
124 |
|
250 |
|
251 |
while( list($feed_slug, $feed_title) = each($Feeds) )
|
252 |
{
|
253 |
+
$edit_link = admin_url( ($AdvancedMode?'admin':'options-general') .'.php?page=powerpress/powerpressadmin_customfeeds.php&action=powerpress-editfeed&feed_slug=') . $feed_slug;
|
254 |
?>
|
255 |
<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>
|
256 |
| <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_feed_link($feed_slug)); ?>" title="Validate Feed" target="_blank">validate</a>
|
334 |
</p>
|
335 |
<p>e.g. http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=000000000</p>
|
336 |
|
337 |
+
<p><input name="TestiTunesPing" type="checkbox" value="1" /> Test Update iTunes Listing (recommended)</p>
|
338 |
<?php if( $FeedSettings['itunes_url'] ) {
|
339 |
|
340 |
$ping_url = str_replace(
|
346 |
'http://www.itunes.com/podcast?id='),
|
347 |
'https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?id=', $FeedSettings['itunes_url']);
|
348 |
?>
|
349 |
+
<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="Update iTunes Listing in New Window">Update iTunes Listing in New Window</a></p>
|
350 |
|
351 |
<?php
|
352 |
if( preg_match('/id=(\d+)/', $FeedSettings['itunes_url'], $matches) )
|
358 |
{
|
359 |
$PingLog = $Logging['itunes_ping_'. $FEEDID ];
|
360 |
?>
|
361 |
+
<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>
|
362 |
<div style="font-size: 85%; margin-left: 20px;">
|
363 |
<p>
|
364 |
+
<?php echo sprintf( __('iTunes notified on %s at %s'), date(get_option('date_format'), $PingLog['timestamp']), date(get_option('time_format'), $PingLog['timestamp'])); ?>
|
365 |
<?php
|
366 |
if( $PingLog['post_id'] )
|
367 |
{
|
470 |
|
471 |
<textarea name="Feed[itunes_summary]" rows="5" style="width:80%;" ><?php echo $FeedSettings['itunes_summary']; ?></textarea>
|
472 |
<?php if ( version_compare( '5', phpversion(), '>=' ) ) { ?>
|
473 |
+
<div><input type="checkbox" name="Feed[enhance_itunes_summary]" value="1" <?php echo ($FeedSettings['enhance_itunes_summary']?'checked ':''); ?>/> Optimize iTunes Summary from Blog Posts (<a href="http://help.blubrry.com/blubrry-powerpress/settings/enhanced-itunes-summary/" target="_blank">What's this</a>)
|
474 |
</div>
|
475 |
<?php } ?>
|
476 |
</td>
|
powerpressadmin-podpress.php
CHANGED
@@ -642,6 +642,7 @@ function check_radio_selection(obj, PostID, FileIndex)
|
|
642 |
<?php
|
643 |
}
|
644 |
|
|
|
645 |
if( $AllowCleanup )
|
646 |
{
|
647 |
?>
|
@@ -664,6 +665,7 @@ function check_radio_selection(obj, PostID, FileIndex)
|
|
664 |
</p>
|
665 |
<?php
|
666 |
}
|
|
|
667 |
}
|
668 |
else
|
669 |
{
|
642 |
<?php
|
643 |
}
|
644 |
|
645 |
+
/*
|
646 |
if( $AllowCleanup )
|
647 |
{
|
648 |
?>
|
665 |
</p>
|
666 |
<?php
|
667 |
}
|
668 |
+
*/
|
669 |
}
|
670 |
else
|
671 |
{
|
powerpressadmin-tags.php
CHANGED
@@ -134,13 +134,17 @@ function powerpressadmin_tag_option($tag, $value, $label, $default_desc )
|
|
134 |
if( $file )
|
135 |
{
|
136 |
$FeedSettings = get_option('powerpress_feed');
|
|
|
137 |
$UploadArray = wp_upload_dir();
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
144 |
?>
|
145 |
<input type="radio" name="General[<?php echo $tag; ?>]" value="0" <?php if( $value == '' ) echo 'checked'; ?> />
|
146 |
Do not add a coverart image.<br />
|
134 |
if( $file )
|
135 |
{
|
136 |
$FeedSettings = get_option('powerpress_feed');
|
137 |
+
$SupportUploads = false;
|
138 |
$UploadArray = wp_upload_dir();
|
139 |
+
if( false === $UploadArray['error'] )
|
140 |
+
{
|
141 |
+
$upload_path = $UploadArray['basedir'].'/powerpress/';
|
142 |
+
|
143 |
+
if( !file_exists($upload_path) )
|
144 |
+
$SupportUploads = @wp_mkdir_p( rtrim($upload_path, '/') );
|
145 |
+
else
|
146 |
+
$SupportUploads = true;
|
147 |
+
}
|
148 |
?>
|
149 |
<input type="radio" name="General[<?php echo $tag; ?>]" value="0" <?php if( $value == '' ) echo 'checked'; ?> />
|
150 |
Do not add a coverart image.<br />
|
powerpressadmin-tools.php
CHANGED
@@ -92,6 +92,17 @@
|
|
92 |
</td>
|
93 |
</tr>
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
<!--
|
96 |
<tr valign="top">
|
97 |
<th scope="row">Plugin Translation</th>
|
92 |
</td>
|
93 |
</tr>
|
94 |
|
95 |
+
|
96 |
+
<tr valign="top">
|
97 |
+
<th scope="row"><?php echo __("Diagnostics"); ?></th>
|
98 |
+
<td>
|
99 |
+
<p style="margin-top: 5px;"><strong><a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_tools.php&action=powerpress-diagnostics"); ?>"><?php _e('Diagnose Your PowerPress Installation'); ?></a></strong></p>
|
100 |
+
<p>
|
101 |
+
The Diagnostics page checks to see if your server is configured to support all of the available features in Blubrry PowerPress.
|
102 |
+
</p>
|
103 |
+
</td>
|
104 |
+
</tr>
|
105 |
+
|
106 |
<!--
|
107 |
<tr valign="top">
|
108 |
<th scope="row">Plugin Translation</th>
|
powerpressadmin.php
CHANGED
@@ -63,9 +63,15 @@ function powerpress_admin_init()
|
|
63 |
if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
|
64 |
{
|
65 |
check_admin_referer('powerpress-edit');
|
|
|
|
|
|
|
66 |
$UploadArray = wp_upload_dir();
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
// Save the posted value in the database
|
71 |
$Feed = $_POST['Feed'];
|
@@ -93,7 +99,7 @@ function powerpress_admin_init()
|
|
93 |
if( $ImageData && ( $ImageData[2] == IMAGETYPE_JPEG || $ImageData[2] == IMAGETYPE_PNG ) && $ImageData[0] == $ImageData[1] ) // Just check that it is an image, the correct image type and that the image is square
|
94 |
{
|
95 |
move_uploaded_file($temp, $upload_path . $filename);
|
96 |
-
$Feed['itunes_image'] = $
|
97 |
}
|
98 |
else
|
99 |
{
|
@@ -119,7 +125,7 @@ function powerpress_admin_init()
|
|
119 |
if( getimagesize($temp) ) // Just check that it is an image, we may add more to this later
|
120 |
{
|
121 |
move_uploaded_file($temp, $upload_path . $filename);
|
122 |
-
$Feed['rss2_image'] = $
|
123 |
}
|
124 |
else
|
125 |
{
|
@@ -127,7 +133,7 @@ function powerpress_admin_init()
|
|
127 |
}
|
128 |
}
|
129 |
|
130 |
-
// New
|
131 |
if( @$_POST['coverart_image_checkbox'] == 1 )
|
132 |
{
|
133 |
$filename = str_replace(" ", "_", basename($_FILES['coverart_image_file']['name']) );
|
@@ -145,7 +151,7 @@ function powerpress_admin_init()
|
|
145 |
if( getimagesize($temp) ) // Just check that it is an image, we may add more to this later
|
146 |
{
|
147 |
move_uploaded_file($temp, $upload_path . $filename);
|
148 |
-
$_POST['TagValues']['tag_coverart'] = $
|
149 |
}
|
150 |
else
|
151 |
{
|
@@ -224,7 +230,7 @@ function powerpress_admin_init()
|
|
224 |
if( $TagValues['tag_coverart'] != '' )
|
225 |
{
|
226 |
$GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
|
227 |
-
if( $GeneralSettingsTemp['blubrry_hosting'] )
|
228 |
{
|
229 |
// Lets try to cache the image onto Blubrry's Server...
|
230 |
$api_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
|
@@ -565,9 +571,6 @@ function powerpress_admin_init()
|
|
565 |
}; break;
|
566 |
}
|
567 |
}
|
568 |
-
|
569 |
-
if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
|
570 |
-
powerpress_admin_players_init();
|
571 |
}
|
572 |
|
573 |
add_action('init', 'powerpress_admin_init');
|
@@ -582,7 +585,7 @@ function powerpress_admin_notices()
|
|
582 |
while( list($null, $error) = each($errors) )
|
583 |
{
|
584 |
?>
|
585 |
-
<div class="updated"><p><strong><?php echo $error; ?></strong></p></div>
|
586 |
<?php
|
587 |
}
|
588 |
}
|
@@ -696,14 +699,11 @@ function powerpress_admin_menu()
|
|
696 |
add_menu_page(__('PowerPress'), __('PowerPress'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic', powerpress_get_root_url() . 'powerpress_ico.png');
|
697 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Basic Settings'), __('Basic Settings'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic' );
|
698 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Appearance Settings'), __('Appearance'), 1, 'powerpress/powerpressadmin_appearance.php', 'powerpress_admin_page_appearance' );
|
699 |
-
if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
|
700 |
-
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Flash Player'), __('Flash Player'), 1, 'powerpress/powerpressadmin_player.php', 'powerpress_admin_page_players');
|
701 |
-
|
702 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress General Feed Settings'), __('Feeds General'), 1, 'powerpress/powerpressadmin_feedsettings.php', 'powerpress_admin_page_feedsettings');
|
703 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Feeds'), __('Custom Feeds'), 1, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
|
704 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcast Feeds'), __('Category Feeds'), 1, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
|
705 |
-
|
706 |
-
|
707 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Tools'), __('Tools'), 1, 'powerpress/powerpressadmin_tools.php', 'powerpress_admin_page_tools');
|
708 |
}
|
709 |
else
|
@@ -907,7 +907,7 @@ function powerpress_edit_post($post_ID, $post)
|
|
907 |
// Anytime the post is marked published, private or scheduled for the future we need to make sure we're making the media available for hosting
|
908 |
if( $post->post_status == 'publish' || $post->post_status == 'private' || $post->post_status == 'future' )
|
909 |
{
|
910 |
-
if( $GeneralSettings['blubrry_hosting'] )
|
911 |
powerpress_process_hosting($post_ID, $post->post_title); // Call anytime blog post is in the published state
|
912 |
}
|
913 |
|
@@ -916,6 +916,47 @@ function powerpress_edit_post($post_ID, $post)
|
|
916 |
|
917 |
add_action('edit_post', 'powerpress_edit_post', 10, 2);
|
918 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
919 |
// Do the iTunes pinging here...
|
920 |
function powerpress_publish_post($post_id)
|
921 |
{
|
@@ -1134,22 +1175,26 @@ function powerpress_check_url(url)
|
|
1134 |
add_action('admin_head', 'powerpress_admin_head');
|
1135 |
|
1136 |
// Admin page, header
|
1137 |
-
function powerpress_admin_page_header($page=false, $nonce_field = 'powerpress-edit')
|
1138 |
{
|
1139 |
if( !$page )
|
1140 |
$page = 'powerpress/powerpressadmin_basic.php';
|
1141 |
?>
|
1142 |
<div class="wrap" id="powerpress_settings">
|
1143 |
-
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('admin.php?page='.$page) ?>">
|
1144 |
<?php
|
1145 |
if( $nonce_field )
|
|
|
|
|
|
|
|
|
1146 |
wp_nonce_field($nonce_field);
|
|
|
1147 |
|
1148 |
powerpress_page_message_print();
|
1149 |
}
|
1150 |
|
1151 |
// Admin page, footer
|
1152 |
-
function powerpress_admin_page_footer($SaveButton=true)
|
1153 |
{
|
1154 |
if( $SaveButton ) { ?>
|
1155 |
<p class="submit">
|
@@ -1162,7 +1207,8 @@ function powerpress_admin_page_footer($SaveButton=true)
|
|
1162 |
<a href="http://forum.blubrry.com/" target="_blank" title="Blubrry Forum">Forum</a> |
|
1163 |
<a href="http://twitter.com/blubrry" target="_blank" title="Follow Blubrry on Twitter">Follow Blubrry on Twitter</a>
|
1164 |
</p>
|
1165 |
-
|
|
|
1166 |
</div>
|
1167 |
<?php
|
1168 |
}
|
@@ -1275,11 +1321,17 @@ function powerpress_admin_page_tools()
|
|
1275 |
powerpress_admin_ping_sites();
|
1276 |
powerpress_admin_page_footer(false);
|
1277 |
}; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
1278 |
default: {
|
1279 |
-
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php');
|
1280 |
require_once( dirname(__FILE__).'/powerpressadmin-tools.php');
|
1281 |
powerpress_admin_tools();
|
1282 |
-
powerpress_admin_page_footer(false);
|
1283 |
};
|
1284 |
}
|
1285 |
}
|
@@ -1300,27 +1352,39 @@ function powerpress_podpress_episodes_exist()
|
|
1300 |
// Admin page, simple mode
|
1301 |
function powerpress_admin_page()
|
1302 |
{
|
1303 |
-
|
1304 |
|
1305 |
$Settings = get_option('powerpress_general');
|
1306 |
-
|
1307 |
-
//exit;
|
1308 |
if( !isset($Settings['advanced_mode']) )
|
1309 |
{
|
|
|
1310 |
require_once( dirname(__FILE__).'/powerpressadmin-mode.php');
|
1311 |
powerpress_admin_mode();
|
1312 |
powerpress_admin_page_footer(false);
|
1313 |
}
|
1314 |
else
|
1315 |
{
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1322 |
|
1323 |
-
|
|
|
|
|
|
|
|
|
|
|
1324 |
}
|
1325 |
}
|
1326 |
|
@@ -1443,8 +1507,16 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
|
|
1443 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
1444 |
curl_setopt($curl, CURLOPT_HEADER, 0);
|
1445 |
if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
|
|
|
1446 |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // Follow location redirection
|
1447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1448 |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
|
1449 |
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
|
1450 |
curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
|
@@ -1990,7 +2062,7 @@ function powerpress_get_media_info_local($media_file, $content_type='', $file_si
|
|
1990 |
{
|
1991 |
// Add a warning that the redirect count exceeded 5, which may prevent some podcatchers from downloading the media.
|
1992 |
powerpress_add_error( sprintf( __('Warning, the Media URL %s contains %d redirects.'), $media_file, $Mp3Info->GetRedirectCount() )
|
1993 |
-
.' [<a href="http://help.blubrry.com/
|
1994 |
);
|
1995 |
}
|
1996 |
|
@@ -1998,6 +2070,13 @@ function powerpress_get_media_info_local($media_file, $content_type='', $file_si
|
|
1998 |
$file_size = $Mp3Info->GetContentLength();
|
1999 |
|
2000 |
$duration = powerpress_readable_duration($Mp3Data['playtime_string'], true); // Fix so it looks better when viewed for editing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001 |
}
|
2002 |
else
|
2003 |
{
|
@@ -2049,8 +2128,5 @@ function powerpress_add_error($error)
|
|
2049 |
require_once( dirname(__FILE__).'/powerpressadmin-jquery.php');
|
2050 |
// Only include the dashboard when appropriate.
|
2051 |
require_once(dirname(__FILE__).'/powerpressadmin-dashboard.php');
|
2052 |
-
if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
|
2053 |
-
require_once(dirname(__FILE__).'/powerpressadmin-player.php');
|
2054 |
-
|
2055 |
|
2056 |
?>
|
63 |
if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
|
64 |
{
|
65 |
check_admin_referer('powerpress-edit');
|
66 |
+
|
67 |
+
$upload_path = false;
|
68 |
+
$upload_url = false;
|
69 |
$UploadArray = wp_upload_dir();
|
70 |
+
if( false === $UploadArray['error'] )
|
71 |
+
{
|
72 |
+
$upload_path = $UploadArray['basedir'].'/powerpress/';
|
73 |
+
$upload_url = $UploadArray['baseurl'].'/powerpress/';
|
74 |
+
}
|
75 |
|
76 |
// Save the posted value in the database
|
77 |
$Feed = $_POST['Feed'];
|
99 |
if( $ImageData && ( $ImageData[2] == IMAGETYPE_JPEG || $ImageData[2] == IMAGETYPE_PNG ) && $ImageData[0] == $ImageData[1] ) // Just check that it is an image, the correct image type and that the image is square
|
100 |
{
|
101 |
move_uploaded_file($temp, $upload_path . $filename);
|
102 |
+
$Feed['itunes_image'] = $upload_url . $filename;
|
103 |
}
|
104 |
else
|
105 |
{
|
125 |
if( getimagesize($temp) ) // Just check that it is an image, we may add more to this later
|
126 |
{
|
127 |
move_uploaded_file($temp, $upload_path . $filename);
|
128 |
+
$Feed['rss2_image'] = $upload_url . $filename;
|
129 |
}
|
130 |
else
|
131 |
{
|
133 |
}
|
134 |
}
|
135 |
|
136 |
+
// New mp3 coverart image
|
137 |
if( @$_POST['coverart_image_checkbox'] == 1 )
|
138 |
{
|
139 |
$filename = str_replace(" ", "_", basename($_FILES['coverart_image_file']['name']) );
|
151 |
if( getimagesize($temp) ) // Just check that it is an image, we may add more to this later
|
152 |
{
|
153 |
move_uploaded_file($temp, $upload_path . $filename);
|
154 |
+
$_POST['TagValues']['tag_coverart'] = $upload_url . $filename;
|
155 |
}
|
156 |
else
|
157 |
{
|
230 |
if( $TagValues['tag_coverart'] != '' )
|
231 |
{
|
232 |
$GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
|
233 |
+
if( isset($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] )
|
234 |
{
|
235 |
// Lets try to cache the image onto Blubrry's Server...
|
236 |
$api_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
|
571 |
}; break;
|
572 |
}
|
573 |
}
|
|
|
|
|
|
|
574 |
}
|
575 |
|
576 |
add_action('init', 'powerpress_admin_init');
|
585 |
while( list($null, $error) = each($errors) )
|
586 |
{
|
587 |
?>
|
588 |
+
<div class="updated"><p style="line-height: 125%;"><strong><?php echo $error; ?></strong></p></div>
|
589 |
<?php
|
590 |
}
|
591 |
}
|
699 |
add_menu_page(__('PowerPress'), __('PowerPress'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic', powerpress_get_root_url() . 'powerpress_ico.png');
|
700 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Basic Settings'), __('Basic Settings'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic' );
|
701 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Appearance Settings'), __('Appearance'), 1, 'powerpress/powerpressadmin_appearance.php', 'powerpress_admin_page_appearance' );
|
|
|
|
|
|
|
702 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress General Feed Settings'), __('Feeds General'), 1, 'powerpress/powerpressadmin_feedsettings.php', 'powerpress_admin_page_feedsettings');
|
703 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Feeds'), __('Custom Feeds'), 1, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
|
704 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcast Feeds'), __('Category Feeds'), 1, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
|
705 |
+
if( isset($Powerpress['blubrry_hosting']) && $Powerpress['blubrry_hosting'] )
|
706 |
+
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress MP3 Tags'), __('MP3 Tags'), 1, 'powerpress/powerpressadmin_tags.php', 'powerpress_admin_page_tags');
|
707 |
add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Tools'), __('Tools'), 1, 'powerpress/powerpressadmin_tools.php', 'powerpress_admin_page_tools');
|
708 |
}
|
709 |
else
|
907 |
// Anytime the post is marked published, private or scheduled for the future we need to make sure we're making the media available for hosting
|
908 |
if( $post->post_status == 'publish' || $post->post_status == 'private' || $post->post_status == 'future' )
|
909 |
{
|
910 |
+
if( isset($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting'] )
|
911 |
powerpress_process_hosting($post_ID, $post->post_title); // Call anytime blog post is in the published state
|
912 |
}
|
913 |
|
916 |
|
917 |
add_action('edit_post', 'powerpress_edit_post', 10, 2);
|
918 |
|
919 |
+
if( defined('POWERPRESS_DO_ENCLOSE_FIX') )
|
920 |
+
{
|
921 |
+
function powerpress_insert_post_data($data, $postarr)
|
922 |
+
{
|
923 |
+
// If we added or modified a podcast episode, then we need to re-add/remove the embedded hidden link...
|
924 |
+
if( isset($_POST['Powerpress']['podcast']) && $postarr['post_type'] == 'post' )
|
925 |
+
{
|
926 |
+
// First, remove the previous comment if one exists in the post body.
|
927 |
+
$data['post_content'] = preg_replace('/\<!--.*added by PowerPress.*-->/im', '', $data['post_content']);
|
928 |
+
|
929 |
+
$Powerpress = $_POST['Powerpress']['podcast'];
|
930 |
+
if( @$Powerpress['remove_podcast'] == 1 )
|
931 |
+
{
|
932 |
+
// Do nothing
|
933 |
+
}
|
934 |
+
else if( @$Powerpress['change_podcast'] == 1 || @$Powerpress['new_podcast'] == 1 )
|
935 |
+
{
|
936 |
+
$MediaURL = $Powerpress['url'];
|
937 |
+
if( strpos($MediaURL, 'http://') !== 0 && strpos($MediaURL, 'https://') !== 0 && $Powerpress['hosting'] != 1 ) // If the url entered does not start with a http:// or https://
|
938 |
+
{
|
939 |
+
// Only glitch here is if the media url had an error, and if that's the case then there are other issues the user needs to worry about.
|
940 |
+
$GeneralSettings = get_option('powerpress_general');
|
941 |
+
if( $GeneralSettings && isset($GeneralSettings['default_url']) )
|
942 |
+
$MediaURL = rtrim(@$GeneralSettings['default_url'], '/') .'/'. ltrim($MediaURL, '/');
|
943 |
+
}
|
944 |
+
|
945 |
+
$data['post_content'] .= "<!-- DO NOT DELETE href=\"$MediaURL\" added by PowerPress to fix WordPress 2.8+ bug -->";
|
946 |
+
}
|
947 |
+
else
|
948 |
+
{
|
949 |
+
$EncloseData = powerpress_get_enclosure_data($postarr['ID']);
|
950 |
+
if( $EncloseData && $EncloseData['url'] )
|
951 |
+
$data['post_content'] .= "<!-- DO NOT DELETE href=\"{$EncloseData['url']}\" added by PowerPress to fix WordPress 2.8+ bug -->";
|
952 |
+
}
|
953 |
+
}
|
954 |
+
|
955 |
+
return $data;
|
956 |
+
}
|
957 |
+
add_filter('wp_insert_post_data', 'powerpress_insert_post_data',1,2);
|
958 |
+
}
|
959 |
+
|
960 |
// Do the iTunes pinging here...
|
961 |
function powerpress_publish_post($post_id)
|
962 |
{
|
1175 |
add_action('admin_head', 'powerpress_admin_head');
|
1176 |
|
1177 |
// Admin page, header
|
1178 |
+
function powerpress_admin_page_header($page=false, $nonce_field = 'powerpress-edit', $simple_mode=false)
|
1179 |
{
|
1180 |
if( !$page )
|
1181 |
$page = 'powerpress/powerpressadmin_basic.php';
|
1182 |
?>
|
1183 |
<div class="wrap" id="powerpress_settings">
|
|
|
1184 |
<?php
|
1185 |
if( $nonce_field )
|
1186 |
+
{
|
1187 |
+
?>
|
1188 |
+
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url( ($simple_mode?'options-general':'admin') .'.php?page='.$page) ?>">
|
1189 |
+
<?php
|
1190 |
wp_nonce_field($nonce_field);
|
1191 |
+
}
|
1192 |
|
1193 |
powerpress_page_message_print();
|
1194 |
}
|
1195 |
|
1196 |
// Admin page, footer
|
1197 |
+
function powerpress_admin_page_footer($SaveButton=true, $form=true)
|
1198 |
{
|
1199 |
if( $SaveButton ) { ?>
|
1200 |
<p class="submit">
|
1207 |
<a href="http://forum.blubrry.com/" target="_blank" title="Blubrry Forum">Forum</a> |
|
1208 |
<a href="http://twitter.com/blubrry" target="_blank" title="Follow Blubrry on Twitter">Follow Blubrry on Twitter</a>
|
1209 |
</p>
|
1210 |
+
<?php if( $form ) { ?>
|
1211 |
+
</form><?php } ?>
|
1212 |
</div>
|
1213 |
<?php
|
1214 |
}
|
1321 |
powerpress_admin_ping_sites();
|
1322 |
powerpress_admin_page_footer(false);
|
1323 |
}; break;
|
1324 |
+
case 'powerpress-diagnostics': {
|
1325 |
+
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php', false);
|
1326 |
+
require_once( dirname(__FILE__).'/powerpressadmin-diagnostics.php');
|
1327 |
+
powerpressadmin_diagnostics();
|
1328 |
+
powerpress_admin_page_footer(false, false);
|
1329 |
+
}; break;
|
1330 |
default: {
|
1331 |
+
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php', false);
|
1332 |
require_once( dirname(__FILE__).'/powerpressadmin-tools.php');
|
1333 |
powerpress_admin_tools();
|
1334 |
+
powerpress_admin_page_footer(false, false);
|
1335 |
};
|
1336 |
}
|
1337 |
}
|
1352 |
// Admin page, simple mode
|
1353 |
function powerpress_admin_page()
|
1354 |
{
|
1355 |
+
|
1356 |
|
1357 |
$Settings = get_option('powerpress_general');
|
1358 |
+
|
|
|
1359 |
if( !isset($Settings['advanced_mode']) )
|
1360 |
{
|
1361 |
+
powerpress_admin_page_header(false, 'powerpress-edit', true);
|
1362 |
require_once( dirname(__FILE__).'/powerpressadmin-mode.php');
|
1363 |
powerpress_admin_mode();
|
1364 |
powerpress_admin_page_footer(false);
|
1365 |
}
|
1366 |
else
|
1367 |
{
|
1368 |
+
if( $_GET['action'] == 'powerpress-diagnostics' )
|
1369 |
+
{
|
1370 |
+
powerpress_admin_page_header(false, false);
|
1371 |
+
require_once( dirname(__FILE__).'/powerpressadmin-diagnostics.php');
|
1372 |
+
powerpressadmin_diagnostics();
|
1373 |
+
powerpress_admin_page_footer(false, false);
|
1374 |
+
}
|
1375 |
+
else
|
1376 |
+
{
|
1377 |
+
// Simple mode:
|
1378 |
+
powerpress_admin_page_header(false, 'powerpress-edit', true);
|
1379 |
+
require_once( dirname(__FILE__).'/powerpressadmin-basic.php');
|
1380 |
+
powerpress_admin_basic();
|
1381 |
|
1382 |
+
require_once( dirname(__FILE__).'/powerpressadmin-editfeed.php');
|
1383 |
+
powerpress_admin_editfeed();
|
1384 |
+
|
1385 |
+
powerpress_admin_basic_diagnostics();
|
1386 |
+
powerpress_admin_page_footer(true);
|
1387 |
+
}
|
1388 |
}
|
1389 |
}
|
1390 |
|
1507 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
1508 |
curl_setopt($curl, CURLOPT_HEADER, 0);
|
1509 |
if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
|
1510 |
+
{
|
1511 |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // Follow location redirection
|
1512 |
+
curl_setopt($curl, CURLOPT_MAXREDIRS, 12); // Location redirection limit
|
1513 |
+
}
|
1514 |
+
else
|
1515 |
+
{
|
1516 |
+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
|
1517 |
+
curl_setopt($curl, CURLOPT_MAXREDIRS, 0 );
|
1518 |
+
}
|
1519 |
+
|
1520 |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
|
1521 |
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
|
1522 |
curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
|
2062 |
{
|
2063 |
// Add a warning that the redirect count exceeded 5, which may prevent some podcatchers from downloading the media.
|
2064 |
powerpress_add_error( sprintf( __('Warning, the Media URL %s contains %d redirects.'), $media_file, $Mp3Info->GetRedirectCount() )
|
2065 |
+
.' [<a href="http://help.blubrry.com/blubrry-powerpress/errors-and-warnings/" title="'. __('Help') .'" target="_blank">'. __('Help') .'</a>]'
|
2066 |
);
|
2067 |
}
|
2068 |
|
2070 |
$file_size = $Mp3Info->GetContentLength();
|
2071 |
|
2072 |
$duration = powerpress_readable_duration($Mp3Data['playtime_string'], true); // Fix so it looks better when viewed for editing
|
2073 |
+
|
2074 |
+
if( count( $Mp3Info->GetWarnings() ) > 0 )
|
2075 |
+
{
|
2076 |
+
$Warnings = $Mp3Info->GetWarnings();
|
2077 |
+
while( list($null, $warning) = each($Warnings) )
|
2078 |
+
powerpress_add_error( sprintf( __('Warning, Media URL %s:'), $media_file) .' '. $warning .' [<a href="http://help.blubrry.com/blubrry-powerpress/errors-and-warnings/" title="'. __('Help') .'" target="_blank">'. __('Help') .'</a>]' );
|
2079 |
+
}
|
2080 |
}
|
2081 |
else
|
2082 |
{
|
2128 |
require_once( dirname(__FILE__).'/powerpressadmin-jquery.php');
|
2129 |
// Only include the dashboard when appropriate.
|
2130 |
require_once(dirname(__FILE__).'/powerpressadmin-dashboard.php');
|
|
|
|
|
|
|
2131 |
|
2132 |
?>
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
=== Podcasting - Blubrry PowerPress Podcast plugin ===
|
2 |
Contributors: Angelo Mandato, Blubrry.com
|
3 |
-
Tags: podcast,
|
4 |
Requires at least: 2.6.0
|
5 |
Tested up to: 2.8.4
|
6 |
-
Stable tag: 0.9.
|
7 |
|
8 |
Add podcasting support to your blog.
|
9 |
|
10 |
== Description ==
|
11 |
-
|
12 |
|
13 |
For users who feel the plugin is too complicated, we've included a Simple Mode. Simple Mode only includes the essential features to your blog to support podcasting.
|
14 |
|
@@ -53,18 +53,18 @@ http://help.blubrry.com/blubrry-powerpress/
|
|
53 |
|
54 |
== Frequently Asked Questions ==
|
55 |
|
56 |
-
= Why doesn't Blubrry PowerPress support multiple enclosures? =
|
57 |
Blubrry PowerPress does not allow you to include multiple media files for one feed item (blog post). This is because each podcatcher handles multiple enclosures in feeds differently. iTunes will download the first enclosure that it sees in the feed ignoring the rest. Other podcatchers and podcasting directories either pick up the first enclosure or the last in each post item. This inconsistency combined with the fact that [Dave Winer does not recommend multiple enclosures](http://www.reallysimplesyndication.com/2004/12/21) and the [FeedValidator.org recommendation against it](http://www.feedvalidator.org/docs/warning/DuplicateEnclosure.html) is why the Blubrry PowerPress does not support them.
|
58 |
|
59 |
-
As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate
|
60 |
|
61 |
= Why doesn't Blubrry PowerPress include media statistics built-in? =
|
62 |
-
Blubrry PowerPress does not include media statistics built-in. This is not because Blubrry has its own statistics service, although that's a good reason by itself. Maintaining and calculating statistics is a resource and server intensive task that would add bloat to an otherwise efficient
|
63 |
|
64 |
As of Blubrry PowerPress version 0.8, you may now access your Blubrry Statistics from within your WordPress dashboard.
|
65 |
|
66 |
= How do you insert the player within a blog post? =
|
67 |
-
|
68 |
|
69 |
You may use the shortcode to add a player to other media files (non episode files) by specifying the media url in the shortcode: [powerpress url="http://example.com/path/to/media.mp3"]
|
70 |
|
@@ -85,6 +85,24 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 0.9.9 =
|
89 |
* Released on 9/12/2009
|
90 |
* No longer checking content type returned from servers, check effected video podcasters who have no control of their servers.
|
@@ -96,6 +114,7 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
|
|
96 |
* Added wmode: 'transparent' setting to Flash player so pop-up HTML divs can display over top of the flash player.
|
97 |
* Added extra check to prevent page errors when displaying old PodPress data in blog pages.
|
98 |
* Added note in PodPress Import screen: If you are unsure about importing your PodPress data, try the option under Basic Settings titled 'PodPress Episodes' and set to 'Include in posts and feeds'.
|
|
|
99 |
|
100 |
|
101 |
= 0.9.8 =
|
1 |
=== Podcasting - Blubrry PowerPress Podcast plugin ===
|
2 |
Contributors: Angelo Mandato, Blubrry.com
|
3 |
+
Tags: podcasting, podcast, podcaster, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry
|
4 |
Requires at least: 2.6.0
|
5 |
Tested up to: 2.8.4
|
6 |
+
Stable tag: 0.9.10
|
7 |
|
8 |
Add podcasting support to your blog.
|
9 |
|
10 |
== Description ==
|
11 |
+
Blubrry PowerPress podcasting plugin adds all of the essential features for podcasting to WordPress. Developed by podcasters for podcasters, PowerPress goes above and beyond with full iTunes support, Update iTunes listing feature, web audio/video media players and more!
|
12 |
|
13 |
For users who feel the plugin is too complicated, we've included a Simple Mode. Simple Mode only includes the essential features to your blog to support podcasting.
|
14 |
|
53 |
|
54 |
== Frequently Asked Questions ==
|
55 |
|
56 |
+
= Why doesn't Blubrry PowerPress support multiple enclosures in one feed item/post? =
|
57 |
Blubrry PowerPress does not allow you to include multiple media files for one feed item (blog post). This is because each podcatcher handles multiple enclosures in feeds differently. iTunes will download the first enclosure that it sees in the feed ignoring the rest. Other podcatchers and podcasting directories either pick up the first enclosure or the last in each post item. This inconsistency combined with the fact that [Dave Winer does not recommend multiple enclosures](http://www.reallysimplesyndication.com/2004/12/21) and the [FeedValidator.org recommendation against it](http://www.feedvalidator.org/docs/warning/DuplicateEnclosure.html) is why the Blubrry PowerPress does not support them.
|
58 |
|
59 |
+
As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate any magnitude of media format and/or length in a blog post to specific custom feeds. For example, you can create one blog post associated to separate video and audio podcast feeds saving you time from entering your show notes twice.
|
60 |
|
61 |
= Why doesn't Blubrry PowerPress include media statistics built-in? =
|
62 |
+
Blubrry PowerPress does not include media statistics built-in. This is not because Blubrry has its own statistics service, although that's a good reason by itself. Maintaining and calculating statistics is a resource and server intensive task that would add bloat to an otherwise efficient WordPress podcasting plugin. We recommend using your media hosting's web statistics to give you basic download numbers and, if you are seeking more grandular measurements such as client and geographical information for each episode, you're more than welcome to use the [Blubrry Statistics service](http://www.blubrry.com/podcast_statistics/) as well.
|
63 |
|
64 |
As of Blubrry PowerPress version 0.8, you may now access your Blubrry Statistics from within your WordPress dashboard.
|
65 |
|
66 |
= How do you insert the player within a blog post? =
|
67 |
+
You can insert the media player within yoru blog posts by using the WordPress shortcode feature. The shortcode for PowerPress is [powerpress] (all lowercase)
|
68 |
|
69 |
You may use the shortcode to add a player to other media files (non episode files) by specifying the media url in the shortcode: [powerpress url="http://example.com/path/to/media.mp3"]
|
70 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 0.9.10 =
|
89 |
+
* Released on 9/21/2009
|
90 |
+
* Fixed code that detects media information when encountering redirects. Bug only affected users who did not have cURL configured in PHP.
|
91 |
+
* Updated code for obtaining the uploads directory.
|
92 |
+
* 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.
|
93 |
+
* New Diagnostics page accessible via PowerPress > Tools > Diagnostics.
|
94 |
+
* 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.
|
95 |
+
* When 'PodPress Episodes' setting enabled, we now insert a player for the PodPress [display_podcast] shortcode.
|
96 |
+
* To eliminate confusion, the Mp3 Tags settings page does not appear unless you've configured Blubrry Services with hosting.
|
97 |
+
* 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](http://core.trac.wordpress.org/ticket/10511)
|
98 |
+
* Changed language from "Pinging iTunes" to "Update iTunes Listing" to clear up confusion what the feature does.
|
99 |
+
* Shortocde [powerpress] now includes download and play in new window links.
|
100 |
+
* Simplified logic for pulling PodPress stored episode data.
|
101 |
+
* Updated some grammar and setting labels so they are easier to understand.
|
102 |
+
* Fixed bug with the "Use blog post author's name for individual episodes setting".
|
103 |
+
* 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.
|
104 |
+
|
105 |
+
|
106 |
= 0.9.9 =
|
107 |
* Released on 9/12/2009
|
108 |
* No longer checking content type returned from servers, check effected video podcasters who have no control of their servers.
|
114 |
* Added wmode: 'transparent' setting to Flash player so pop-up HTML divs can display over top of the flash player.
|
115 |
* Added extra check to prevent page errors when displaying old PodPress data in blog pages.
|
116 |
* Added note in PodPress Import screen: If you are unsure about importing your PodPress data, try the option under Basic Settings titled 'PodPress Episodes' and set to 'Include in posts and feeds'.
|
117 |
+
* Added logic that detects if `safe_mode` / `open_basedir` are on, to handle redirects directly rather than in the cURL library.
|
118 |
|
119 |
|
120 |
= 0.9.8 =
|