Version Description
Download this release
Release Info
Developer | amandato |
Plugin | PowerPress Podcasting plugin by Blubrry |
Version | 0.7.3 |
Comparing to | |
See all releases |
Code changes from version 0.7.2 to 0.7.3
- mp3info.class.php +4 -2
- powerpress.php +100 -14
- powerpressadmin-appearance.php +1 -0
- powerpressadmin-basic.php +24 -5
- powerpressadmin-editfeed.php +7 -1
- powerpressadmin-mt.php +680 -0
- powerpressadmin-tools.php +7 -2
- powerpressadmin.php +88 -6
- readme.txt +9 -4
mp3info.class.php
CHANGED
@@ -214,7 +214,8 @@
|
|
214 |
curl_setopt($curl, CURLOPT_HEADER, true); // header will be at output
|
215 |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request
|
216 |
curl_setopt($curl, CURLOPT_NOBODY, true );
|
217 |
-
|
|
|
218 |
curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
|
219 |
$Headers = curl_exec($curl);
|
220 |
|
@@ -257,7 +258,8 @@
|
|
257 |
curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
|
258 |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
|
259 |
curl_setopt($curl, CURLOPT_NOBODY, false );
|
260 |
-
|
|
|
261 |
curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
|
262 |
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
263 |
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Range: bytes=0-'.($this->m_DownloadBytesLimit-1) ));
|
214 |
curl_setopt($curl, CURLOPT_HEADER, true); // header will be at output
|
215 |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request
|
216 |
curl_setopt($curl, CURLOPT_NOBODY, true );
|
217 |
+
if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
|
218 |
+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
219 |
curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
|
220 |
$Headers = curl_exec($curl);
|
221 |
|
258 |
curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
|
259 |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
|
260 |
curl_setopt($curl, CURLOPT_NOBODY, false );
|
261 |
+
if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
|
262 |
+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
263 |
curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
|
264 |
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
265 |
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Range: bytes=0-'.($this->m_DownloadBytesLimit-1) ));
|
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 and iTunes integration.
|
6 |
-
Version: 0.7.
|
7 |
Author: Blubrry
|
8 |
Author URI: http://www.blubrry.com/
|
9 |
Change Log:
|
@@ -29,7 +29,7 @@ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
|
|
29 |
*/
|
30 |
|
31 |
// WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
|
32 |
-
define('POWERPRESS_VERSION', '0.7.
|
33 |
|
34 |
/////////////////////////////////////////////////////
|
35 |
// The following define options should be placed in your
|
@@ -62,11 +62,14 @@ if( !defined('POWERPRESS_USE_ONLOAD') ) // Add define('POWERPRESS_USE_ONLOAD', f
|
|
62 |
if( !defined('POWERPRESS_USE_ONLOAD_DELAY') ) // Add define('POWERPRESS_USE_ONLOAD_DELAY', 1000); to your wp-config.php to set a full 1 second delay.
|
63 |
define('POWERPRESS_USE_ONLOAD_DELAY', 500);
|
64 |
|
|
|
|
|
|
|
65 |
// Display custom play image for quicktime media. Applies to on page player only.
|
66 |
//define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
|
67 |
|
68 |
-
if( !defined('
|
69 |
-
define('
|
70 |
|
71 |
// Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
|
72 |
if( !defined('POWERPRESS_LINK_SEPARATOR') )
|
@@ -276,9 +279,9 @@ function powerpress_content($content)
|
|
276 |
return $content;
|
277 |
}//end function
|
278 |
|
279 |
-
add_filter('get_the_excerpt', 'powerpress_content', (
|
280 |
-
add_filter('the_content', 'powerpress_content',
|
281 |
-
add_filter('the_excerpt', 'powerpress_content',
|
282 |
|
283 |
function powerpress_header()
|
284 |
{
|
@@ -287,7 +290,7 @@ function powerpress_header()
|
|
287 |
// PowerPress settings:
|
288 |
$Powerpress = get_option('powerpress_general');
|
289 |
|
290 |
-
if( $Powerpress['player_function'] ) // Don't include the player in the header if it is not needed...
|
291 |
{
|
292 |
$PowerpressPluginURL = powerpress_get_root_url();
|
293 |
?>
|
@@ -331,7 +334,7 @@ function powerpress_rss2_ns()
|
|
331 |
return;
|
332 |
|
333 |
// Okay, lets add the namespace
|
334 |
-
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'.
|
335 |
}
|
336 |
|
337 |
add_action('rss2_ns', 'powerpress_rss2_ns');
|
@@ -352,6 +355,9 @@ function powerpress_rss2_head()
|
|
352 |
if( $CustomFeed )
|
353 |
$Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
|
354 |
}
|
|
|
|
|
|
|
355 |
|
356 |
|
357 |
// We made it this far, lets write stuff to the feed!
|
@@ -420,7 +426,7 @@ function powerpress_rss2_head()
|
|
420 |
echo"\t". '<image>' .PHP_EOL;
|
421 |
echo "\t\t".'<title>' . wp_specialchars( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
|
422 |
echo "\t\t".'<url>' . wp_specialchars($Feed['rss2_image']) . '</url>'.PHP_EOL;
|
423 |
-
echo "\t\t".'<link>'.
|
424 |
echo "\t".'</image>' . PHP_EOL;
|
425 |
}
|
426 |
else // Use the default image
|
@@ -428,7 +434,7 @@ function powerpress_rss2_head()
|
|
428 |
echo"\t". '<image>' .PHP_EOL;
|
429 |
echo "\t\t".'<title>' . wp_specialchars( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
|
430 |
echo "\t\t".'<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>'.PHP_EOL;
|
431 |
-
echo "\t\t".'<link>'.
|
432 |
echo "\t".'</image>' . PHP_EOL;
|
433 |
}
|
434 |
|
@@ -680,7 +686,7 @@ function powerpress_rss2_item()
|
|
680 |
else
|
681 |
echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value(powerpress_smart_trim($content_no_html, 250, true)) .'</itunes:subtitle>'.PHP_EOL;
|
682 |
|
683 |
-
if( $powerpress_feed['enhance_itunes_summary'] )
|
684 |
echo "\t\t<itunes:summary>". powerpress_itunes_summary($post->post_content) .'</itunes:summary>'.PHP_EOL;
|
685 |
else if( $summary )
|
686 |
echo "\t\t<itunes:summary>". powerpress_format_itunes_value(powerpress_smart_trim($summary, 4000), 4000) .'</itunes:summary>'.PHP_EOL;
|
@@ -693,7 +699,7 @@ function powerpress_rss2_item()
|
|
693 |
if( $explicit )
|
694 |
echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
|
695 |
|
696 |
-
if( $duration && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', $duration) ) // Include duration if it is valid
|
697 |
echo "\t\t<itunes:duration>" . ltrim($duration, '0:') . '</itunes:duration>'.PHP_EOL;
|
698 |
|
699 |
if( $block && $block == 'yes' )
|
@@ -1039,11 +1045,91 @@ function powerpress_wp_footer()
|
|
1039 |
if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
|
1040 |
add_action('wp_footer', 'powerpress_wp_footer');
|
1041 |
|
1042 |
-
|
1043 |
/*
|
1044 |
Helper functions:
|
1045 |
*/
|
1046 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1047 |
function powerpress_itunes_summary($html)
|
1048 |
{
|
1049 |
// Do some smart conversion of the post html to readable text without HTML.
|
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 and iTunes integration.
|
6 |
+
Version: 0.7.3
|
7 |
Author: Blubrry
|
8 |
Author URI: http://www.blubrry.com/
|
9 |
Change Log:
|
29 |
*/
|
30 |
|
31 |
// WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
|
32 |
+
define('POWERPRESS_VERSION', '0.7.3' );
|
33 |
|
34 |
/////////////////////////////////////////////////////
|
35 |
// The following define options should be placed in your
|
62 |
if( !defined('POWERPRESS_USE_ONLOAD_DELAY') ) // Add define('POWERPRESS_USE_ONLOAD_DELAY', 1000); to your wp-config.php to set a full 1 second delay.
|
63 |
define('POWERPRESS_USE_ONLOAD_DELAY', 500);
|
64 |
|
65 |
+
if( !defined('POWERPRESS_BLUBRRY_API_URL') ) // Add define('POWERPRESS_USE_ONLOAD_DELAY', 1000); to your wp-config.php to set a full 1 second delay.
|
66 |
+
define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
|
67 |
+
|
68 |
// Display custom play image for quicktime media. Applies to on page player only.
|
69 |
//define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
|
70 |
|
71 |
+
if( !defined('POWERPRESS_CONTENT_ACTION_PRIORITY') )
|
72 |
+
define('POWERPRESS_CONTENT_ACTION_PRIORITY', 10 );
|
73 |
|
74 |
// Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
|
75 |
if( !defined('POWERPRESS_LINK_SEPARATOR') )
|
279 |
return $content;
|
280 |
}//end function
|
281 |
|
282 |
+
add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
|
283 |
+
add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
|
284 |
+
add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
|
285 |
|
286 |
function powerpress_header()
|
287 |
{
|
290 |
// PowerPress settings:
|
291 |
$Powerpress = get_option('powerpress_general');
|
292 |
|
293 |
+
if( !isset($Powerpress['player_function']) || $Powerpress['player_function'] > 0 ) // Don't include the player in the header if it is not needed...
|
294 |
{
|
295 |
$PowerpressPluginURL = powerpress_get_root_url();
|
296 |
?>
|
334 |
return;
|
335 |
|
336 |
// Okay, lets add the namespace
|
337 |
+
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'.PHP_EOL;
|
338 |
}
|
339 |
|
340 |
add_action('rss2_ns', 'powerpress_rss2_ns');
|
355 |
if( $CustomFeed )
|
356 |
$Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
|
357 |
}
|
358 |
+
|
359 |
+
if( !isset($Feed['url']) || trim($Feed['url']) == '' )
|
360 |
+
$Feed['url'] = get_bloginfo('url');
|
361 |
|
362 |
|
363 |
// We made it this far, lets write stuff to the feed!
|
426 |
echo"\t". '<image>' .PHP_EOL;
|
427 |
echo "\t\t".'<title>' . wp_specialchars( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
|
428 |
echo "\t\t".'<url>' . wp_specialchars($Feed['rss2_image']) . '</url>'.PHP_EOL;
|
429 |
+
echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
|
430 |
echo "\t".'</image>' . PHP_EOL;
|
431 |
}
|
432 |
else // Use the default image
|
434 |
echo"\t". '<image>' .PHP_EOL;
|
435 |
echo "\t\t".'<title>' . wp_specialchars( get_bloginfo_rss('name') . get_wp_title_rss() ) . '</title>'.PHP_EOL;
|
436 |
echo "\t\t".'<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>'.PHP_EOL;
|
437 |
+
echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
|
438 |
echo "\t".'</image>' . PHP_EOL;
|
439 |
}
|
440 |
|
686 |
else
|
687 |
echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value(powerpress_smart_trim($content_no_html, 250, true)) .'</itunes:subtitle>'.PHP_EOL;
|
688 |
|
689 |
+
if( !isset($powerpress_feed['enhance_itunes_summary']) || $powerpress_feed['enhance_itunes_summary'] )
|
690 |
echo "\t\t<itunes:summary>". powerpress_itunes_summary($post->post_content) .'</itunes:summary>'.PHP_EOL;
|
691 |
else if( $summary )
|
692 |
echo "\t\t<itunes:summary>". powerpress_format_itunes_value(powerpress_smart_trim($summary, 4000), 4000) .'</itunes:summary>'.PHP_EOL;
|
699 |
if( $explicit )
|
700 |
echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
|
701 |
|
702 |
+
if( $duration && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', ltrim($duration, '0:') ) ) // Include duration if it is valid
|
703 |
echo "\t\t<itunes:duration>" . ltrim($duration, '0:') . '</itunes:duration>'.PHP_EOL;
|
704 |
|
705 |
if( $block && $block == 'yes' )
|
1045 |
if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
|
1046 |
add_action('wp_footer', 'powerpress_wp_footer');
|
1047 |
|
|
|
1048 |
/*
|
1049 |
Helper functions:
|
1050 |
*/
|
1051 |
|
1052 |
+
// Add types that are missing from the default wp_check_filetype function
|
1053 |
+
function powerpress_check_filetype($file)
|
1054 |
+
{
|
1055 |
+
$parts = pathinfo($file);
|
1056 |
+
switch( strtolower($parts['extension']) )
|
1057 |
+
{
|
1058 |
+
// Audio formats
|
1059 |
+
case 'mp3': // most common
|
1060 |
+
case 'mpga':
|
1061 |
+
case 'mp2':
|
1062 |
+
case 'mp2a':
|
1063 |
+
case 'm2a':
|
1064 |
+
case 'm3a':
|
1065 |
+
return 'audio/mpeg';
|
1066 |
+
case 'm4a':
|
1067 |
+
return 'audio/x-m4a';
|
1068 |
+
case 'ogg':
|
1069 |
+
return 'audio/ogg';
|
1070 |
+
case 'wma':
|
1071 |
+
return 'audio/x-ms-wma';
|
1072 |
+
case 'wax':
|
1073 |
+
return 'audio/x-ms-wax';
|
1074 |
+
case 'ra':
|
1075 |
+
case 'ram':
|
1076 |
+
return 'audio/x-pn-realaudio';
|
1077 |
+
case 'mp4a':
|
1078 |
+
return 'audio/mp4';
|
1079 |
+
|
1080 |
+
// Video formats
|
1081 |
+
case 'm4v':
|
1082 |
+
return 'video/x-m4v';
|
1083 |
+
case 'mpeg':
|
1084 |
+
case 'mpg':
|
1085 |
+
case 'mpe':
|
1086 |
+
case 'm1v':
|
1087 |
+
case 'm2v':
|
1088 |
+
return 'video/mpeg';
|
1089 |
+
case 'mp4':
|
1090 |
+
case 'mp4v':
|
1091 |
+
case 'mpg4':
|
1092 |
+
return 'video/mp4';
|
1093 |
+
case 'asf':
|
1094 |
+
case 'asx':
|
1095 |
+
return 'video/x-ms-asf';
|
1096 |
+
case 'wmx':
|
1097 |
+
return 'video/x-ms-wmx';
|
1098 |
+
case 'avi':
|
1099 |
+
return 'video/x-msvideo';
|
1100 |
+
case 'wmv':
|
1101 |
+
return 'video/x-ms-wmv'; // Check this
|
1102 |
+
case 'flv':
|
1103 |
+
return 'video/x-flv';
|
1104 |
+
case 'swf':
|
1105 |
+
return 'application/x-shockwave-flash';
|
1106 |
+
case 'mov':
|
1107 |
+
case 'qt':
|
1108 |
+
return 'video/quicktime';
|
1109 |
+
case 'divx':
|
1110 |
+
return 'video/divx';
|
1111 |
+
case '3gp':
|
1112 |
+
return 'video/3gpp';
|
1113 |
+
|
1114 |
+
// rarely used
|
1115 |
+
case 'mid':
|
1116 |
+
case 'midi':
|
1117 |
+
return'audio/midi';
|
1118 |
+
case 'wav':
|
1119 |
+
return 'audio/wav';
|
1120 |
+
case 'aa':
|
1121 |
+
return 'audio/audible';
|
1122 |
+
case 'pdf':
|
1123 |
+
return 'application/pdf';
|
1124 |
+
case 'torrent':
|
1125 |
+
return 'application/x-bittorrent';
|
1126 |
+
default: // Let it fall through
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
// Last case let wordpress detect it:
|
1130 |
+
return wp_check_filetype($file);
|
1131 |
+
}
|
1132 |
+
|
1133 |
function powerpress_itunes_summary($html)
|
1134 |
{
|
1135 |
// Do some smart conversion of the post html to readable text without HTML.
|
powerpressadmin-appearance.php
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
function powerpressadmin_appearance()
|
5 |
{
|
6 |
$General = powerpress_get_settings('powerpress_general');
|
|
|
7 |
?>
|
8 |
<input type="hidden" name="action" value="powerpress-save-appearance" />
|
9 |
<h2><?php echo __("Appearance Settings"); ?></h2>
|
4 |
function powerpressadmin_appearance()
|
5 |
{
|
6 |
$General = powerpress_get_settings('powerpress_general');
|
7 |
+
$General = powerpress_default_settings($General, 'appearance');
|
8 |
?>
|
9 |
<input type="hidden" name="action" value="powerpress-save-appearance" />
|
10 |
<h2><?php echo __("Appearance Settings"); ?></h2>
|
powerpressadmin-basic.php
CHANGED
@@ -4,7 +4,26 @@ function powerpress_admin_basic()
|
|
4 |
{
|
5 |
$General = powerpress_get_settings('powerpress_general');
|
6 |
$AdvancedMode = $General['advanced_mode'];
|
|
|
7 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<input type="hidden" name="action" value="powerpress-save-basic" />
|
9 |
<h2><?php echo __("Basic Settings"); ?></h2>
|
10 |
|
@@ -136,13 +155,13 @@ while( list($value,$desc) = each($options) )
|
|
136 |
<td>
|
137 |
|
138 |
<ul>
|
139 |
-
<li><label><input type="radio" name="General[episode_box_mode]" value="0" <?php if( $General['episode_box_mode'] == 0 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='block';" /> Normal
|
140 |
<li>
|
141 |
<ul>
|
142 |
<li>Episode entry box includes Media URL, File Size and Duration fields.</li>
|
143 |
</ul>
|
144 |
</li>
|
145 |
-
<li><label><input type="radio" name="General[episode_box_mode]" value="1" <?php if( $General['episode_box_mode'] == 1 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='none';" /> Simple
|
146 |
<li>
|
147 |
<ul>
|
148 |
<li>Episode entry box includes Media URL field only. File Size and Duration will be auto detected.</li>
|
@@ -208,7 +227,7 @@ Enter your Redirect URL issued by your media statistics service provider below.
|
|
208 |
<?php _e("Redirect URL 1"); ?>
|
209 |
</th>
|
210 |
<td>
|
211 |
-
<input type="text" style="width: 60%;" name="General[redirect1]" value="<?php echo $General['redirect1']; ?>" maxlength="250" />
|
212 |
<!-- <div style="margin-left: 2px;margin-top: 0;">Enter your issued Blubrry Statistics Redirect URL above.</div> -->
|
213 |
</td>
|
214 |
</tr>
|
@@ -227,7 +246,7 @@ Enter your Redirect URL issued by your media statistics service provider below.
|
|
227 |
<?php _e("Redirect URL 2"); ?>
|
228 |
</th>
|
229 |
<td>
|
230 |
-
<input type="text" style="width: 60%;" name="General[redirect2]" value="<?php echo $General['redirect2']; ?>" maxlength="250" />
|
231 |
</td>
|
232 |
</tr>
|
233 |
</table>
|
@@ -245,7 +264,7 @@ Enter your Redirect URL issued by your media statistics service provider below.
|
|
245 |
<?php _e("Redirect URL 3"); ?>
|
246 |
</th>
|
247 |
<td>
|
248 |
-
<input type="text" style="width: 60%;" name="General[redirect3]" value="<?php echo $General['redirect3']; ?>" maxlength="250" />
|
249 |
</td>
|
250 |
</tr>
|
251 |
</table>
|
4 |
{
|
5 |
$General = powerpress_get_settings('powerpress_general');
|
6 |
$AdvancedMode = $General['advanced_mode'];
|
7 |
+
$General = powerpress_default_settings($General, 'basic');
|
8 |
?>
|
9 |
+
<script type="text/javascript">
|
10 |
+
function CheckRedirect(obj)
|
11 |
+
{
|
12 |
+
if( obj.value )
|
13 |
+
{
|
14 |
+
if( obj.value.indexOf('rawvoice') == -1 && obj.value.indexOf('techpodcasts') == -1 &&
|
15 |
+
obj.value.indexOf('blubrry') == -1 && obj.value.indexOf('podtrac') == -1 )
|
16 |
+
{
|
17 |
+
if( !confirm('The redirect entered is not recongized as a supported statistics redirect service.\n\nAre you sure you wish to continue with this redirect url?') )
|
18 |
+
{
|
19 |
+
obj.value = '';
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return true;
|
25 |
+
}
|
26 |
+
</script>
|
27 |
<input type="hidden" name="action" value="powerpress-save-basic" />
|
28 |
<h2><?php echo __("Basic Settings"); ?></h2>
|
29 |
|
155 |
<td>
|
156 |
|
157 |
<ul>
|
158 |
+
<li><label><input type="radio" name="General[episode_box_mode]" value="0" <?php if( $General['episode_box_mode'] == 0 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='block';" /> Normal</label> (default)</li>
|
159 |
<li>
|
160 |
<ul>
|
161 |
<li>Episode entry box includes Media URL, File Size and Duration fields.</li>
|
162 |
</ul>
|
163 |
</li>
|
164 |
+
<li><label><input type="radio" name="General[episode_box_mode]" value="1" <?php if( $General['episode_box_mode'] == 1 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='none';" /> Simple</label></li>
|
165 |
<li>
|
166 |
<ul>
|
167 |
<li>Episode entry box includes Media URL field only. File Size and Duration will be auto detected.</li>
|
227 |
<?php _e("Redirect URL 1"); ?>
|
228 |
</th>
|
229 |
<td>
|
230 |
+
<input type="text" style="width: 60%;" name="General[redirect1]" value="<?php echo $General['redirect1']; ?>" onChange="return CheckRedirect(this);" maxlength="250" />
|
231 |
<!-- <div style="margin-left: 2px;margin-top: 0;">Enter your issued Blubrry Statistics Redirect URL above.</div> -->
|
232 |
</td>
|
233 |
</tr>
|
246 |
<?php _e("Redirect URL 2"); ?>
|
247 |
</th>
|
248 |
<td>
|
249 |
+
<input type="text" style="width: 60%;" name="General[redirect2]" value="<?php echo $General['redirect2']; ?>" onblur="return CheckRedirect(this);" maxlength="250" />
|
250 |
</td>
|
251 |
</tr>
|
252 |
</table>
|
264 |
<?php _e("Redirect URL 3"); ?>
|
265 |
</th>
|
266 |
<td>
|
267 |
+
<input type="text" style="width: 60%;" name="General[redirect3]" value="<?php echo $General['redirect3']; ?>" onblur="return CheckRedirect(this);" maxlength="250" />
|
268 |
</td>
|
269 |
</tr>
|
270 |
</table>
|
powerpressadmin-editfeed.php
CHANGED
@@ -11,6 +11,8 @@ function powerpress_admin_editfeed($feed_slug=false)
|
|
11 |
$SupportUploads = true;
|
12 |
|
13 |
$General = powerpress_get_settings('powerpress_general');
|
|
|
|
|
14 |
if( $feed_slug )
|
15 |
{
|
16 |
$FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
|
@@ -19,10 +21,12 @@ function powerpress_admin_editfeed($feed_slug=false)
|
|
19 |
$FeedSettings = array();
|
20 |
$FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
|
21 |
}
|
|
|
22 |
}
|
23 |
else
|
24 |
{
|
25 |
$FeedSettings = powerpress_get_settings('powerpress_feed');
|
|
|
26 |
}
|
27 |
|
28 |
$FeedTitle = __('Feed Settings');
|
@@ -220,7 +224,9 @@ else
|
|
220 |
<input type="text" name="Feed[itunes_subtitle]"style="width: 60%;" value="<?php echo $FeedSettings['itunes_subtitle']; ?>" maxlength="250" />
|
221 |
</td>
|
222 |
</tr>
|
223 |
-
<?php } // End AdvancedMode ?>
|
|
|
|
|
224 |
|
225 |
<tr valign="top">
|
226 |
<th scope="row">
|
11 |
$SupportUploads = true;
|
12 |
|
13 |
$General = powerpress_get_settings('powerpress_general');
|
14 |
+
|
15 |
+
|
16 |
if( $feed_slug )
|
17 |
{
|
18 |
$FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
|
21 |
$FeedSettings = array();
|
22 |
$FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
|
23 |
}
|
24 |
+
$FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
|
25 |
}
|
26 |
else
|
27 |
{
|
28 |
$FeedSettings = powerpress_get_settings('powerpress_feed');
|
29 |
+
$FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
|
30 |
}
|
31 |
|
32 |
$FeedTitle = __('Feed Settings');
|
224 |
<input type="text" name="Feed[itunes_subtitle]"style="width: 60%;" value="<?php echo $FeedSettings['itunes_subtitle']; ?>" maxlength="250" />
|
225 |
</td>
|
226 |
</tr>
|
227 |
+
<?php } else { // End AdvancedMode ?>
|
228 |
+
<input type="hidden" name="Feed[enhance_itunes_summary]" value="<?php echo ($FeedSettings['enhance_itunes_summary']?'1':'0'); ?>" />
|
229 |
+
<?php } ?>
|
230 |
|
231 |
<tr valign="top">
|
232 |
<th scope="row">
|
powerpressadmin-mt.php
ADDED
@@ -0,0 +1,680 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// powerpressadmin-mt.php
|
3 |
+
|
4 |
+
function powerpress_get_mt_episodes()
|
5 |
+
{
|
6 |
+
global $wpdb;
|
7 |
+
|
8 |
+
$return = array();
|
9 |
+
$return['feeds_required'] = 0;
|
10 |
+
|
11 |
+
$query = "SELECT p.ID, p.post_title, p.post_date, p.post_content ";
|
12 |
+
$query .= "FROM {$wpdb->posts} AS p ";
|
13 |
+
$query .= "WHERE 1 ";
|
14 |
+
$query .= "AND p.post_type != 'revision' ";
|
15 |
+
$query .= "ORDER BY p.post_date DESC ";
|
16 |
+
|
17 |
+
$results_data = $wpdb->get_results($query, ARRAY_A); // This could return a lot of data...
|
18 |
+
if( $results_data )
|
19 |
+
{
|
20 |
+
while( list($null,$row) = each($results_data) )
|
21 |
+
{
|
22 |
+
$Media = powerpressadmin_mt_media_from_content($row['post_content']);
|
23 |
+
if( count($Media) == 0 )
|
24 |
+
continue;
|
25 |
+
|
26 |
+
if( $return['feeds_required'] < count( $Media ) )
|
27 |
+
$return['feeds_required'] = count( $Media );
|
28 |
+
$return[ $row['ID'] ] = array();
|
29 |
+
$return[ $row['ID'] ]['post_title'] = $row['post_title'];
|
30 |
+
$return[ $row['ID'] ]['post_date'] = $row['post_date'];
|
31 |
+
while( list($index,$url) = each($Media) )
|
32 |
+
$return[ $row['ID'] ]['enclosures'][$index]['url'] = $url;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
return $return;
|
36 |
+
}
|
37 |
+
|
38 |
+
function powerpressadmin_mt_is_media($url)
|
39 |
+
{
|
40 |
+
global $g_import_mt_extensions;
|
41 |
+
|
42 |
+
$partsURL = @parse_url( trim($url) );
|
43 |
+
if( !$partsURL )
|
44 |
+
return false;
|
45 |
+
$filename = substr($partsURL['path'], strrpos($partsURL['path'], '/')+1 );
|
46 |
+
$partsFile = pathinfo($filename);
|
47 |
+
|
48 |
+
if( isset($_GET['include_only_ext']) && trim($_GET['include_only_ext']) != '' )
|
49 |
+
{
|
50 |
+
$extensions = strtolower(preg_replace("/\s/", '', $_GET['include_only_ext']));
|
51 |
+
$ext_array = split(',', trim($extensions, ',') );
|
52 |
+
if( in_array( strtolower($partsFile['extension']), $ext_array ) )
|
53 |
+
{
|
54 |
+
if( !isset($g_import_mt_extensions[ strtolower($partsFile['extension']) ]) )
|
55 |
+
$g_import_mt_extensions[ strtolower($partsFile['extension']) ] = true;
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
switch( strtolower($partsFile['extension']) )
|
62 |
+
{
|
63 |
+
// Audio formats
|
64 |
+
case 'mp3': // most common
|
65 |
+
case 'mpga':
|
66 |
+
case 'mp2':
|
67 |
+
case 'mp2a':
|
68 |
+
case 'm2a':
|
69 |
+
case 'm3a':
|
70 |
+
case 'm4a':
|
71 |
+
case 'ogg':
|
72 |
+
case 'wma':
|
73 |
+
case 'wax':
|
74 |
+
case 'ra':
|
75 |
+
case 'ram':
|
76 |
+
case 'mp4a':
|
77 |
+
|
78 |
+
// Video formats
|
79 |
+
case 'm4v':
|
80 |
+
case 'mpeg':
|
81 |
+
case 'mpg':
|
82 |
+
case 'mpe':
|
83 |
+
case 'm1v':
|
84 |
+
case 'm2v':
|
85 |
+
case 'mp4':
|
86 |
+
case 'mp4v':
|
87 |
+
case 'mpg4':
|
88 |
+
case 'asf':
|
89 |
+
case 'asx':
|
90 |
+
case 'wmx':
|
91 |
+
case 'avi':
|
92 |
+
case 'wmv':
|
93 |
+
case 'flv':
|
94 |
+
case 'mov':
|
95 |
+
case 'qt':
|
96 |
+
case 'divx':
|
97 |
+
case '3gp':
|
98 |
+
|
99 |
+
// rarely used
|
100 |
+
case 'mid':
|
101 |
+
case 'midi':
|
102 |
+
case 'wav':
|
103 |
+
case 'aa':
|
104 |
+
case 'torrent':
|
105 |
+
{
|
106 |
+
if( !isset($g_import_mt_extensions[ strtolower($partsFile['extension']) ]) )
|
107 |
+
$g_import_mt_extensions[ strtolower($partsFile['extension']) ] = true;
|
108 |
+
return true;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
function powerpressadmin_mt_media_from_content($content)
|
116 |
+
{
|
117 |
+
$return = array();
|
118 |
+
//$content = '<a href="http://www.test.com/test1.mp3">test1<a/> http://www.test.com/test2.mp3 http://www.test.com/test2.exe <a href="http://www.test.com/test3.mp3"></a>';
|
119 |
+
$ltrs = '\w';
|
120 |
+
$gunk = '/#~:.?+=&%@!\-';
|
121 |
+
$punc = '.:?\-';
|
122 |
+
$any = $ltrs . $gunk . $punc;
|
123 |
+
|
124 |
+
preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp );
|
125 |
+
while( list($null,$url) = each($post_links_temp[0]) )
|
126 |
+
{
|
127 |
+
if( powerpressadmin_mt_is_media($url) )
|
128 |
+
{
|
129 |
+
if( !in_array($url, $return) )
|
130 |
+
$return[] = $url;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
return $return;
|
135 |
+
}
|
136 |
+
|
137 |
+
function powerpressadmin_mt_do_import()
|
138 |
+
{
|
139 |
+
$Import = $_POST['Import'];
|
140 |
+
$Media = $_POST['Media'];
|
141 |
+
$Titles = $_POST['Titles'];
|
142 |
+
|
143 |
+
set_time_limit(60 + (10* count($Import)) );
|
144 |
+
$DetectDuration = ($_POST['DetectDuration']?$_POST['DetectDuration']:0);
|
145 |
+
|
146 |
+
if( $DetectDuration )
|
147 |
+
{
|
148 |
+
require_once('mp3info.class.php');
|
149 |
+
$Mp3Info = new Mp3Info();
|
150 |
+
}
|
151 |
+
|
152 |
+
while( list($post_id, $episode_feeds) = each($Import) )
|
153 |
+
{
|
154 |
+
while( list($media_index, $feed_slug) = each($episode_feeds) )
|
155 |
+
{
|
156 |
+
if( $feed_slug == '' )
|
157 |
+
continue; // User decoded not to import this one..
|
158 |
+
$url = $Media[$post_id][$media_index];
|
159 |
+
//$headers = wp_remote_head($url);
|
160 |
+
//$response = wp_remote_request($url, $options);
|
161 |
+
$response = wp_remote_head( $url );
|
162 |
+
$headers = wp_remote_retrieve_headers( $response );
|
163 |
+
|
164 |
+
if ( is_wp_error( $response ) )
|
165 |
+
{
|
166 |
+
powerpressadmin_mt_import_log($Titles[ $post_id ], $EpisodeData['url'], $feed_slug, 'A system error occurred.');
|
167 |
+
}
|
168 |
+
else if( $headers && $response['response']['code'] >= 200 && $response['response']['code'] < 300 )
|
169 |
+
{
|
170 |
+
|
171 |
+
$EpisodeData = array();
|
172 |
+
$EpisodeData['url'] = $url;
|
173 |
+
if( $headers['content-length'] )
|
174 |
+
$EpisodeData['size'] = (int) $headers['content-length'];
|
175 |
+
else
|
176 |
+
$EpisodeData['size'] = 0;
|
177 |
+
|
178 |
+
$EpisodeData['type'] = powerpress_check_filetype($EpisodeData['url']);
|
179 |
+
$EpisodeData['duration'] = false;
|
180 |
+
if( $EpisodeData['type'] == 'audio/mpeg' && $DetectDuration )
|
181 |
+
{
|
182 |
+
$Mp3Data = $Mp3Info->GetMp3Info($EpisodeData['url']);
|
183 |
+
|
184 |
+
if( $Mp3Data )
|
185 |
+
{
|
186 |
+
$Duration = $Mp3Data['playtime_string'];
|
187 |
+
$EpisodeData['duration'] = powerpress_readable_duration($Duration, true); // Fix so it looks better when viewed for editing
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$EnclosureData = $EpisodeData['url'] . "\n" . $EpisodeData['size'] . "\n". $EpisodeData['type'];
|
192 |
+
if( $EpisodeData['duration'] )
|
193 |
+
$EnclosureData .= "\n".serialize( array('duration'=>$EpisodeData['duration']) );
|
194 |
+
|
195 |
+
// Save it here...
|
196 |
+
if( $feed_slug == 'podcast' )
|
197 |
+
add_post_meta($post_id, 'enclosure', $EnclosureData, true);
|
198 |
+
else
|
199 |
+
add_post_meta($post_id, '_'. $feed_slug .':enclosure', $EnclosureData, true);
|
200 |
+
|
201 |
+
powerpressadmin_mt_import_log($Titles[ $post_id ], $EpisodeData['url'], $feed_slug);
|
202 |
+
}
|
203 |
+
else
|
204 |
+
{
|
205 |
+
powerpressadmin_mt_import_log($Titles[ $post_id ], $EpisodeData['url'], $feed_slug, 'HTTP return code '. $response['response']['code'] .'.');
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
function powerpressadmin_mt_import_log($post_title, $episode_url, $feed_slug, $error = false)
|
212 |
+
{
|
213 |
+
global $g_mt_import_log, $g_mt_import_count, $g_mt_error_count;
|
214 |
+
$filename = substr($episode_url, strrpos($episode_url, '/')+1);
|
215 |
+
$g_mt_import_log .= '<p style="font-weight: normal; margin-top: 2px; margin-bottom: 2px; margin-left: 20px;">';
|
216 |
+
if( $error )
|
217 |
+
$g_mt_import_log .= '<div class="error-mt">Error importing "<a href="'. $episode_url .'">'. htmlspecialchars($filename) .'</a>" for blog post "'. htmlspecialchars($post_title) .": $error</div>\n";
|
218 |
+
else
|
219 |
+
$g_mt_import_log .= 'Episode "<a href="'. $episode_url .'">'. htmlspecialchars($filename) .'</a>" for blog post "'. htmlspecialchars($post_title) .'" imported to feed "'. $feed_slug ."\".\n";
|
220 |
+
|
221 |
+
$g_mt_import_log .= '</p>';
|
222 |
+
if( $error )
|
223 |
+
{
|
224 |
+
if( $g_mt_error_count )
|
225 |
+
$g_mt_error_count++;
|
226 |
+
else
|
227 |
+
$g_mt_error_count = 1;
|
228 |
+
}
|
229 |
+
else
|
230 |
+
{
|
231 |
+
if( $g_mt_import_count )
|
232 |
+
$g_mt_import_count++;
|
233 |
+
else
|
234 |
+
$g_mt_import_count = 1;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
function powerpressadmin_mt_import_print_log()
|
239 |
+
{
|
240 |
+
global $g_mt_import_log, $g_mt_import_count, $g_mt_error_count;
|
241 |
+
if( !$g_mt_import_log )
|
242 |
+
return;
|
243 |
+
echo '<div style="" class="updated powerpress-notice">';
|
244 |
+
echo '<h3 style="margin-top: 2px; margin-bottom: 2px;">Import Log</h3>';
|
245 |
+
$DetectDuration = ($_POST['DetectDuration']?$_POST['DetectDuration']:0);
|
246 |
+
if( $DetectDuration )
|
247 |
+
{
|
248 |
+
echo "<p style=\"font-weight: normal;\">Duration of each mp3 detected.</p>";
|
249 |
+
}
|
250 |
+
|
251 |
+
echo $g_mt_import_log;
|
252 |
+
$g_mt_import_log='';
|
253 |
+
echo "<p style=\"font-weight: normal;\">Imported $g_mt_import_count episode(s).</p>";
|
254 |
+
if( $g_mt_error_count )
|
255 |
+
echo "<p style=\"font-weight: normal;\">Found $g_mt_error_count error(s).</p>";
|
256 |
+
echo '</div>';
|
257 |
+
}
|
258 |
+
|
259 |
+
function powerpressadmin_importmt_columns($data=array())
|
260 |
+
{
|
261 |
+
$Settings = powerpress_get_settings('powerpress_general', false);
|
262 |
+
$data['post-title'] = 'Episode Title';
|
263 |
+
$data['post-date'] = 'Date';
|
264 |
+
|
265 |
+
$data['feed-podcast'] = 'Feed: (podcast)';
|
266 |
+
|
267 |
+
if( is_array($Settings['custom_feeds']) )
|
268 |
+
{
|
269 |
+
while( list($feed_slug,$value) = each($Settings['custom_feeds']) )
|
270 |
+
{
|
271 |
+
if( $feed_slug != 'podcast' )
|
272 |
+
$data['feed-'.$feed_slug] = 'Feed: ('.$feed_slug.')';
|
273 |
+
}
|
274 |
+
}
|
275 |
+
$data['exclude'] = '<a href="#" onclick="no_import_all();return false;">No Import</a>';
|
276 |
+
|
277 |
+
return $data;
|
278 |
+
}
|
279 |
+
|
280 |
+
add_filter('manage_powerpressadmin_importmt_columns', 'powerpressadmin_importmt_columns');
|
281 |
+
|
282 |
+
function powerpress_admin_mt()
|
283 |
+
{
|
284 |
+
$results = powerpress_get_mt_episodes();
|
285 |
+
$Settings = powerpress_get_settings('powerpress_general', false);
|
286 |
+
if( !isset($Settings['custom_feeds']['podcast']) )
|
287 |
+
$Settings['custom_feeds']['podcast'] = 'Podcast Feed (default)';
|
288 |
+
|
289 |
+
if( $results )
|
290 |
+
{
|
291 |
+
if( $results['feeds_required'] > count($Settings['custom_feeds']) )
|
292 |
+
{
|
293 |
+
powerpress_page_message_add_error( sprintf(__('We found blog posts that have as many as %d media files. You may need to create %d more Custom Feed%s in order to import all of the media.'), $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds']), (( ( $results['feeds_required'] - count($Settings['custom_feeds']) ) > 1 )?'s':'') ) );
|
294 |
+
powerpress_page_message_print();
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
powerpressadmin_mt_import_print_log();
|
299 |
+
|
300 |
+
?>
|
301 |
+
<style>
|
302 |
+
.column-exclude {
|
303 |
+
width: 80px;
|
304 |
+
}
|
305 |
+
.column-post-date {
|
306 |
+
width: 80px;
|
307 |
+
}
|
308 |
+
.error-mt {
|
309 |
+
background-color: #ffebe8;
|
310 |
+
border-color: #c00;
|
311 |
+
border-width: 1px;
|
312 |
+
border-style: solid;
|
313 |
+
padding: 0 0.6em;
|
314 |
+
margin: 5px 15px 2px;
|
315 |
+
-moz-border-radius: 3px;
|
316 |
+
-khtml-border-radius: 3px;
|
317 |
+
-webkit-border-radius: 3px;
|
318 |
+
border-radius: 3px;
|
319 |
+
}
|
320 |
+
label {
|
321 |
+
float: left;
|
322 |
+
width: 160px;
|
323 |
+
}
|
324 |
+
</style>
|
325 |
+
<script language="javascript">
|
326 |
+
|
327 |
+
function check_radio_selection(obj, PostID, FileIndex)
|
328 |
+
{
|
329 |
+
if( obj.value == '' ) // Users can select the no feed option as much as they want
|
330 |
+
return true;
|
331 |
+
|
332 |
+
var Field = obj.id;
|
333 |
+
while( Field.charAt( Field.length-1 ) >= "0" && Field.charAt( Field.length-1 ) <= "9" ) // ( chr < "0" ) || ( chr > "9" )
|
334 |
+
{
|
335 |
+
Field = Field.substring(0, Field.length-1);
|
336 |
+
}
|
337 |
+
|
338 |
+
var Pos = 0;
|
339 |
+
var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
|
340 |
+
while( CheckObj )
|
341 |
+
{
|
342 |
+
if( CheckObj.length == 0 )
|
343 |
+
break;
|
344 |
+
|
345 |
+
if( Pos != FileIndex )
|
346 |
+
{
|
347 |
+
for (var i = 0; i < CheckObj.length; i++)
|
348 |
+
{
|
349 |
+
if (CheckObj[i].type == 'radio' && CheckObj[i].checked && CheckObj[i].value == obj.value )
|
350 |
+
{
|
351 |
+
alert("Sorry, you may only select one media file per post per feed. ");
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
Pos++;
|
357 |
+
var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
|
358 |
+
}
|
359 |
+
|
360 |
+
return true;
|
361 |
+
}
|
362 |
+
|
363 |
+
function no_import_all()
|
364 |
+
{
|
365 |
+
if( !confirm('Select "No Import" option for all media files?') )
|
366 |
+
return;
|
367 |
+
|
368 |
+
var Inputs = document.getElementsByTagName('input');
|
369 |
+
for (var i = 0; i < Inputs.length; i++)
|
370 |
+
{
|
371 |
+
var Elem = Inputs[i];
|
372 |
+
if( Elem.type == 'radio' && Elem.value == '' )
|
373 |
+
Elem.checked = true;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
</script>
|
378 |
+
<h2><?php echo __("Import Episodes"); ?></h2>
|
379 |
+
<?php
|
380 |
+
|
381 |
+
if( count($results) == 0 || count($results) == 1 )
|
382 |
+
{
|
383 |
+
?>
|
384 |
+
<p>No episodes found to import.</p>
|
385 |
+
<?php
|
386 |
+
}
|
387 |
+
else
|
388 |
+
{
|
389 |
+
?>
|
390 |
+
<input type="hidden" name="action" value="powerpress-importmt" />
|
391 |
+
<p>Select the media file under each feed for each episode you wish to import.</p>
|
392 |
+
<table class="widefat fixed" cellspacing="0">
|
393 |
+
<thead>
|
394 |
+
<tr>
|
395 |
+
<?php print_column_headers('powerpressadmin_importmt'); ?>
|
396 |
+
</tr>
|
397 |
+
</thead>
|
398 |
+
|
399 |
+
<tfoot>
|
400 |
+
<tr>
|
401 |
+
<?php print_column_headers('powerpressadmin_importmt', false); ?>
|
402 |
+
</tr>
|
403 |
+
</tfoot>
|
404 |
+
<tbody>
|
405 |
+
<?php
|
406 |
+
|
407 |
+
$StrandedEpisodes = 0;
|
408 |
+
$ImportableEpisodes = 0;
|
409 |
+
|
410 |
+
$count = 0;
|
411 |
+
while( list($post_id, $import_data) = each($results ) )
|
412 |
+
{
|
413 |
+
$edit_link = get_edit_post_link( $post_id );
|
414 |
+
if( $post_id == 'feeds_required' )
|
415 |
+
continue;
|
416 |
+
|
417 |
+
$columns = powerpressadmin_importmt_columns();
|
418 |
+
|
419 |
+
$CurrentEnclosures = array();
|
420 |
+
|
421 |
+
if( is_array($Settings['custom_feeds']) )
|
422 |
+
{
|
423 |
+
while( list($feed_slug,$value) = each($Settings['custom_feeds']) )
|
424 |
+
{
|
425 |
+
if( $feed_slug == 'podcast' )
|
426 |
+
$enclosure_data = get_post_meta($post_id, 'enclosure', true);
|
427 |
+
else
|
428 |
+
$enclosure_data = get_post_meta($post_id, '_'. $feed_slug .':enclosure', true);
|
429 |
+
if( !$enclosure_data )
|
430 |
+
continue;
|
431 |
+
|
432 |
+
list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = split("\n", $enclosure_data);
|
433 |
+
if( $EnclosureURL )
|
434 |
+
{
|
435 |
+
$CurrentEnclosures[ $feed_slug ] = array();
|
436 |
+
$CurrentEnclosures[ $feed_slug ]['url'] = trim($EnclosureURL);
|
437 |
+
$CurrentEnclosures[ $feed_slug ]['imported'] = false;
|
438 |
+
}
|
439 |
+
|
440 |
+
$found = false;
|
441 |
+
while( list($episode_index,$episode_data) = each($import_data['enclosures']) )
|
442 |
+
{
|
443 |
+
if( $episode_data['url'] == $CurrentEnclosures[ $feed_slug ]['url'] )
|
444 |
+
{
|
445 |
+
$import_data['enclosures'][$episode_index]['imported'] = true;
|
446 |
+
$CurrentEnclosures[ $feed_slug ]['imported'] = true;
|
447 |
+
$found = true;
|
448 |
+
break;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
reset($import_data['enclosures']);
|
452 |
+
if( $found == false )
|
453 |
+
{
|
454 |
+
// Add it to the media file list, prepend it...
|
455 |
+
$is_enclosure_data = array();
|
456 |
+
$is_enclosure_data['url'] = $CurrentEnclosures[ $feed_slug ]['url'];
|
457 |
+
$is_enclosure_data['imported'] = true;
|
458 |
+
|
459 |
+
array_push($import_data['enclosures'], $is_enclosure_data);
|
460 |
+
$CurrentEnclosures[ $feed_slug ]['imported'] = true;
|
461 |
+
$CurrentEnclosures[ $feed_slug ]['present'] = true;
|
462 |
+
}
|
463 |
+
}
|
464 |
+
reset($Settings['custom_feeds']);
|
465 |
+
}
|
466 |
+
|
467 |
+
if( $feed_slug == 'podcast' )
|
468 |
+
$feed_title = 'Podcast Feed (default)';
|
469 |
+
$feed_title = wp_specialchars($feed_title);
|
470 |
+
if( $count % 2 == 0 )
|
471 |
+
echo '<tr valign="middle" class="alternate">';
|
472 |
+
else
|
473 |
+
echo '<tr valign="middle">';
|
474 |
+
|
475 |
+
$CheckedEpisodes = array(); // key = file_index, value = feed-slug
|
476 |
+
|
477 |
+
$feed_index = 0;
|
478 |
+
foreach($columns as $column_name=>$column_display_name)
|
479 |
+
{
|
480 |
+
$class = "class=\"column-$column_name\"";
|
481 |
+
|
482 |
+
switch($column_name)
|
483 |
+
{
|
484 |
+
case 'post-title': {
|
485 |
+
|
486 |
+
echo '<td '.$class.'><strong>';
|
487 |
+
if ( current_user_can( 'edit_post', $post_id ) )
|
488 |
+
{
|
489 |
+
?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $import_data['post_title'])); ?>"><?php echo $import_data['post_title'] ?></a><?php
|
490 |
+
}
|
491 |
+
else
|
492 |
+
{
|
493 |
+
echo $import_data['post_title'];
|
494 |
+
}
|
495 |
+
|
496 |
+
|
497 |
+
echo '</strong><br />';
|
498 |
+
echo '<div style="margin-left: 10px;">';
|
499 |
+
$index = 1;
|
500 |
+
while( list($episode_index,$episode_data) = each($import_data['enclosures']) )
|
501 |
+
{
|
502 |
+
$Parts = parse_url($episode_data['url']);
|
503 |
+
$filename = substr($Parts['path'], strrpos($Parts['path'], '/')+1 );
|
504 |
+
if( $filename == '' )
|
505 |
+
$filename = $episode_data['url'];
|
506 |
+
echo "File $index: ";
|
507 |
+
|
508 |
+
echo '<input type="hidden" name="Media['.$post_id.']['.$episode_index.']" value="'. htmlspecialchars($episode_data['url']) .'" />';
|
509 |
+
|
510 |
+
|
511 |
+
if( !$episode_data['imported'] )
|
512 |
+
{
|
513 |
+
echo '<span style="color: #CC0000; font-weight: bold; cursor:pointer;" onclick="alert(\'File: '. $filename .'\nURL: '. $episode_data['url'] .'\')">';
|
514 |
+
$StrandedEpisodes++;
|
515 |
+
}
|
516 |
+
else
|
517 |
+
{
|
518 |
+
echo '<span style="color: green; font-weight: bold; cursor:pointer;" onclick="alert(\'File: '. $filename .'\nURL: '. $episode_data['url'] .'\')">';
|
519 |
+
}
|
520 |
+
|
521 |
+
if( !$episode_data['imported'] )
|
522 |
+
echo '*';
|
523 |
+
echo $filename;
|
524 |
+
echo '</span>';
|
525 |
+
|
526 |
+
echo '<br/>';
|
527 |
+
$index++;
|
528 |
+
}
|
529 |
+
|
530 |
+
if( $index > 1 ) // Do we need the post title?
|
531 |
+
echo '<input type="hidden" name="Titles['.$post_id.']" value="'. htmlspecialchars($import_data['post_title']) .'" />';
|
532 |
+
|
533 |
+
reset($import_data['enclosures']);
|
534 |
+
|
535 |
+
echo '</div>';
|
536 |
+
echo '</td>';
|
537 |
+
|
538 |
+
}; break;
|
539 |
+
case 'post-date': {
|
540 |
+
echo "<td $class>";
|
541 |
+
$timestamp = strtotime($import_data['post_date']);
|
542 |
+
echo date('Y/m/d', $timestamp);
|
543 |
+
echo "</td>";
|
544 |
+
}; break;
|
545 |
+
case 'feed-slug': {
|
546 |
+
|
547 |
+
echo "<td $class>$feed_slug";
|
548 |
+
echo "</td>";
|
549 |
+
|
550 |
+
}; break;
|
551 |
+
|
552 |
+
default: {
|
553 |
+
|
554 |
+
echo "<td $class>";
|
555 |
+
$feed_slug = substr($column_name, 5);
|
556 |
+
if( $column_name == 'exclude' )
|
557 |
+
$feed_slug = '';
|
558 |
+
$enclosure_data = false;
|
559 |
+
$EnclosureURL = '';
|
560 |
+
|
561 |
+
echo '<div class=""> <br />';
|
562 |
+
if( isset($CurrentEnclosures[$feed_slug]) && $CurrentEnclosures[$feed_slug]['imported'] )
|
563 |
+
{
|
564 |
+
$index = 1;
|
565 |
+
while( list($episode_index,$episode_data) = each($import_data['enclosures']) )
|
566 |
+
{
|
567 |
+
echo "File $index: ";
|
568 |
+
if( $CurrentEnclosures[$feed_slug]['url'] == $episode_data['url'] )
|
569 |
+
{
|
570 |
+
if( $CurrentEnclosures[$feed_slug]['present'] )
|
571 |
+
echo '<strong style="color: green;">present</strong>';
|
572 |
+
else
|
573 |
+
echo '<strong style="color: green;">imported</strong>';
|
574 |
+
}
|
575 |
+
else
|
576 |
+
echo 'X';
|
577 |
+
echo "<br/>\n";
|
578 |
+
$index++;
|
579 |
+
}
|
580 |
+
reset($import_data['enclosures']);
|
581 |
+
}
|
582 |
+
else
|
583 |
+
{
|
584 |
+
$index = 1;
|
585 |
+
while( list($episode_index,$episode_data) = each($import_data['enclosures']) )
|
586 |
+
{
|
587 |
+
echo "File $index: ";
|
588 |
+
if( @$episode_data['imported'] )
|
589 |
+
{
|
590 |
+
echo ' X';
|
591 |
+
}
|
592 |
+
else
|
593 |
+
{
|
594 |
+
$checked = '';
|
595 |
+
if( !isset($CheckedEpisodes[ $episode_index ]) && !in_array($feed_slug, $CheckedEpisodes) )
|
596 |
+
{
|
597 |
+
$checked = 'checked';
|
598 |
+
$CheckedEpisodes[ $episode_index ] = $feed_slug;
|
599 |
+
}
|
600 |
+
if( !isset($CheckedEpisodes[ $episode_index ]) && $feed_slug == '' )
|
601 |
+
{
|
602 |
+
$checked = 'checked';
|
603 |
+
}
|
604 |
+
|
605 |
+
|
606 |
+
echo '<input type="radio" id="import_'. $post_id .'_'. $episode_index .'" name="Import['.$post_id.']['.$episode_index.']" value="'.$feed_slug.'" '. $checked .' onclick="return check_radio_selection(this, '.$post_id.', '.$episode_index.')" />';
|
607 |
+
}
|
608 |
+
echo '<br/>';
|
609 |
+
$index++;
|
610 |
+
}
|
611 |
+
reset($import_data['enclosures']);
|
612 |
+
}
|
613 |
+
|
614 |
+
echo '</div>';
|
615 |
+
|
616 |
+
|
617 |
+
echo "</td>";
|
618 |
+
$feed_index++;
|
619 |
+
}; break;
|
620 |
+
}
|
621 |
+
}
|
622 |
+
echo "\n </tr>\n";
|
623 |
+
$count++;
|
624 |
+
}
|
625 |
+
?>
|
626 |
+
</tbody>
|
627 |
+
</table>
|
628 |
+
|
629 |
+
<p>Importable episodes highlighted in <span style="color: #CC0000; font-weight: bold;">red</span> with asterisks *.</p>
|
630 |
+
|
631 |
+
<p>Types of media found:
|
632 |
+
<?php
|
633 |
+
$comma = false;
|
634 |
+
global $g_import_mt_extensions;
|
635 |
+
while( list($ext, $null) = each($g_import_mt_extensions) )
|
636 |
+
{
|
637 |
+
if( $comma )
|
638 |
+
echo ', ';
|
639 |
+
$comma = true;
|
640 |
+
echo $ext;
|
641 |
+
}
|
642 |
+
?>
|
643 |
+
</p>
|
644 |
+
|
645 |
+
|
646 |
+
|
647 |
+
<?php
|
648 |
+
}
|
649 |
+
|
650 |
+
if( $StrandedEpisodes )
|
651 |
+
{
|
652 |
+
reset($results);
|
653 |
+
?>
|
654 |
+
<p>
|
655 |
+
There are <?php echo $StrandedEpisodes; ?> media files that can be imported with a total of <?php echo (count($results) -1); ?> blog post podcast episodes.
|
656 |
+
</p>
|
657 |
+
<?php
|
658 |
+
}
|
659 |
+
?>
|
660 |
+
<p class="submit">
|
661 |
+
<input type="submit" name="Submit" id="powerpress_import_button" class="button-primary" value="Import Episodes" onclick="return confirm('Import selected episodes, are you sure?');" />
|
662 |
+
<input type="checkbox" name="DetectDuration" value="1" /> Detect duration for mp3 media. (expect script to take a while with this option)</p>
|
663 |
+
</p>
|
664 |
+
</form>
|
665 |
+
<hr />
|
666 |
+
<form enctype="enctype" method="get" action="<?php echo admin_url('admin.php') ?>">
|
667 |
+
<input type="hidden" name="page" value="powerpress/powerpressadmin_tools.php" />
|
668 |
+
<input type="hidden" name="action" value="powerpress-mt-epiosdes" />
|
669 |
+
<h2>Filter Results</h2>
|
670 |
+
<p><label>Include Only</label><input type="text" name="include_only_ext" value="<?php if( $_GET['include_only_ext'] ) echo htmlspecialchars($_GET['include_only_ext']); ?>" style="width: 240px;" /> (leave blank for all media) <br />
|
671 |
+
<label> </label>specify the file extensions to include separated by commas (e.g. mp3, m4v).
|
672 |
+
</p>
|
673 |
+
<p class="submit">
|
674 |
+
<input type="submit" name="Submit" class="button-primary" value="Filter Episodes" />
|
675 |
+
</p>
|
676 |
+
<!-- start footer -->
|
677 |
+
<?php
|
678 |
+
}
|
679 |
+
|
680 |
+
?>
|
powerpressadmin-tools.php
CHANGED
@@ -21,8 +21,13 @@
|
|
21 |
<tr valign="top">
|
22 |
<th scope="row"><?php echo __("Import Episodes"); ?></th>
|
23 |
<td>
|
24 |
-
|
25 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
26 |
</td>
|
27 |
</tr>
|
28 |
|
21 |
<tr valign="top">
|
22 |
<th scope="row"><?php echo __("Import Episodes"); ?></th>
|
23 |
<td>
|
24 |
+
|
25 |
+
<p style="margin-top: 5px;"><strong><a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_tools.php&action=powerpress-podpress-epiosdes"); ?>">Import PodPress Episodes</a></strong> </p>
|
26 |
+
<p>Import PodPress created episodes to PowerPress specific podcast feed(s).</p>
|
27 |
+
|
28 |
+
<p style="margin-top: 5px;"><strong><a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_tools.php&action=powerpress-mt-epiosdes"); ?>">Import Movable Type/Blogger Episodes</a></strong> (media linked in blog posts)</p>
|
29 |
+
<p>Import Movable Type/Blogger podcast episodes to PowerPress specific podcast feed(s).</p>
|
30 |
+
|
31 |
</td>
|
32 |
</tr>
|
33 |
|
powerpressadmin.php
CHANGED
@@ -45,9 +45,9 @@ function powerpress_admin_init()
|
|
45 |
powerpress_page_message_add_error( __('Another podcasting plugin has been detected, PowerPress is currently disabled.') );
|
46 |
|
47 |
global $wp_version;
|
48 |
-
$VersionDiff = version_compare($wp_version, 2.
|
49 |
if( $VersionDiff < 0 )
|
50 |
-
powerpress_page_message_add_error( __('Blubrry PowerPress requires Wordpress version 2.
|
51 |
|
52 |
// Save settings here
|
53 |
if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
|
@@ -233,6 +233,14 @@ function powerpress_admin_init()
|
|
233 |
|
234 |
$_GET['action'] = 'powerpress-podpress-epiosdes';
|
235 |
}; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
case 'deletepodpressdata': {
|
237 |
check_admin_referer('powerpress-delete-podpress-data');
|
238 |
|
@@ -502,7 +510,8 @@ function powerpress_edit_post($post_ID, $post)
|
|
502 |
$FileType = wp_check_filetype($UrlParts['path']);
|
503 |
if( $FileType )
|
504 |
$ContentType = $FileType['type'];
|
505 |
-
|
|
|
506 |
/*
|
507 |
$FileParts = pathinfo($UrlParts['path']);
|
508 |
if( $FileParts )
|
@@ -884,6 +893,12 @@ function powerpress_admin_page_tools()
|
|
884 |
powerpress_admin_podpress();
|
885 |
powerpress_admin_page_footer(false);
|
886 |
}; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
default: {
|
888 |
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php');
|
889 |
require_once( dirname(__FILE__).'/powerpressadmin-tools.php');
|
@@ -959,15 +974,16 @@ function powerpress_ping_itunes($iTunes_url)
|
|
959 |
return array('success'=>true, 'content'=>$tempdata, 'feed_url'=>trim($FeedURL), 'podcast_id'=>trim($PodcastID) );
|
960 |
}
|
961 |
|
962 |
-
function powerpress_remote_fopen($url)
|
963 |
{
|
964 |
-
if( function_exists( 'curl_init' ) )
|
965 |
{
|
966 |
$curl = curl_init();
|
967 |
curl_setopt($curl, CURLOPT_URL, $url);
|
968 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
969 |
curl_setopt($curl, CURLOPT_HEADER, 0);
|
970 |
-
|
|
|
971 |
curl_setopt($curl, CURLOPT_MAXREDIRS, 5); // Location redirection limit
|
972 |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
|
973 |
curl_setopt($curl, CURLOPT_TIMEOUT, 5); // The maximum number of seconds to execute.
|
@@ -977,6 +993,11 @@ function powerpress_remote_fopen($url)
|
|
977 |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
|
978 |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
979 |
}
|
|
|
|
|
|
|
|
|
|
|
980 |
$content = curl_exec($curl);
|
981 |
$error = curl_errno($curl);
|
982 |
curl_close($curl);
|
@@ -985,6 +1006,31 @@ function powerpress_remote_fopen($url)
|
|
985 |
return $content;
|
986 |
}
|
987 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
988 |
// Use the bullt-in remote_fopen...
|
989 |
return wp_remote_fopen($url);
|
990 |
}
|
@@ -1098,6 +1144,7 @@ function powerpress_admin_import_podpress_settings()
|
|
1098 |
return true;
|
1099 |
}
|
1100 |
|
|
|
1101 |
function powerpress_admin_episodes_per_feed($feed_slug)
|
1102 |
{
|
1103 |
$field = 'enclosure';
|
@@ -1114,4 +1161,39 @@ function powerpress_admin_episodes_per_feed($feed_slug)
|
|
1114 |
}
|
1115 |
return 0;
|
1116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1117 |
?>
|
45 |
powerpress_page_message_add_error( __('Another podcasting plugin has been detected, PowerPress is currently disabled.') );
|
46 |
|
47 |
global $wp_version;
|
48 |
+
$VersionDiff = version_compare($wp_version, 2.6);
|
49 |
if( $VersionDiff < 0 )
|
50 |
+
powerpress_page_message_add_error( __('Blubrry PowerPress requires Wordpress version 2.6 or greater.') );
|
51 |
|
52 |
// Save settings here
|
53 |
if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
|
233 |
|
234 |
$_GET['action'] = 'powerpress-podpress-epiosdes';
|
235 |
}; break;
|
236 |
+
case 'powerpress-importmt': {
|
237 |
+
check_admin_referer('powerpress-import-mt');
|
238 |
+
|
239 |
+
require_once( dirname(__FILE__) . '/powerpressadmin-mt.php');
|
240 |
+
powerpressadmin_mt_do_import();
|
241 |
+
|
242 |
+
$_GET['action'] = 'powerpress-mt-epiosdes';
|
243 |
+
}; break;
|
244 |
case 'deletepodpressdata': {
|
245 |
check_admin_referer('powerpress-delete-podpress-data');
|
246 |
|
510 |
$FileType = wp_check_filetype($UrlParts['path']);
|
511 |
if( $FileType )
|
512 |
$ContentType = $FileType['type'];
|
513 |
+
else
|
514 |
+
$ContentType = 'application/binary';
|
515 |
/*
|
516 |
$FileParts = pathinfo($UrlParts['path']);
|
517 |
if( $FileParts )
|
893 |
powerpress_admin_podpress();
|
894 |
powerpress_admin_page_footer(false);
|
895 |
}; break;
|
896 |
+
case 'powerpress-mt-epiosdes': {
|
897 |
+
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php', 'powerpress-import-mt');
|
898 |
+
require_once( dirname(__FILE__).'/powerpressadmin-mt.php');
|
899 |
+
powerpress_admin_mt();
|
900 |
+
powerpress_admin_page_footer(false);
|
901 |
+
}; break;
|
902 |
default: {
|
903 |
powerpress_admin_page_header('powerpress/powerpressadmin_tools.php');
|
904 |
require_once( dirname(__FILE__).'/powerpressadmin-tools.php');
|
974 |
return array('success'=>true, 'content'=>$tempdata, 'feed_url'=>trim($FeedURL), 'podcast_id'=>trim($PodcastID) );
|
975 |
}
|
976 |
|
977 |
+
function powerpress_remote_fopen($url, $basic_auth = false)
|
978 |
{
|
979 |
+
if( function_exists( 'curl_init' ) ) // Preferred method of connecting
|
980 |
{
|
981 |
$curl = curl_init();
|
982 |
curl_setopt($curl, CURLOPT_URL, $url);
|
983 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
984 |
curl_setopt($curl, CURLOPT_HEADER, 0);
|
985 |
+
if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
|
986 |
+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // Follow location redirection
|
987 |
curl_setopt($curl, CURLOPT_MAXREDIRS, 5); // Location redirection limit
|
988 |
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
|
989 |
curl_setopt($curl, CURLOPT_TIMEOUT, 5); // The maximum number of seconds to execute.
|
993 |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
|
994 |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
995 |
}
|
996 |
+
if( $basic_auth )
|
997 |
+
{
|
998 |
+
curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Authorization: Basic '.$basic_auth) );
|
999 |
+
}
|
1000 |
+
|
1001 |
$content = curl_exec($curl);
|
1002 |
$error = curl_errno($curl);
|
1003 |
curl_close($curl);
|
1006 |
return $content;
|
1007 |
}
|
1008 |
|
1009 |
+
global $wp_version;
|
1010 |
+
if( version_compare('2.7', $wp_version, '<=') ) // Lets us specify the user agent and set the basic auth string...
|
1011 |
+
{
|
1012 |
+
$options = array();
|
1013 |
+
$options['timeout'] = 10;
|
1014 |
+
$options['user-agent'] = 'Blubrry PowerPress/'.POWERPRESS_VERSION;
|
1015 |
+
if( $basicauth )
|
1016 |
+
$options['headers'][] = 'Authorization: Basic '.$basic_auth;
|
1017 |
+
|
1018 |
+
$response = wp_remote_get( $uri, $options );
|
1019 |
+
|
1020 |
+
if ( is_wp_error( $response ) )
|
1021 |
+
return false;
|
1022 |
+
|
1023 |
+
return $response['body'];
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
if( $basic_auth )
|
1027 |
+
{
|
1028 |
+
$UserPassDecoded = base64_decode($basic_auth);
|
1029 |
+
list($User, $Pass) = split(':', $UserPassDecoded, 2);
|
1030 |
+
$url_prefix = sprintf('http://%s:%s@', str_replace('@', '$', $User), $Pass);
|
1031 |
+
$url = $url_prefix . substr($url, 7);
|
1032 |
+
}
|
1033 |
+
|
1034 |
// Use the bullt-in remote_fopen...
|
1035 |
return wp_remote_fopen($url);
|
1036 |
}
|
1144 |
return true;
|
1145 |
}
|
1146 |
|
1147 |
+
|
1148 |
function powerpress_admin_episodes_per_feed($feed_slug)
|
1149 |
{
|
1150 |
$field = 'enclosure';
|
1161 |
}
|
1162 |
return 0;
|
1163 |
}
|
1164 |
+
|
1165 |
+
// Set the default settings basedon the section user is in.
|
1166 |
+
function powerpress_default_settings($Settings, $Section='basic')
|
1167 |
+
{
|
1168 |
+
// Set the default settings if the setting does not exist...
|
1169 |
+
switch($Section)
|
1170 |
+
{
|
1171 |
+
case 'basic': {
|
1172 |
+
// Nothing needs to be pre-set in the basic settings area
|
1173 |
+
}; break;
|
1174 |
+
case 'editfeed': {
|
1175 |
+
if( !isset($Settings['apply_to']) )
|
1176 |
+
$Settings['apply_to'] = 1; // Make sure settings are applied to all feeds by default
|
1177 |
+
//if( !isset($Settings['enhance_itunes_summary']) )
|
1178 |
+
// $Settings['enhance_itunes_summary'] = 1;
|
1179 |
+
}; // Let this fall through to the custom feed settings
|
1180 |
+
case 'editfeed_custom': {
|
1181 |
+
if( !isset($Settings['enhance_itunes_summary']) )
|
1182 |
+
$Settings['enhance_itunes_summary'] = 1;
|
1183 |
+
}; break;
|
1184 |
+
case 'appearance': {
|
1185 |
+
if( !isset($Settings['display_player']) )
|
1186 |
+
$Settings['display_player'] = 1;
|
1187 |
+
if( !isset($Settings['player_function']) )
|
1188 |
+
$Settings['player_function'] = 1;
|
1189 |
+
if( !isset($Settings['podcast_link']) )
|
1190 |
+
$Settings['podcast_link'] = 1;
|
1191 |
+
if( !isset($Settings['display_player_excerpt']) )
|
1192 |
+
$Settings['display_player_excerpt'] = 0;
|
1193 |
+
}; break;
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
return $Settings;
|
1197 |
+
}
|
1198 |
+
|
1199 |
?>
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Blubrry PowerPress Podcasting plugin ===
|
2 |
Contributors: Angelo Mandato, Blubrry.com
|
3 |
-
Tags: podcast, podcasting, itunes, enclosure, zune, iphone, audio, video, rss2, feed, player, media, rss
|
4 |
-
Requires at least: 2.
|
5 |
Tested up to: 2.7.1
|
6 |
-
Stable tag: 0.7.
|
7 |
|
8 |
Add podcasting support to your blog.
|
9 |
|
@@ -27,12 +27,14 @@ Features:
|
|
27 |
* Duration detection (mp3 only)
|
28 |
* 3rd party statistics integration
|
29 |
* Import PodPress settings and media episodes
|
|
|
30 |
* Category Podcast Feeds (Category Casting)
|
31 |
* Tag/Keyword Podcast Feeds (Tag Casting)
|
32 |
* Hosted Feed Support (FeedBurner.com)
|
33 |
* User Role Management (Control which users on blog can Podcast)
|
34 |
|
35 |
-
|
|
|
36 |
For the latest information visit the website.
|
37 |
|
38 |
http://www.blubrry.com/powerpress/
|
@@ -66,6 +68,9 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
69 |
0.7.2 released on 3/26/2009
|
70 |
Re-ordered change log so latest release is listed first rather than last. Fixed powerpress_bloginfo_rss() warning message that occurred for some users, Updated the itunes_url setting to handle the latest itunes URL itunes.apple.com, No longer including revision posts in the PodPress import episode utility, Fixed bug with iTunes author setting not getting applied to feeds, display player in excerpts checkbox bug fixed, no longer including player code in HTML headers if not necessary, fixed duration bug with 1:00:60 which now reports 1:01:00, feed settings are now used for custom feeds that do not have settings of their own, added additional fix for FeedSmith when permalinks is not enabled, fixed bug where feed settings were not being applied to podcast feed in simple mode under some situations, fixed bug with enhance podcast only and main site feed only setting, fixed bug with pinging iTunes with CURL missing SSL certificates, and fixed itunes ping for latest itunes.apple.com one click subscribe links.
|
71 |
|
1 |
=== Blubrry PowerPress Podcasting plugin ===
|
2 |
Contributors: Angelo Mandato, Blubrry.com
|
3 |
+
Tags: podcast, podcasting, itunes, enclosure, zune, iphone, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats
|
4 |
+
Requires at least: 2.6.0
|
5 |
Tested up to: 2.7.1
|
6 |
+
Stable tag: 0.7.3
|
7 |
|
8 |
Add podcasting support to your blog.
|
9 |
|
27 |
* Duration detection (mp3 only)
|
28 |
* 3rd party statistics integration
|
29 |
* Import PodPress settings and media episodes
|
30 |
+
* Import Blogger/Movable Type media episodes
|
31 |
* Category Podcast Feeds (Category Casting)
|
32 |
* Tag/Keyword Podcast Feeds (Tag Casting)
|
33 |
* Hosted Feed Support (FeedBurner.com)
|
34 |
* User Role Management (Control which users on blog can Podcast)
|
35 |
|
36 |
+
File Types detected: mp3, m4a, ogg, wma, ra, mp4a, m4v, mp4v, mpg, asf, avi, wmv, flv, swf, mov, divx, 3gp, midi, wav, aa, pdf, torrent
|
37 |
+
|
38 |
For the latest information visit the website.
|
39 |
|
40 |
http://www.blubrry.com/powerpress/
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
0.7.3 released on 4/21/2009
|
72 |
+
Fixed POWERPRESS _CONTENT _ACTION _PRIORITY define typo, incremented version check (PowerPress now requires WordPress 2.6.x), fixed bug where player.js was not included in the header if simple mode was used, made the enhanced itunes summary set on by default for new installations, detecting additional file types, add new import episodes previously created in Blogger/Movable Type, fix bug where channel link matches image link, no longer including empty duration values in feeds, fixed bug with curl-setopt function printing a PHP warning in some situations, added warning when user enters an unknown media redirect url.
|
73 |
+
|
74 |
0.7.2 released on 3/26/2009
|
75 |
Re-ordered change log so latest release is listed first rather than last. Fixed powerpress_bloginfo_rss() warning message that occurred for some users, Updated the itunes_url setting to handle the latest itunes URL itunes.apple.com, No longer including revision posts in the PodPress import episode utility, Fixed bug with iTunes author setting not getting applied to feeds, display player in excerpts checkbox bug fixed, no longer including player code in HTML headers if not necessary, fixed duration bug with 1:00:60 which now reports 1:01:00, feed settings are now used for custom feeds that do not have settings of their own, added additional fix for FeedSmith when permalinks is not enabled, fixed bug where feed settings were not being applied to podcast feed in simple mode under some situations, fixed bug with enhance podcast only and main site feed only setting, fixed bug with pinging iTunes with CURL missing SSL certificates, and fixed itunes ping for latest itunes.apple.com one click subscribe links.
|
76 |
|