Index: podpress.php
===================================================================
--- podpress.php	(Revision 210539)
+++ podpress.php	(Arbeitskopie)
@@ -1,11 +1,11 @@
 <?php
 define('PODPRESS_VERSION', '8.8');
-define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 2');
+define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 3');
 /*
  Info for WordPress:
  ==============================================================================
  Plugin Name: podPress
- Version: 8.8.5-beta_2
+ Version: 8.8.5-beta_3
  Plugin URI: http://www.mightyseek.com/podpress/
  Description: The podPress pluggin gives you everything you need in one easy plugin to use WordPress for Podcasting. Set it up in <a href="admin.php?page=podpress/podpress_feed.php">'podPress'->Feed/iTunes Settings</a>. If you this plugin works for you, send us a comment.
  Author: Dan Kuykendall (Seek3r)
@@ -37,12 +37,12 @@
 
  Contributors:
  ==============================================================================
- Developer              Dan Kuykendall      http://www.mightyseek.com/
- Developer              David Maciejewski   http://www.macx.de/
- Forum Support/BugBoy   Jeff Norris         http://www.iscifi.tv/
+ Developer			Dan Kuykendall	http://www.mightyseek.com/
+ Developer			David Maciejewski	http://www.macx.de/
+ Forum Support/BugBoy	Jeff Norris		http://www.iscifi.tv/
 
- Audio player           Martin Laine        http://www.1pixelout.net
- WP-iPodCatter          Garrick Van Buren   http://garrickvanburen.com/
+ Audio player			Martin Laine		http://www.1pixelout.net
+ WP-iPodCatter		Garrick Van Buren	http://garrickvanburen.com/
 
  Thanks to all contributors and bug reporters! :)
 
@@ -91,6 +91,31 @@
 if (!defined('PLUGINDIR')) { define('PLUGINDIR', 'wp-content/plugins'); }
 if (!defined('PODPRESSPLUGINDIR')) { define('PODPRESSPLUGINDIR', ABSPATH.PLUGINDIR); }
 
+// Begin - XSPF Jukebox player configuration:
+// Background-color of the player <object>
+if ( ! defined( 'PODPRESS_XSPF_BACKGROUND_COLOR' ) ) { define( 'PODPRESS_XSPF_BACKGROUND_COLOR', 'FFFFFF' ); }
+
+// Before you use these options please read the player documentation http://lacymorrow.com/projects/jukebox/xspfdoc.html and the skin documentation http://lacymorrow.com/projects/jukebox/skindoc.html
+// If you want to use a custom skin file for the XSPF player then uncomment this line and replace or edit the skin files in the folders /podpress/players/xspf_jukebox/dynamic/ or /podpress/players/xspf_jukebox/dynamic_slim/
+// if ( ! defined('PODPRESS_XSPF_PLAYER_USE_CUSTOM_SKINFILE') ) { define('PODPRESS_XSPF_PLAYER_USE_CUSTOM_SKINFILE', TRUE); }
+
+// the minimum width of the XSPF player (default: 170) in pixels (Choose the actual width in the widgets settings! Change this value only if you want to use a smaller skin.)
+if ( ! defined( 'PODPRESS_XSPF_MIN_PLAYER_WIDTH' ) ) { define( 'PODPRESS_XSPF_MIN_PLAYER_WIDTH', 170 ); }
+
+// podPress uses a derivate of the SlimOriginal skin. If you want to use a different skin with different heights then (uncomment these lines and) change the height values appropriately.
+if ( ! defined( 'PODPRESS_XSPF_PLAYER_HEIGHT' ) ) { define( 'PODPRESS_XSPF_PLAYER_HEIGHT', 210 ); }
+if ( ! defined( 'PODPRESS_XSPF_SLIM_PLAYER_HEIGHT' ) ) { define( 'PODPRESS_XSPF_SLIM_PLAYER_HEIGHT', 30 ); }
+
+// If you want to let the player show the episode preview images then uncomment the following line (is only necessary if you are using the default player skin of podPress):
+// if ( ! defined('PODPRESS_XSPF_SHOW_PREVIEW_IMAGE') ) { define('PODPRESS_XSPF_SHOW_PREVIEW_IMAGE', TRUE); }
+
+// podPress uses the parameters: &autoload=true&autoplay=false&loaded=true to load the XSPF player
+// If you want to use custom parameters then uncomment the following lines and edit or replace the variables.txt files in the folders /podpress/players/xspf_jukebox/dynamic/ and /podpress/players/xspf_jukebox/dynamic_slim/.
+// if ( ! defined('PODPRESS_XSPF_USE_CUSTOM_VARIABLES') ) { define('PODPRESS_XSPF_USE_CUSTOM_VARIABLES', TRUE); }
+// if ( ! defined('PODPRESS_XSPF_SLIM_USE_CUSTOM_VARIABLES') ) { define('PODPRESS_XSPF_SLIM_USE_CUSTOM_VARIABLES', TRUE); }
+// End - XSPF Jukebox player configuration
+
+
 if(!function_exists('memory_get_usage')) {
 	unset($_GET['podpress_showmem']);
 	function memory_get_usage() { return 0;	}
@@ -154,7 +179,7 @@
 	podPress_checkmem('podPress base class included');
 	require_once(ABSPATH.PLUGINDIR.'/podpress/podpress_functions.php');
 	podPress_checkmem('podPress functions loaded');
-
+	
 	if($podPress_x = @parse_url($_SERVER['REQUEST_URI'])) {
 		$podPress_x = $podPress_x['path'];
 		if (strpos($podPress_x, 'crossdomain.xml')) {
@@ -271,7 +296,7 @@
 		echo 'podPressBackendURL = podPressBackendURL+"//"+location.hostname+"'.podPress_url(true).'";'."\n";
 		echo 'var podPressDefaultPreviewImage = podPressBackendURL+"/images/vpreview_center.png";'."\n";
 
-		if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] != '1pixelout') {
+		if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] == 'podango') {
 			echo 'var podPressPlayerFile = "podango_player.swf";'."\n";
 		} else {
 			echo 'var podPressPlayerFile = "1pixelout_player.swf";'."\n";
@@ -546,10 +571,14 @@
 			add_action('the_content_rss', array(&$podPress, 'insert_content'));
 			add_action('rss2_ns', 'podPress_rss2_ns');
 			add_action('rss2_head', 'podPress_rss2_head');
+			// Remove all enclosures which were not added with podPress. They will be added again at the end of the action rss2_item.
+			add_filter('rss_enclosure', 'podPress_dont_print_nonpodpress_enclosures');
 			add_action('rss2_item', 'podPress_rss2_item');
 
 			/* stuff that goes in the atom feed */
 			add_action('atom_head', 'podPress_atom_head');
+			// Remove all enclosures which were not added with podPress. They will be added again at the end of the action atom_entry.
+			add_filter('atom_enclosure', 'podPress_dont_print_nonpodpress_enclosures');
 			add_action('atom_entry', 'podPress_atom_entry');
 			$podPress_feedHooksAdded = true;
 		}
@@ -781,3 +810,4 @@
 	$podPress->post_form_wp25plus('page');
 	echo "\n<!-- podPress dbx for modern WP versions - page -->\n";
 }
+?>
Index: podpress_admin_class.php
===================================================================
--- podpress_admin_class.php	(Revision 210539)
+++ podpress_admin_class.php	(Arbeitskopie)
@@ -178,6 +178,8 @@
 			}
 			echo '</script>'."\n";
 
+			echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n";
+
 			echo '<div id="podPressstuff" class="dbx-group">'."\n";
 			echo '	<fieldset id="podpresscontent" class="dbx-box">'."\n";
 			echo '		<h3 class="dbx-handle">'.__('Podcasting', 'podpress').'</h3> '."\n";
@@ -323,7 +325,7 @@
 				echo '							<label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n";
 				echo '						</td>'."\n";
 				echo '						<td>'."\n";
-				echo '							<input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'previewImage\'] = this.value; podPressShowPreviewImage('.$num.');" />'."\n";
+				echo '							<input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressPreviewImageOnChange('.$num.', this.value);" />'."\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
 				echo '					<tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n";
@@ -333,7 +335,7 @@
 				echo '						<td>'."\n";
 				echo '							<div id="podPressPlayerSpace_'.$num.'"></div>'."\n";
 				echo '<script type="text/javascript"><!--'."\n";
-				echo "	document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n";
+				echo "	document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', ".$thisMedia['dimensionW'].", ".$thisMedia['dimensionH'].", document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n";
 				echo "--></script>\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
@@ -343,8 +345,8 @@
 				echo '							'.__('Dimensions', 'podpress').' (WxH): '."\n";
 				echo '						</td>'."\n";
 				echo '						<td>'."\n";
-				echo '							<input type="text" id="podPressMedia_'.$num.'_dimensionW" name="podPressMedia['.$num.'][dimensionW]" size="5" value="'.$thisMedia['dimensionW'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionW\'] = this.value;" />x<input type="text" id="podPressMedia_'.$num.'_dimensionH" name="podPressMedia['.$num.'][dimensionH]" size="5" value="'.$thisMedia['dimensionH'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionH\'] = this.value;" /> '."\n";
-				echo '							<select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);	echo '</select>'."\n";
+				echo '							<input type="text" id="podPressMedia_'.$num.'_dimensionW" name="podPressMedia['.$num.'][dimensionW]" size="5" value="'.$thisMedia['dimensionW'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionW\'] = this.value; podPressUpdateDimensionList(\''.$num.'\');" />x<input type="text" id="podPressMedia_'.$num.'_dimensionH" name="podPressMedia['.$num.'][dimensionH]" size="5" value="'.$thisMedia['dimensionH'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionH\'] = this.value; podPressUpdateDimensionList(\''.$num.'\')" /> '."\n";
+				echo '							<select id="podPressMedia_'.$num.'_dimensionList" onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);	echo '</select>'."\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
 
@@ -728,6 +730,8 @@
 			}
 			echo '</script>'."\n";
 
+			echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n";
+			
 			echo '<p style="padding-bottom:1em;">'.__('To control player location in your post, put', 'podpress').' '.$this->podcastTag.' '.__(' where you want it to appear', 'podpress').'.<br /> '."\n";
 			echo ''.__('File Uploading support is not part of podPress', 'podpress').'.</p> '."\n";
 			echo '	<h4>'.__('Podcasting', 'podpress').' '.__('Files', 'podpress').':</h4>'."\n";
@@ -871,7 +875,7 @@
 				echo '							<label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n";
 				echo '						</td>'."\n";
 				echo '						<td>'."\n";
-				echo '							<input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'previewImage\'] = this.value; podPressShowPreviewImage('.$num.');" />'."\n";
+				echo '							<input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressPreviewImageOnChange('.$num.', this.value);" />'."\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
 				echo '					<tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n";
@@ -881,7 +885,7 @@
 				echo '						<td>'."\n";
 				echo '							<div id="podPressPlayerSpace_'.$num.'"></div>'."\n";
 				echo '<script type="text/javascript"><!--'."\n";
-				echo "	document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true, true);\n";
+				echo "	document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', ".$thisMedia['dimensionW'].", ".$thisMedia['dimensionH'].", document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n";
 				echo "--></script>\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
@@ -891,8 +895,8 @@
 				echo '							'.__('Dimensions', 'podpress').' (WxH): '."\n";
 				echo '						</td>'."\n";
 				echo '						<td>'."\n";
-				echo '							<input type="text" id="podPressMedia_'.$num.'_dimensionW" name="podPressMedia['.$num.'][dimensionW]" size="5" value="'.$thisMedia['dimensionW'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionW\'] = this.value;" />x<input type="text" id="podPressMedia_'.$num.'_dimensionH" name="podPressMedia['.$num.'][dimensionH]" size="5" value="'.$thisMedia['dimensionH'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionH\'] = this.value;" /> '."\n";
-				echo '							<select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);	echo '</select>'."\n";
+				echo '							<input type="text" id="podPressMedia_'.$num.'_dimensionW" name="podPressMedia['.$num.'][dimensionW]" size="5" value="'.$thisMedia['dimensionW'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionW\'] = this.value; podPressUpdateDimensionList(\''.$num.'\');" />x<input type="text" id="podPressMedia_'.$num.'_dimensionH" name="podPressMedia['.$num.'][dimensionH]" size="5" value="'.$thisMedia['dimensionH'].'" onchange="javascript: podPressMediaFiles['.$num.'][\'dimensionH\'] = this.value; podPressUpdateDimensionList(\''.$num.'\')" /> '."\n";
+				echo '							<select id="podPressMedia_'.$num.'_dimensionList" onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);	echo '</select>'."\n";
 				echo '						</td>'."\n";
 				echo '					</tr>'."\n";
 
@@ -968,7 +972,7 @@
 
 				$num++;
 			}
-			echo '			<input type="button" name="podPressAddAnother" value="Add Media File" onclick="javascript: podPressAddMediaFile(true, \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'new\', true, false, false, \'free\'); podPressDisplayMediaFiles();"/>'."\n";
+			echo '			<input type="button" name="podPressAddAnother" value="'.__('Add Media File', 'podpress').'" onclick="javascript: podPressAddMediaFile(true, \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'new\', true, false, false, \'free\'); podPressDisplayMediaFiles();"/>'."\n";
 			if($entryType != 'page') {
 				echo '			<br/>'."\n";
 				echo '			<h4>'.__('Post specific settings for iTunes', 'podpress').': </h4>'."\n";
@@ -1186,7 +1190,7 @@
 						}
 						podPress_add_post_meta($post_id, 'podPressMedia', $verifiedMedia, true) ;
 					}
-				} 
+				}
 				if(isset($_POST['iTunesSubtitleChoice']) AND $_POST['iTunesSummaryChoice'] AND $_POST['iTunesKeywordsChoice'] AND $_POST['iTunesAuthorChoice'] AND $_POST['iTunesExplicit'] AND $_POST['iTunesBlock']) {
 					if($_POST['iTunesSubtitleChoice'] == 'Custom' && !empty($_POST['iTunesSubtitle'])) {
 						$podPressPostSpecific['itunes:subtitle'] = $_POST['iTunesSubtitle'];
@@ -1253,12 +1257,13 @@
 		}
 
 		function edit_category_form($input) {
+			global $wp_version;
 			$data = podPress_get_option('podPress_category_'.$input->cat_ID);
 			$blog_charset = get_bloginfo('charset');
 			if(empty($data['podcastFeedURL'])) {
 				$data['podcastFeedURL'] = get_settings('siteurl').'/?feed=rss2&cat='.$input->cat_ID;
 			}
-			global $wp_version;
+			// Since WP 2.7 the column on the categories page is to small and scrollbars are necessary. This is only a short fix.
 			if (TRUE == version_compare($wp_version, '2.7','<') ){
 				echo '<div class="wrap">'."\n";
 			} else {
@@ -1366,7 +1371,7 @@
 			echo '				<td width="50%">';
 			echo '					<label for="iTunesImageChoice"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'."\n";
 			echo '					<br/>';
-			echo '					'.__('The iTunes image should be a square image with <a href="http://www.apple.com/itunes/podcasts/specs.html#image" target="_blank">at least 600 x 600 pixels</a> as Apple writes (01/2010) in "<a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank">Making a Podcast</a>" of their own Podcasting Resources. In the past 300 x 300 pixels were recommended. iTunes supports JPEG and PNG images (the file name extensions should ".jpg" or ".png").', 'podpress')."\n";
+			echo '					'.__('The iTunes image should be a square image with <a href="http://www.apple.com/itunes/podcasts/specs.html#image" target="_blank">at least 600 x 600 pixels</a> as Apple writes (01/2010) in "<a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank">Making a Podcast</a>" of their own Podcasting Resources. In the "<a href="http://www.apple.com/itunes/podcasts/creatorfaq.html" target="_blank">FAQs: For Podcast Makers</a>" 300 x 300 pixels are recommended by Apple. iTunes supports JPEG and PNG images (the file name extensions should ".jpg" or ".png").', 'podpress')."\n";
 			echo '					<br/>';
 			echo '					<select id="iTunesImageChoice" name="iTunesImageChoice" onchange="javascript: podPress_updateCategoryCasting();">'."\n";
 			echo '						<option value="Global" '; if($data['iTunesImageChoice'] != 'Custom') { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').'</option>'."\n";
@@ -1483,7 +1488,12 @@
 			echo '					<br/>';
 			echo '					<select id="iTunesCategory_0" name="iTunesCategory[0]" onchange="podPress_updateCategoryCasting();">'."\n";
 			echo '						<optgroup label="'.__('Select Primary', 'podpress').'">'."\n";
-			echo '						<option value="##Global##" '; if($data['iTunesCategory'][0] == '##Global##' || empty($data['iTunesCategory'][0])) { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').' ('.$this->settings['iTunes']['category'][0].')</option>'."\n";
+			if ('' == trim($this->settings['iTunes']['category'][0])) {
+				$current_global = '[ '.__('nothing', 'podpress').' ]';
+			} else {
+				$current_global = $this->settings['iTunes']['category'][0];
+			}
+			echo '						<option value="##Global##" '; if($data['iTunesCategory'][0] == '##Global##' || empty($data['iTunesCategory'][0])) { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n";
 			if (empty($data['iTunesCategory'][0])) {
 				podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset);
 			} else {
@@ -1494,7 +1504,12 @@
 			echo '					<input type="hidden" id="global_iTunesCategory" value="'.htmlentities(stripslashes($this->settings['iTunes']['category'][0]), ENT_QUOTES, $blog_charset).'" />'."\n";
 			echo '					<select name="iTunesCategory[1]">'."\n";
 			echo '						<optgroup label="'.__('Select Second', 'podpress').'">'."\n";
-			echo '						<option value="##Global##" '; if($data['iTunesCategory'][1] == '##Global##' || empty($data['iTunesCategory'][1])) { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.$this->settings['iTunes']['category'][1].')</option>'."\n";
+			if ('' == trim($this->settings['iTunes']['category'][1])) {
+				$current_global = '[ '.__('nothing', 'podpress').' ]';
+			} else {
+				$current_global = $this->settings['iTunes']['category'][1];
+			}
+			echo '						<option value="##Global##" '; if($data['iTunesCategory'][1] == '##Global##' || empty($data['iTunesCategory'][1])) { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n";
 			if (empty($data['iTunesCategory'][1])) {
 				podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset);
 			} else {
@@ -1504,7 +1519,12 @@
 			echo '					</select><br/>'."\n";
 			echo '					<select name="iTunesCategory[2]">'."\n";
 			echo '						<optgroup label="'.__('Select Third', 'podpress').'">'."\n";
-			echo '						<option value="##Global##" '; if($data['iTunesCategory'][2] == '##Global##' || empty($data['iTunesCategory'][2])) { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.$this->settings['iTunes']['category'][2].')</option>'."\n";
+			if ('' == trim($this->settings['iTunes']['category'][2])) {
+				$current_global = '[ '.__('nothing', 'podpress').' ]';
+			} else {
+				$current_global = $this->settings['iTunes']['category'][2];
+			}
+			echo '						<option value="##Global##" '; if($data['iTunesCategory'][2] == '##Global##' || empty($data['iTunesCategory'][2])) { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n";
 			if (empty($data['iTunesCategory'][2])) {
 				podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset);
 			} else {
@@ -1526,7 +1546,11 @@
 			echo '						<option value="Clean" '; if($data['iTunesExplicit'] == 'Clean') { echo 'selected="selected"';	}	echo '>'.__('Clean', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
 			echo '					<div id="iTunesExplicitHelp" style="display: none;">'."\n";
-			echo '						'.__('Headphones Required? Sets the parental advisory graphic in name column.', 'podpress')."\n";
+			echo '					'.__('Setting to indicate whether or not your podcast contains explicit material', 'podpress')."\n";
+			echo '					<br/>'.__('"No" (default) - no indicator will show up', 'podpress')."\n";
+			echo '					<br/>'.__('"Yes" - an "EXPLICIT" parental advisory graphic will appear next to your podcast artwork or name in iTunes', 'podpress')."\n";
+			echo '					<br/>'.__('"Clean" - means that you are sure that no explicit language or adult content is included any of the episodes, and a "CLEAN" graphic will appear', 'podpress')."\n";
+			echo '					<p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n";
 			echo '					</div>'."\n";
 			echo '				</td>'."\n";
 			echo '				<td width="50%">'."\n";
@@ -1537,13 +1561,13 @@
 			echo '						<option value="Global" '; if($data['rss_copyrightChoice'] != 'Custom') { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.podPress_stringLimiter(ucfirst(stripslashes($this->settings['rss_copyright'])), 40).')</option>'."\n";
 			echo '						<option value="Custom" '; if($data['rss_copyrightChoice'] == 'Custom') { echo 'selected="selected"';	}	echo '>'.__('Custom', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
-			echo '					<div id="rss_copyrightWrapper" style="display: none;">'."\n";
+			echo '					<div id="rss_copyrightHelp" style="display: none;">'."\n";
 			echo '						<input type="text" name="rss_copyright" size="40" id="rss_copyright" value="'.htmlentities(stripslashes($data['rss_copyright']), ENT_QUOTES, $blog_charset).'" onchange="javascript: podPress_updateCategoryCasting();"/>';
 			echo '						<br />'.__('Enter the complete copyright string or the license name. For example: Copyright &#169 by Jon Doe, 2009 OR <a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" target="_blank">CreativeCommons Attribution-Noncommercial-Share Alike 2.5</a>', 'podpress')."\n";
 			echo '						<input type="hidden" id="global_rss_copyright" value="'.htmlentities(stripslashes($this->settings['rss_copyright']), ENT_QUOTES, $blog_charset).'" />'."\n";
-			echo '					</div>'."\n";
-			echo '					<div id="rss_copyrightHelp" style="display: none;">'."\n";
+			echo '						<p>'."\n";
 			echo '						'.__('Used if this Copyright phrase should be different than the global copyright phrase.', 'podpress')."\n";
+			echo '						</p>'."\n";
 			echo '					</div>'."\n";
 			
 			echo '					<br /><br />'."\n";
@@ -1554,13 +1578,13 @@
 			echo '						<option value="Global" '; if($data['rss_license_urlChoice'] != 'Custom') { echo 'selected="selected"';	}	echo '>'.__('Use Global', 'podpress').' ('.podPress_stringLimiter(ucfirst(stripslashes($this->settings['rss_license_url'])), 40).')</option>'."\n";
 			echo '						<option value="Custom" '; if($data['rss_license_urlChoice'] == 'Custom') { echo 'selected="selected"';	}	echo '>'.__('Custom', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
-			echo '					<div id="rss_license_urlWrapper" style="display: none;">'."\n";
+			echo '					<div id="rss_license_urlHelp" style="display: none;">'."\n";
 			echo '						<input name="rss_license_url" type="text" id="rss_license_url" value="'.htmlentities($data['rss_license_url'], ENT_QUOTES, $blog_charset).'" size="65%" />'."\n";
 			echo '						<br />'.__('If you use a special license like a <a href="http://creativecommons.org/licenses" target="_blank" title="Creative Commons">Creative Commons</a> License for your news feeds then enter the complete URL (e.g. <a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" target="_blank">http://creativecommons.org/licenses/by-nc-sa/2.5/</a>) to the full text of this particular license here.', 'podpress')."<br/><br/>\n";
 			echo '						<input type="hidden" id="global_rss_license_url" value="'.htmlentities(stripslashes($this->settings['rss_license_url']), ENT_QUOTES, $blog_charset).'" />'."\n";
-			echo '					</div>'."\n";
-			echo '					<div id="rss_license_urlHelp" style="display: none;">'."\n";
+			echo '						<p>'."\n";
 			echo '						'.__('Used if this license URL should be different than the global license URL.', 'podpress')."\n";
+			echo '						</p>'."\n";
 			echo '					</div>'."\n";
 			
 			
@@ -1577,7 +1601,10 @@
 			echo '						<option value="Yes" '; if($data['iTunesBlock'] == 'Yes') { echo 'selected="selected"';	}	echo '>'.__('Yes', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
 			echo '					<div id="itunesBlockHelp" style="display: none;">'."\n";
-			echo '						'.__('Prevent this episode or podcast from appearing in iTunes.', 'podpress')."\n";
+			echo '					'.__('Use this if you are no longer creating a podcast and you want it removed from iTunes.', 'podpress')."\n";
+			echo '					<br/>'.__('"No" (default) - the podcast appears in the iTunes Podcast directory', 'podpress')."\n";
+			echo '					<br/>'.__('"Yes" - prevent the entire podcast from appearing in the iTunes Podcast directory', 'podpress')."\n";
+			echo '					<p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n";
 			echo '					</div>'."\n";
 			echo '				</td>'."\n";
 			echo '				<td width="50%">&nbsp;</td>'."\n";
Index: podpress_admin_feed_class.php
===================================================================
--- podpress_admin_feed_class.php	(Revision 210539)
+++ podpress_admin_feed_class.php	(Arbeitskopie)
@@ -104,7 +104,7 @@
 			echo '				<td width="50%">';
 			echo '					<label for="blogname"><strong>'.__('Blog/Podcast title', 'podpress').'</strong></label>';
 			echo '					<br/>';
-			echo '					<input type="text" id="blogname" name="blogname" size="40" value="'.htmlentities(get_option('blogname'), ENT_QUOTES, $blog_charset).'" onchange="podPress_updateFeedSettings();" /><br />'.__('Used for both Blog and Podcast.', 'podpress');
+			echo '					<input type="text" id="blogname" name="blogname" size="40" value="'.htmlentities(get_option('blogname'), ENT_QUOTES, $blog_charset).'" onchange="podPress_updateFeedSettings();" /><br />'.__('Used for both Blog and Podcast.', 'podpress').' <em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),__('the blog title', 'podpress')).'</em>';
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -119,7 +119,7 @@
 			echo '					<label for="blogdescription"><strong>'.__('Blog Description', 'podpress').'</strong></label>';
 			echo '					<br/>';
 			echo '					<textarea id="blogdescription" name="blogdescription" rows="4" cols="40" onchange="podPress_updateFeedSettings();">'.htmlentities(stripslashes(get_option('blogdescription')), ENT_QUOTES, $blog_charset).'</textarea>';
-			echo '					<br/>'.__('Standard feed description.', 'podpress')."\n";
+			echo '					<br/>'.__('Standard feed description.', 'podpress').' <em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),__('the blog description', 'podpress')).'</em>'."\n";
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -127,7 +127,7 @@
 			echo '				<td width="50%">'."\n";
 			echo '					<label for="iTunesImage"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>';
 			echo '					<br/>';
-			echo '					'.__('The iTunes image should be a square image with <a href="http://www.apple.com/itunes/podcasts/specs.html#image" target="_blank">at least 600 x 600 pixels</a> as Apple writes (2009) in "<a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank">Making a Podcast</a>" of their own Podcasting Resources. In the past 300 x 300 pixels were recommended. iTunes supports JPEG and PNG images (the file name extensions should ".jpg" or ".png").', 'podpress')."\n";
+			echo '					'.__('The iTunes image should be a square image with <a href="http://www.apple.com/itunes/podcasts/specs.html#image" target="_blank">at least 600 x 600 pixels</a> as Apple writes (01/2010) in "<a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank">Making a Podcast</a>" of their own Podcasting Resources. In the "<a href="http://www.apple.com/itunes/podcasts/creatorfaq.html" target="_blank">FAQs: For Podcast Makers</a>" 300 x 300 pixels are recommended by Apple. iTunes supports JPEG and PNG images (the file name extensions should ".jpg" or ".png").', 'podpress')."\n";
 			echo '					<br/>';
 			echo '					<input id="iTunesImage" type="text" name="iTunes[image]" value="'.$this->settings['iTunes']['image'].'" size="40" onchange="podPress_updateFeedSettings();"/>'."\n";
 			echo '					<br />';
@@ -152,7 +152,7 @@
 			echo '				<td width="50%">';
 			echo '					<label for="admin_email"><strong>'.__('Owner E-mail address', 'podpress').'</strong></label>';
 			echo '					<br/>';
-			echo '					<input name="admin_email" type="text" id="admin_email" value="'.htmlentities(stripslashes(get_option('admin_email')), ENT_QUOTES, $blog_charset).'" size="40" />';
+			echo '					<input name="admin_email" type="text" id="admin_email" value="'.htmlentities(stripslashes(get_option('admin_email')), ENT_QUOTES, $blog_charset).'" size="40" /><br /><em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),__('the email address of the blog admin', 'podpress')).'</em>';
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -164,13 +164,13 @@
 			echo '					<br/>'.__('Used as default Podcast Episode Title', 'podpress').' (255 '.__('characters', 'podpress').')'."\n";
 			echo '				</td>'."\n";
 			echo '				<td width="50%">';
-			echo '					<label for="rss_language"><strong>'.__('Language', 'podpress').'</strong></label>';
+			echo '					<label for="rss_language"><strong>'.__('Language of the News Feed content', 'podpress').'</strong></label>';
 			echo '					<br/>';
 			echo '					<select id="rss_language" name="rss_language" onchange="podPress_updateFeedSettings();">'."\n";
 			echo '						<optgroup label="'.__('Select Language', 'podpress').'">'."\n";
 			podPress_itunesLanguageOptions(get_option('rss_language'));
 			echo '						</optgroup>'."\n";
-			echo '					</select>'."\n";
+			echo '					</select>'."\n".'<br /><em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),__('the language of the main feeds of this blog', 'podpress')).'</em> <em>'.__('(This select box is not the only but probably the most comfortable way to change this option. So change it back if you do not want to use this plugin anymore.)', 'podpress').'</em>';
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -182,13 +182,13 @@
 			echo '					<br/>('.__('Comma seperated list', 'podpress').', '.__('max 8', 'podpress').')';
 			echo '				</td>'."\n";
 			echo '				<td width="50%">';
-			echo '					<label for="rss_showlinks"><strong>'.__('Show Download Links in RSS Encoded Content', 'podpress').'</strong></label>';
-			echo '					<br/>';
-			echo '					<select name="rss_showlinks" id="rss_showlinks">'."\n";
-			echo '						<option value="yes" '; if($this->settings['rss_showlinks'] == 'yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n";
-			echo '						<option value="no" '; if($this->settings['rss_showlinks'] != 'yes') { echo 'selected="selected"'; }  echo '>'.__('No', 'podpress').'</option>'."\n";
-			echo '					</select>'."\n";
-			echo '					<br/>'.__('Yes will put download links in the RSS encoded content. That means users can download from any site displaying the link.', 'podpress')."\n";
+			//~ echo '					<label for="rss_showlinks"><strong>'.__('Show Download Links in RSS Encoded Content', 'podpress').'</strong></label>';
+			//~ echo '					<br/>';
+			//~ echo '					<select name="rss_showlinks" id="rss_showlinks">'."\n";
+			//~ echo '						<option value="yes" '; if($this->settings['rss_showlinks'] == 'yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n";
+			//~ echo '						<option value="no" '; if($this->settings['rss_showlinks'] != 'yes') { echo 'selected="selected"'; }  echo '>'.__('No', 'podpress').'</option>'."\n";
+			//~ echo '					</select>'."\n";
+			//~ echo '					<br/>'.__('Yes will put download links in the RSS encoded content. That means users can download from any site displaying the link.', 'podpress')."\n";
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -229,7 +229,11 @@
 			echo '						<option value="Yes" '; if($this->settings['iTunes']['explicit'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n";
 			echo '						<option value="Clean" '; if($this->settings['iTunes']['explicit'] == 'Clean') { echo 'selected="selected"'; } echo '>'.__('Clean', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
-			echo '					<br/>'.__('Sets the parental advisory graphic in name column.', 'podpress')."\n";
+			echo '					<br/>'.__('Setting to indicate whether or not your podcast contains explicit material', 'podpress')."\n";
+			echo '					<br/>'.__('"No" (default) - no indicator will show up', 'podpress')."\n";
+			echo '					<br/>'.__('"Yes" - an "EXPLICIT" parental advisory graphic will appear next to your podcast artwork or name in iTunes', 'podpress')."\n";
+			echo '					<br/>'.__('"Clean" - means that you are sure that no explicit language or adult content is included any of the episodes, and a "CLEAN" graphic will appear', 'podpress')."\n";
+			echo '					<p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n";
 			echo '				</td>'."\n";
 			echo '				<td width="50%">'."\n";
 			echo '					<label for="rss_copyright"><strong>'.__('Feed Copyright / license name', 'podpress').'</strong></label>';
@@ -262,7 +266,7 @@
 			echo '				<td width="50%">';
 			echo '					<label for="posts_per_rss"><strong>'.__('Show the most recent', 'podpress').'</strong></label>';
 			echo '					<br/>';
-			echo '					<input type="text" id="posts_per_rss" name="posts_per_rss" size="3" value="'.htmlentities(get_option('posts_per_rss'), ENT_QUOTES, $blog_charset).'" /> '.__('posts', 'podpress');
+			echo '					<input type="text" id="posts_per_rss" name="posts_per_rss" size="3" value="'.htmlentities(get_option('posts_per_rss'), ENT_QUOTES, $blog_charset).'" /> '.__('posts', 'podpress').'<br />'.'<em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),sprintf(__('the same value as on the %1$s page', 'podpress'), __('Reading Settings'))).'</em>';
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -275,11 +279,15 @@
 			echo '						<option value="Yes" '; if($this->settings['iTunes']['block'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n";
 			echo '					</select>'."\n";
 			echo '					<br/>'.__('Use this if you are no longer creating a podcast and you want it removed from iTunes.', 'podpress')."\n";
+			echo '					<br/>'.__('"No" (default) - the podcast appears in the iTunes Podcast directory', 'podpress')."\n";
+			echo '					<br/>'.__('"Yes" - prevent the entire podcast from appearing in the iTunes Podcast directory', 'podpress')."\n";
+			echo '					<p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n";
+			
 			echo '				</td>'."\n";
 			echo '				<td width="50%">';
 			echo '					<label for="blog_charset"><strong>'.__('Encoding for pages and feeds', 'podpress').'</strong></label>';
 			echo '					<br/>';
-			echo '					<input type="text" id="blog_charset" name="blog_charset" size="20" value="'.htmlentities($blog_charset, ENT_QUOTES, $blog_charset).'" /><br />'.__('The character encoding you write your blog in', 'podpress').' ('.__('UTF-8 is', 'podpress').' <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html" target="_new">'.__('recommended', 'podpress').'</a>)';
+			echo '					<input type="text" id="blog_charset" name="blog_charset" size="20" value="'.htmlentities($blog_charset, ENT_QUOTES, $blog_charset).'" /><br />'.__('The character encoding you write your blog in', 'podpress').' ('.__('UTF-8 is', 'podpress').' <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html" target="_new">'.__('recommended', 'podpress').'</a>)'.' <em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),sprintf(__('the same value as on the %1$s page', 'podpress'), __('Reading Settings'))).'</em>';
 			echo '				</td>'."\n";
 			echo '			</tr>'."\n";
 
@@ -324,7 +332,7 @@
 
 				if(is_array($_POST['iTunes']['category'])) {
 					foreach ($_POST['iTunes']['category'] as $value) {
-						if($value != '#') {
+						if('#' != $value AND '[ '.__('nothing', 'podpress').' ]' != $value) {
 							$iTunesSettings['category'][] = $value;
 						}
 					}
Index: podpress_admin_functions.php
===================================================================
--- podpress_admin_functions.php	(Revision 210539)
+++ podpress_admin_functions.php	(Arbeitskopie)
@@ -345,7 +345,7 @@
 		$options['video_mpg'] = __('MPG - Video', 'podpress');
 		$options['video_asf'] = __('ASF - Video', 'podpress');
 		$options['video_wmv'] = __('WMV - Video', 'podpress');
-		$options['video_wma'] = __('WMA - Video', 'podpress');
+		$options['audio_wma'] = __('WMA - Audio', 'podpress');
 		$options['video_flv'] = __('FLV - Flash Video', 'podpress');
 		$options['video_swf'] = __('SWF - Flash content', 'podpress');
 		$options['ebook_pdf'] = __('PDF - eBook', 'podpress');
@@ -362,6 +362,8 @@
 	function podPress_videoDimensionOptions($selected='320:240') {
 		$dimensions = array();
 		reset($dimensions);
+		$dimensions_noimage = array();
+		reset($dimensions_noimage);
 
 		$dimensions['160:120'] = '160 x 120';
 		$dimensions['320:240'] = '320 x 240';
@@ -371,6 +373,7 @@
 		$dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]';
 		$dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]';
 		$dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]';
+		
 		echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n";
 		foreach ($dimensions as $key => $value) {
 			if ($key == $selected) {
@@ -381,6 +384,21 @@
 			echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
 		}
 		echo '</optgroup>'."\n";
+		$dimensions_noimage['160:0'] = __('width: 160 px', 'podpress');
+		$dimensions_noimage['320:0'] = __('width: 320 px', 'podpress');
+		$dimensions_noimage['640:0'] = __('width: 640 px', 'podpress');
+		$dimensions_noimage['720:0'] = __('width: 720 px', 'podpress');
+		echo '<optgroup label="'.__('player without images', 'podpress').'">'."\n";
+		foreach ($dimensions_noimage as $key => $value) {
+			if ($key == $selected) {
+				$selected_str =' selected="selected"';
+			} else {
+				$selected_str ='';
+			}
+			echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
+		}
+		echo '</optgroup>'."\n";
+
 	}
 
 	function podPress_itunesLanguageArray() {
@@ -596,7 +614,7 @@
 				$foundit = true;
 				echo ' selected="selected"';
 			}
-			echo ' >'.$value.'</option>'."\n";
+			echo '>'.$value.'</option>'."\n";
 		}
 		
 		if(!$foundit AND '##Global##' != $current) {
@@ -880,6 +898,8 @@
 	
 	function podPress_getID3tags($mediafile, $resolved = false, $limitDownload = false) {
 		GLOBAL $podPress;
+		$tmp_download_exists = FALSE;
+		
 		if($podPress->settings['enablePodangoIntegration']) {
 			if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') {
 				$fileNameParts = explode(':', $mediafile);
@@ -906,16 +926,33 @@
 			} else {
 				$uriFileName = $mediafile;
 			}
-			$uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload);
+			$siteurl = get_bloginfo('siteurl');
+			if (FALSE !== $siteurl AND FALSE !== strpos($uriFileName, $siteurl)) { // then it is not a real remote file - it is only an URL to a local file
+				// get the absolute folder of the file from the URL
+				$purl = parse_url($uriFileName);
+				$path_part = end(explode('wp-content', $purl['path']));
+				$uriFileName = WP_CONTENT_DIR.$path_part;
+			} else {
+				$uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload);
+				$tmp_download_exists = TRUE;
+			}
 		}
 
 		$fileinfo = @$getID3->analyze($uriFileName);
-
-		if(empty($fileinfo)) {
+		
+		if (empty($fileinfo)) {
 			return 'Remote MP3 File could not be read.';
 		}
 
 		getid3_lib::CopyTagsToComments($fileinfo);
+		
+		if (TRUE === $tmp_download_exists) { // if the file have been downloaded to a local folder then delete the tempfile
+			if ('' != $fileinfo['filenamepath']) { // take the folder and file from getID3 if possible
+				$unlink_result = @unlink($fileinfo['filenamepath']);
+			} else {
+				$unlink_result = @unlink($uriFileName);
+			}
+		}
 		return $fileinfo;
 	}
 	
@@ -1034,7 +1071,10 @@
 				if($pos) {
 					$ext = substr($ext, 0, $pos);
 				}
-				$localtempfilename = tempnam('/tmp', 'getID3').'.'.$ext;
+				$localtempfilename = @tempnam('/tmp', 'getID3').'.'.$ext;
+				if (FALSE == $localtempfilename OR '.'.$ext == $localtempfilename) {
+					$localtempfilename = 'podpress_tmp.'.$ext;
+				}
 				if (!$fp_local = @fopen($localtempfilename, 'wb')) {
 					$continue = false;
 				}
@@ -1116,9 +1156,11 @@
 		if(file_exists($systemFileName)) {
 			return filesize($systemFileName);
 		}
+		
+		// if it is a remote file then get the file size from the header information:
 		$uriFileName = $podPress->convertPodcastFileNameToValidWebPath($mediafile);
+		
 		// Request headers
-
 		$sRemoteHeaders = podPress_downloadFile($uriFileName, true);
 
 		// Parsing the headers
Index: podpress_feed_functions.php
===================================================================
--- podpress_feed_functions.php	(Revision 210539)
+++ podpress_feed_functions.php	(Arbeitskopie)
@@ -19,17 +19,12 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-107  USA
 */
 	/*************************************************************/
-	/* feed generation functions                                 */
+	/* feed generation functions                                 		 */
 	/*************************************************************/
 	
 	function podPress_feedSafeContent($input, $aggressive = false) {
 		GLOBAL $podPress;
-		/*
-		// if the feed should not be protect agressively (option in the backend) then return immediately
-		if ( ('no' == strtolower($podPress->settings['protectFeed']) OR FALSE === $podPress->settings['protectFeed']) AND FALSE === $aggressive) {
-			return $input;
-		}
-		*/
+
 		// replace the relevant characters with their HTML entities
 		if (TRUE === $aggressive OR 'yes' == strtolower($podPress->settings['protectFeed']) OR TRUE === $podPress->settings['protectFeed'] ) { // this option is only reachable via php source code and via the WP backend
 			if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) {
@@ -152,49 +147,68 @@
 			$rss_category = $podPress->settings['rss_category'];
 		}
 		
-		$data['rss_ttl'] = get_option('rss_ttl');
-		if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) {
-			$data['rss_ttl'] = 1440;
-		}
 		echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n";
+		
 		if (empty($data['rss_copyright'])) {
 			echo '	<copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' &#xA9; '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n";
 		} else {
 			echo '	<copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n";
 		}
-		if($data['new-feed-url'] == 'Enable') {
-			if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) {
-				echo '		<itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n";
+		
+		if (FALSE !== $data['admin_email'] AND FALSE === empty($data['admin_email'])) {
+			if ('' != trim($data['author'])) {
+				$admin_name = ' ('.podPress_feedSafeContent($data['author']).')';
+			} else {
+				$admin_name = '';
 			}
+			echo '	<managingEditor>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</managingEditor>'."\n";
+			echo '	<webMaster>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</webMaster>'."\n";
 		}
-		echo '	<managingEditor>'.podPress_feedSafeContent(stripslashes(get_option('admin_email'))).' ('.podPress_feedSafeContent($data['author']).')</managingEditor>'."\n";
-		echo '	<webMaster>'.podPress_feedSafeContent(get_option('admin_email')).' ('.podPress_feedSafeContent($data['author']).')</webMaster>'."\n";
+		
 		echo '	<category>'.podPress_feedSafeContent($rss_category).'</category>'."\n";
+		
+		$data['rss_ttl'] = get_option('rss_ttl');
+		if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) {
+			$data['rss_ttl'] = 1440;
+		}
 		if(!empty($data['rss_ttl'])) {
 			echo '	<ttl>'.$data['rss_ttl'].'</ttl>'."\n";
 		}
-		echo '	<itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n";
+		
+		if ('' != trim($data['rss_image'])) {
+			echo '	<image>'."\n";
+			echo '		<url>'.$data['rss_image'].'</url>'."\n";
+			echo '		<title>'.podPress_feedSafeContent(get_bloginfo('blogname')).'</title>'."\n";
+			echo '		<link>'.get_bloginfo('siteurl').'</link>'."\n";
+			echo '		<width>144</width>'."\n";
+			echo '		<height>144</height>'."\n";
+			echo '	</image>'."\n";
+		}
+		
+		// iTunes - tags for the channnel:
+		if($data['new-feed-url'] == 'Enable') {
+			if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) {
+				echo '		<itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n";
+			}
+		}
 		echo '	<itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle']), 255).'</itunes:subtitle>'."\n";
 		echo '	<itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($data['summary']), 4000).'</itunes:summary>'."\n";
+		echo '	<itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n";
+		echo podPress_getiTunesCategoryTags();
 		echo '	<itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n";
-		echo podPress_getiTunesCategoryTags();
 		echo '	<itunes:owner>'."\n";
 		echo '		<itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n";
 		echo '		<itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n";
 		echo '	</itunes:owner>'."\n";
-		if(empty($data['block'])) {
-			$data['block'] = 'No';
+		if ('yes' == strtolower($data['block']) OR 'no' == strtolower($data['block'])) {
+			echo '	<itunes:block>'.strtolower($data['block']).'</itunes:block>'."\n";
+		} else {
+			echo '	<itunes:block>no</itunes:block>'."\n";
 		}
-		echo '	<itunes:block>'.$data['block'].'</itunes:block>'."\n";
 		echo '	<itunes:explicit>'.podPress_feedSafeContent(strtolower($data['explicit'])).'</itunes:explicit>'."\n";
-		echo '	<itunes:image href="'.$data['image'].'" />'."\n";
-		echo '	<image>'."\n";
-		echo '		<url>'.$data['rss_image'].'</url>'."\n";
-		echo '		<title>'.podPress_feedSafeContent(get_bloginfo('blogname')).'</title>'."\n";
-		echo '		<link>'.get_bloginfo('siteurl').'</link>'."\n";
-		echo '		<width>144</width>'."\n";
-		echo '		<height>144</height>'."\n";
-		echo '	</image>'."\n";
+		if ('' != trim($data['image'])) {
+			echo '	<itunes:image href="'.$data['image'].'" />'."\n";
+		}
 	}
 
 	function podPress_rss2_item() {
@@ -253,38 +267,38 @@
 			}
 			echo '		<itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</itunes:author>'."\n";
 
-			if($post->podPressPostSpecific['itunes:explicit'] == 'Default') {
+			if ($post->podPressPostSpecific['itunes:explicit'] == 'Default') {
 				$post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit'];
-				if(empty($post->podPressPostSpecific['itunes:explicit'])) {
-					$post->podPressPostSpecific['itunes:explicit'] = 'No';
-				}
 			}
+			if ( '' == trim($post->podPressPostSpecific['itunes:explicit']) OR ('' != trim($post->podPressPostSpecific['itunes:explicit']) AND 'no' != strtolower($post->podPressPostSpecific['itunes:explicit']) AND 'yes' != strtolower($post->podPressPostSpecific['itunes:explicit']) AND 'clean' != strtolower($post->podPressPostSpecific['itunes:explicit'])) ) {
+				$post->podPressPostSpecific['itunes:explicit'] = 'No';
+			}
 			echo '		<itunes:explicit>'.podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:explicit'])).'</itunes:explicit>'."\n";
 
-			if($post->podPressPostSpecific['itunes:block'] == 'Default') {
+			if ($post->podPressPostSpecific['itunes:block'] == 'Default') {
 				$post->podPressPostSpecific['itunes:block'] = $podPress->settings['iTunes']['block'];
-				if(empty($post->podPressPostSpecific['itunes:block'])) {
-					$post->podPressPostSpecific['itunes:block'] = 'No';
-				}
 			}
-			if(empty($post->podPressPostSpecific['itunes:block'])) {
+			if ( '' == trim($post->podPressPostSpecific['itunes:block']) OR ('' != trim($post->podPressPostSpecific['itunes:block']) AND 'no' != strtolower($post->podPressPostSpecific['itunes:block']) AND 'yes' != strtolower($post->podPressPostSpecific['itunes:block'])) ) {
 				$post->podPressPostSpecific['itunes:block'] = 'No';
 			}
-			echo '		<itunes:block>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:block']).'</itunes:block>'."\n";
+			echo '		<itunes:block>'.podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:block'])).'</itunes:block>'."\n";
 			//echo '<comments>'. get_comments_link() .'</comments>'."\n";
+			
+			$episodeLicenseTags = podPress_getEpisodeLicenseTags();
+			if ($episodeLicenseTags != '')
+			{
+				echo $episodeLicenseTags;
+			}
 		}
-		$episodeLicenseTags = podPress_getEpisodeLicenseTags();
-		if ($episodeLicenseTags != '')
-		{
-			echo $episodeLicenseTags;
-		}
-		if(isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) {
+		if (isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) {
 			$post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'];
 			unset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']);
 		}
+		
+		// add the enclosures which are not added with podPress at last
+		podPress_add_nonpodpress_enclosures('rss2');
 	}
 
-
 	function podPress_atom_head() {
 		GLOBAL $podPress;
 		if(!isset($podPress->settings['category_data'])) {
@@ -308,15 +322,17 @@
 
 	function podPress_atom_entry() {
 		$enclosureTag = podPress_getEnclosureTags('atom');
-		if ($enclosureTag != '') // if no enclosure tag, no need for iTunes tags
-		{
+		if ($enclosureTag != '') { // if no enclosure tag, no need for iTunes tags
 			echo $enclosureTag;
+			
+			$episodeLicenseTags = podPress_getEpisodeLicenseTags('atom');
+			if ($episodeLicenseTags != '')	{
+				echo $episodeLicenseTags;
+			}
 		}
-		$episodeLicenseTags = podPress_getEpisodeLicenseTags('atom');
-		if ($episodeLicenseTags != '')
-		{
-			echo $episodeLicenseTags;
-		}
+		
+		// add the enclosures which are not added with podPress at last
+		podPress_add_nonpodpress_enclosures('atom');
 	}
 
 	function podPress_xspf_playlist() {
@@ -425,30 +441,19 @@
 					$post->podPressMedia[$key]['URI'] = $post->podPressMedia[$key]['URI_torrent'];
 				}
 				$hasMediaFileAccessible = true;
-
 				if(isset($_GET['onlyformat']) && $_GET['onlyformat'] != $post->podPressMedia[$key]['ext']) {
 					continue;
 				}
-
 				if(isset($_GET['format']) && $_GET['format'] == $post->podPressMedia[$key]['ext']) {
 					$preferredFormat = true;
 				}
 				if ($post->podPressMedia[$key]['rss'] == 'on' || $post->podPressMedia[$key]['atom'] == 'on' || $preferredFormat == true) {
 					if ($feedtype == 'atom' && $post->podPressMedia[$key]['atom'] == 'on') {
 						$post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToWebPath($post->ID, $key, $post->podPressMedia[$key]['URI'], 'feed');
-						global $wp_version;
-						if (TRUE == version_compare('2.3', $wp_version,'<=')) { // only if it is a newer WP version (when the ATOM feed template of WP is used)
-							// check if the URL is stored in postmeta as an enclosure (This is for the case that the wp ATOM template is in use)
-							// TRUE: don't put the same enclosure tag into the feed (WP includes the postmeta enclosures since WP 1.5 viw rss_enlosure)
-							// FALSE: ok, put the enclosure tag with the data from podPressMedia into the feed
-							$same_enclosure_URL_in_postmeta_exists = podPress_meta_data_enclosure_exists($post->ID, $post->podPressMedia[$key]['URI']);
-						}
-						if ( FALSE === $same_enclosure_URL_in_postmeta_exists ) {
-							$result .= '<link rel="enclosure" type="'.$post->podPressMedia[$key]['mimetype'].'" href="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" />'."\n";
-						}
+						$result .= '<link rel="enclosure" type="'.$post->podPressMedia[$key]['mimetype'].'" href="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" />'."\n";
 					} elseif ($feedtype == 'xspf') {
 						$post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToValidWebPath($post->podPressMedia[$key]['URI']);
-						if (podPress_getFileExt($post->podPressMedia[$key]['URI']) == 'mp3') {
+						if ( 'mp3' == podPress_getFileExt($post->podPressMedia[$key]['URI']) ) {
 							$result .= "\t\t\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n";
 							if (!empty($post->podPressMedia[$key]['title'])) {
 								$result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n";
@@ -481,12 +486,7 @@
 						}
 						$durationTag = '<itunes:duration>'.$post->podPressMedia[$key]['duration'].'</itunes:duration>'."\n";
 						
-						// check if the URL is stored in postmeta as an enclosure
-						// TRUE: don't put the same enclosure tag into the feed (WP includes the postmeta enclosures since WP 1.5 viw rss_enlosure)
-						// FALSE: ok, put the enclosure tag with the data from podPressMedia into the feed
-						$same_enclosure_URL_in_postmeta_exists = podPress_meta_data_enclosure_exists($post->ID, $post->podPressMedia[$key]['URI']);
-						
-						if($post->podPressMedia[$key]['rss'] == 'on' AND FALSE === $same_enclosure_URL_in_postmeta_exists ) {
+						if($post->podPressMedia[$key]['rss'] == 'on' ) {
 							if(!$preferredFormat && $foundPreferred) {
 								continue;
 							} elseif($preferredFormat) {
@@ -494,7 +494,7 @@
 							}
 							$result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n";
 							$result .= "\t\t".$durationTag;
-						} elseif ($preferredFormat && !$foundPreferred AND FALSE === $same_enclosure_URL_in_postmeta_exists) {
+						} elseif ($preferredFormat && !$foundPreferred) {
 							$result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n";
 							$result .= "\t\t".$durationTag;
 							$foundPreferred = true;
@@ -504,117 +504,161 @@
 			}
 		}
 		if ($hasMediaFileAccessible && $result == '' && $feedtype != 'xspf' ) {
-			if ( FALSE == $same_enclosure_URL_in_postmeta_exists ) {
-				echo "<!-- Media File exists for this post, but its not enabled for this feed -->\n";
-			} 
+			echo "<!-- Media File exists for this post, but its not enabled for this feed -->\n";
 		}
-		return $result;
+		switch ($feedtype) {
+			case 'atom' : 
+				return apply_filters('podpress_entry_enclosuretags', $result);
+			break;
+			case 'xspf' : 
+				return apply_filters('podpress_xspf_trackinformation', $result);
+			break;
+			case 'rss2' : 
+			default:
+				return apply_filters('podpress_item_enclosure_and_itunesduration', $result);
+			break;
+		}
 	}
 	
-	function podPress_meta_data_enclosure_exists($post_id, $podPressMedia_enclosure_url='') {
-		if (empty($post_id) or empty($podPressMedia_enclosure_url)) {
-			return FALSE;
-		}
-		$exists = FALSE;
-		$enclosures = (Array) get_post_meta($post_id, 'enclosure', FALSE);
-		foreach ($enclosures as $enclosure) {
-			if ( FALSE !== stristr($enclosure, $podPressMedia_enclosure_url) ) {
-				$exists = TRUE;
-			}		
-		}
-		return $exists;
+
+	// This function removes the enclosure tags of the enclosures which were not added with podPress
+	function podPress_dont_print_nonpodpress_enclosures($enclosure_tag = '') {
+		return '';
 	}
-
-function podpress_strtomilliseconds($durationstr) {
-	$dstr_parts=explode(':', $durationstr);
-	$nr_dstr_parts=count($dstr_parts);
-	if (1 < $nr_dstr_parts AND 5 > $nr_dstr_parts) {
-		switch ($nr_dstr_parts) {
-			case 2 :
-				// this method is only good if the input data which consist of two parts is most likely in the format m:s because 
-				// m:s
-				$duration = podpress_strtomilliseconds_core(1, 2, $dstr_parts);
-				if ($durationstr != podpress_millisecondstostring($duration)) {
-					// h:m
-					$duration = podpress_strtomilliseconds_core(0, 2, $dstr_parts);
-					if ($durationstr != podpress_millisecondstostring($duration)) {
-						// s:ms
-						$duration = podpress_strtomilliseconds_core(2, 2, $dstr_parts);
+	
+	// This function prints the enclosure tags of the enclosure which were not added with podPress
+	function podPress_add_nonpodpress_enclosures($feedtype) {
+		GLOBAL $podPress, $post;
+		if ( post_password_required() ) { return; }
+		foreach ( (array) get_post_custom() as $key => $val) {
+			if ($key == 'enclosure') {
+				echo "\t\t".'<!-- non-podPress enclosures: -->'."\n";
+				foreach ( (array) $val as $enc ) {
+					$is_a_link_to_podPress_media = FALSE;
+					$enclosure = explode("\n", $enc);
+					$enclosure_url = trim(htmlspecialchars($enclosure[0]));
+					// check whether the enclosure URL is equal to a podPress enclosure URL
+					// If not then print the enclosure tag else don't.
+					if ( TRUE == is_array($post->podPressMedia) ) {
+						foreach ($post->podPressMedia as $key => $value) {
+							if ( TRUE == isset($post->podPressMedia[$key]['URI']) AND $enclosure_url == $post->podPressMedia[$key]['URI'] ) {
+								$is_a_link_to_podPress_media = TRUE;
+							}
+						}
 					}
+					if (FALSE == $is_a_link_to_podPress_media) {
+						//only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'
+						$t = preg_split('/[ \t]/', trim($enclosure[2]) );
+						$type = $t[0];
+						switch ($feedtype) {
+							case 'atom' :
+								echo apply_filters('nonpodpress_atom_enclosure', "\t\t".'<link href="' . $enclosure_url . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
+							break;
+							case 'rss2':
+							default :
+								echo apply_filters('nonpodpress_rss_enclosure', "\t\t".'<enclosure url="' . $enclosure_url . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
+							break;
+						}
+					} 
 				}
-			break;
-			case 3 :
-				// h:m:s
-				$duration = podpress_strtomilliseconds_core(0, 3, $dstr_parts);
-				if ($durationstr != podpress_millisecondstostring($duration)) {
-					// m:s:ms
-					$duration = podpress_strtomilliseconds_core(1, 3, $dstr_parts);
-				}
-			break;
-			case 4 :
-				$duration = podpress_strtomilliseconds_core(0, 4, $dstr_parts);
-			break;
+			}
 		}
 	}
-	if (!isset($duration) OR $duration < 0) {
-		$duration = 0;
-	}
-	return $duration;
-}
 
-function podpress_strtomilliseconds_core($startindex=0, $max_nr_parts=4, $dstr_parts=array()){
-	$duration = $j = 0;
-	if (!empty($dstr_parts)) {
-		for ($i=$startindex; $i < ($max_nr_parts+$startindex); $i++) {
-			switch ($i) {
-				case 0 : // hours
-					$duration += 3600000 * intval(substr($dstr_parts[$j], 0, 2));
-					$j++;
+	function podpress_strtomilliseconds($durationstr) {
+		// This function converts a string which is parted by at least one double point into a milliseconds value.
+		// Because there different possible combinations of the given time string the function tries to find out what was given to it by using the inverse function.
+		// But because the uncertainty of the nature of the input value the methods of this function are certainly not bullet prove if the input value is a duration string with a milliseconds value and less than 3 parts.
+		// Better ideas are welcome! Write a ticket http://plugins.trac.wordpress.org/ or post to the forum: http://wordpress.org/support/forum/10
+		$dstr_parts=explode(':', $durationstr);
+		$nr_dstr_parts=count($dstr_parts);
+		if (1 < $nr_dstr_parts AND 5 > $nr_dstr_parts) {
+			switch ($nr_dstr_parts) {
+				case 2 :
+					// this method is only good if the input data which consist of two parts is most likely in the format m:s because 
+					// m:s
+					$duration = podpress_strtomilliseconds_core(1, 2, $dstr_parts);
+					if ($durationstr != podpress_millisecondstostring($duration)) {
+						// h:m
+						$duration = podpress_strtomilliseconds_core(0, 2, $dstr_parts);
+						if ($durationstr != podpress_millisecondstostring($duration)) {
+							// s:ms
+							$duration = podpress_strtomilliseconds_core(2, 2, $dstr_parts);
+						}
+					}
 				break;
-				case 1 : // minutes
-					$duration += 60000 * intval(substr($dstr_parts[$j], 0, 2));
-					$j++;
+				case 3 :
+					// h:m:s
+					$duration = podpress_strtomilliseconds_core(0, 3, $dstr_parts);
+					if ($durationstr != podpress_millisecondstostring($duration)) {
+						// m:s:ms
+						$duration = podpress_strtomilliseconds_core(1, 3, $dstr_parts);
+					}
 				break;
-				case 2 : // seconds
-					$duration += 1000 * intval(substr($dstr_parts[$j], 0, 2));
-					$j++;
+				case 4 :
+					$duration = podpress_strtomilliseconds_core(0, 4, $dstr_parts);
 				break;
-				case 3 : // milliseconds
-					$duration += intval(substr($dstr_parts[$j], 0, 2));
-					$j++;
-				break;
 			}
 		}
+		if (!isset($duration) OR $duration < 0) {
+			$duration = 0;
+		}
+		return $duration;
 	}
-	return $duration;
-}
 
-function podpress_millisecondstostring($duration) {
-// This function gives the milliseconds value back in the format H:M:S:MS or if the H:M:S if the milliseconds part is zero.
-// If the leading parts is zero then the return string will not contain this part.
-	$hours = intval($duration / (3600000));
-	$minutes = intval($duration / (60000) % 60);
-	$seconds = intval($duration / (1000) % 60);
-	$mseconds = intval($duration % 1000);
-	$duration_array = array($hours, $minutes, $seconds, $mseconds);
-	$dur_str ="";
-	$j=0;
-	foreach($duration_array as $key => $dur_part) {
-		if ("" == $dur_str AND 0 == $dur_part) {
-		} else {
-			if (3 == $key AND  0 == $dur_part) {
+	function podpress_strtomilliseconds_core($startindex=0, $max_nr_parts=4, $dstr_parts=array()){
+		$duration = $j = 0;
+		if (!empty($dstr_parts)) {
+			for ($i=$startindex; $i < ($max_nr_parts+$startindex); $i++) {
+				switch ($i) {
+					case 0 : // hours
+						$duration += 3600000 * intval(substr($dstr_parts[$j], 0, 2));
+						$j++;
+					break;
+					case 1 : // minutes
+						$duration += 60000 * intval(substr($dstr_parts[$j], 0, 2));
+						$j++;
+					break;
+					case 2 : // seconds
+						$duration += 1000 * intval(substr($dstr_parts[$j], 0, 2));
+						$j++;
+					break;
+					case 3 : // milliseconds
+						$duration += intval(substr($dstr_parts[$j], 0, 2));
+						$j++;
+					break;
+				}
+			}
+		}
+		return $duration;
+	}
+
+	function podpress_millisecondstostring($duration) {
+		// This function converts a milliseconds value into duration string in the format H:M:S:MS or H:M:S (if the MS part would be zero).
+		// If the leading part is zero then the return string will not contain this part.
+		$hours = intval($duration / (3600000));
+		$minutes = intval($duration / (60000) % 60);
+		$seconds = intval($duration / (1000) % 60);
+		$mseconds = intval($duration % 1000);
+		$duration_array = array($hours, $minutes, $seconds, $mseconds);
+		$dur_str ="";
+		$j=0;
+		foreach($duration_array as $key => $dur_part) {
+			if ("" == $dur_str AND 0 == $dur_part) {
 			} else {
-				if ($j > 0) { 
-					$dur_str .= ":".strval($dur_part);
+				if (3 == $key AND  0 == $dur_part) {
 				} else {
-					$dur_str .= strval($dur_part);
+					if ($j > 0) { 
+						$dur_str .= ":".strval($dur_part);
+					} else {
+						$dur_str .= strval($dur_part);
+					}
+					$j++;
 				}
-				$j++;
 			}
 		}
+		return $dur_str;
 	}
-	return $dur_str;
-}
 
 	function podPress_getiTunesCategoryTags() {
 		GLOBAL $podPress, $post;
@@ -638,11 +682,11 @@
 			foreach($data as $thiscat) {
 				if (strstr($thiscat, ':')) {
 					list($cat, $subcat) = explode(":", $thiscat);
-					$result .= "\t".'<itunes:category text="'.str_replace('&', '&amp;', $cat).'">'."\n";
-					$result .= "\t\t".'<itunes:category text="'.str_replace('&', '&amp;', $subcat).'" />'."\n";
+					$result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($cat).'">'."\n";
+					$result .= "\t\t".'<itunes:category text="'.podPress_feedSafeContent($subcat).'" />'."\n";
 					$result .= "\t".'</itunes:category>'."\n";
 				} elseif (!empty($thiscat) AND '[ '.__('nothing', 'podpress').' ]' != $thiscat ) {
-					$result .= "\t".'<itunes:category text="'.str_replace('&', '&amp;', $thiscat).'" />'."\n";
+					$result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($thiscat).'" />'."\n";
 				}
 			}
 		}

