Ticket #1064: new_feed_protection_and_fixes_for_feed_settings_pages_885b3.patch

File new_feed_protection_and_fixes_for_feed_settings_pages_885b3.patch, 65.9 KB (added by ntm, 2 years ago)
  • podpress.php

     
    11<?php 
    22define('PODPRESS_VERSION', '8.8'); 
    3 define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 2'); 
     3define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 3'); 
    44/* 
    55 Info for WordPress: 
    66 ============================================================================== 
    77 Plugin Name: podPress 
    8  Version: 8.8.5-beta_2 
     8 Version: 8.8.5-beta_3 
    99 Plugin URI: http://www.mightyseek.com/podpress/ 
    1010 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. 
    1111 Author: Dan Kuykendall (Seek3r) 
     
    3737 
    3838 Contributors: 
    3939 ============================================================================== 
    40  Developer              Dan Kuykendall      http://www.mightyseek.com/ 
    41  Developer              David Maciejewski   http://www.macx.de/ 
    42  Forum Support/BugBoy   Jeff Norris         http://www.iscifi.tv/ 
     40 Developer                      Dan Kuykendall  http://www.mightyseek.com/ 
     41 Developer                      David Maciejewski       http://www.macx.de/ 
     42 Forum Support/BugBoy   Jeff Norris             http://www.iscifi.tv/ 
    4343 
    44  Audio player           Martin Laine        http://www.1pixelout.net 
    45  WP-iPodCatter          Garrick Van Buren   http://garrickvanburen.com/ 
     44 Audio player                   Martin Laine            http://www.1pixelout.net 
     45 WP-iPodCatter          Garrick Van Buren       http://garrickvanburen.com/ 
    4646 
    4747 Thanks to all contributors and bug reporters! :) 
    4848 
     
    9191if (!defined('PLUGINDIR')) { define('PLUGINDIR', 'wp-content/plugins'); } 
    9292if (!defined('PODPRESSPLUGINDIR')) { define('PODPRESSPLUGINDIR', ABSPATH.PLUGINDIR); } 
    9393 
     94// Begin - XSPF Jukebox player configuration: 
     95// Background-color of the player <object> 
     96if ( ! defined( 'PODPRESS_XSPF_BACKGROUND_COLOR' ) ) { define( 'PODPRESS_XSPF_BACKGROUND_COLOR', 'FFFFFF' ); } 
     97 
     98// 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 
     99// 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/ 
     100// if ( ! defined('PODPRESS_XSPF_PLAYER_USE_CUSTOM_SKINFILE') ) { define('PODPRESS_XSPF_PLAYER_USE_CUSTOM_SKINFILE', TRUE); } 
     101 
     102// 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.) 
     103if ( ! defined( 'PODPRESS_XSPF_MIN_PLAYER_WIDTH' ) ) { define( 'PODPRESS_XSPF_MIN_PLAYER_WIDTH', 170 ); } 
     104 
     105// 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. 
     106if ( ! defined( 'PODPRESS_XSPF_PLAYER_HEIGHT' ) ) { define( 'PODPRESS_XSPF_PLAYER_HEIGHT', 210 ); } 
     107if ( ! defined( 'PODPRESS_XSPF_SLIM_PLAYER_HEIGHT' ) ) { define( 'PODPRESS_XSPF_SLIM_PLAYER_HEIGHT', 30 ); } 
     108 
     109// 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): 
     110// if ( ! defined('PODPRESS_XSPF_SHOW_PREVIEW_IMAGE') ) { define('PODPRESS_XSPF_SHOW_PREVIEW_IMAGE', TRUE); } 
     111 
     112// podPress uses the parameters: &autoload=true&autoplay=false&loaded=true to load the XSPF player 
     113// 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/. 
     114// if ( ! defined('PODPRESS_XSPF_USE_CUSTOM_VARIABLES') ) { define('PODPRESS_XSPF_USE_CUSTOM_VARIABLES', TRUE); } 
     115// if ( ! defined('PODPRESS_XSPF_SLIM_USE_CUSTOM_VARIABLES') ) { define('PODPRESS_XSPF_SLIM_USE_CUSTOM_VARIABLES', TRUE); } 
     116// End - XSPF Jukebox player configuration 
     117 
     118 
    94119if(!function_exists('memory_get_usage')) { 
    95120        unset($_GET['podpress_showmem']); 
    96121        function memory_get_usage() { return 0; } 
     
    154179        podPress_checkmem('podPress base class included'); 
    155180        require_once(ABSPATH.PLUGINDIR.'/podpress/podpress_functions.php'); 
    156181        podPress_checkmem('podPress functions loaded'); 
    157  
     182         
    158183        if($podPress_x = @parse_url($_SERVER['REQUEST_URI'])) { 
    159184                $podPress_x = $podPress_x['path']; 
    160185                if (strpos($podPress_x, 'crossdomain.xml')) { 
     
    271296                echo 'podPressBackendURL = podPressBackendURL+"//"+location.hostname+"'.podPress_url(true).'";'."\n"; 
    272297                echo 'var podPressDefaultPreviewImage = podPressBackendURL+"/images/vpreview_center.png";'."\n"; 
    273298 
    274                 if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] != '1pixelout') { 
     299                if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] == 'podango') { 
    275300                        echo 'var podPressPlayerFile = "podango_player.swf";'."\n"; 
    276301                } else { 
    277302                        echo 'var podPressPlayerFile = "1pixelout_player.swf";'."\n"; 
     
    546571                        add_action('the_content_rss', array(&$podPress, 'insert_content')); 
    547572                        add_action('rss2_ns', 'podPress_rss2_ns'); 
    548573                        add_action('rss2_head', 'podPress_rss2_head'); 
     574                        // Remove all enclosures which were not added with podPress. They will be added again at the end of the action rss2_item. 
     575                        add_filter('rss_enclosure', 'podPress_dont_print_nonpodpress_enclosures'); 
    549576                        add_action('rss2_item', 'podPress_rss2_item'); 
    550577 
    551578                        /* stuff that goes in the atom feed */ 
    552579                        add_action('atom_head', 'podPress_atom_head'); 
     580                        // Remove all enclosures which were not added with podPress. They will be added again at the end of the action atom_entry. 
     581                        add_filter('atom_enclosure', 'podPress_dont_print_nonpodpress_enclosures'); 
    553582                        add_action('atom_entry', 'podPress_atom_entry'); 
    554583                        $podPress_feedHooksAdded = true; 
    555584                } 
     
    781810        $podPress->post_form_wp25plus('page'); 
    782811        echo "\n<!-- podPress dbx for modern WP versions - page -->\n"; 
    783812} 
     813?> 
  • podpress_admin_class.php

     
    178178                        } 
    179179                        echo '</script>'."\n"; 
    180180 
     181                        echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n"; 
     182 
    181183                        echo '<div id="podPressstuff" class="dbx-group">'."\n"; 
    182184                        echo '  <fieldset id="podpresscontent" class="dbx-box">'."\n"; 
    183185                        echo '          <h3 class="dbx-handle">'.__('Podcasting', 'podpress').'</h3> '."\n"; 
     
    323325                                echo '                                                  <label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n"; 
    324326                                echo '                                          </td>'."\n"; 
    325327                                echo '                                          <td>'."\n"; 
    326                                 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"; 
     328                                echo '                                                  <input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressPreviewImageOnChange('.$num.', this.value);" />'."\n"; 
    327329                                echo '                                          </td>'."\n"; 
    328330                                echo '                                  </tr>'."\n"; 
    329331                                echo '                                  <tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n"; 
     
    333335                                echo '                                          <td>'."\n"; 
    334336                                echo '                                                  <div id="podPressPlayerSpace_'.$num.'"></div>'."\n"; 
    335337                                echo '<script type="text/javascript"><!--'."\n"; 
    336                                 echo "  document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n"; 
     338                                echo "  document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', ".$thisMedia['dimensionW'].", ".$thisMedia['dimensionH'].", document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n"; 
    337339                                echo "--></script>\n"; 
    338340                                echo '                                          </td>'."\n"; 
    339341                                echo '                                  </tr>'."\n"; 
     
    343345                                echo '                                                  '.__('Dimensions', 'podpress').' (WxH): '."\n"; 
    344346                                echo '                                          </td>'."\n"; 
    345347                                echo '                                          <td>'."\n"; 
    346                                 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"; 
    347                                 echo '                                                  <select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);       echo '</select>'."\n"; 
     348                                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"; 
     349                                echo '                                                  <select id="podPressMedia_'.$num.'_dimensionList" onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);     echo '</select>'."\n"; 
    348350                                echo '                                          </td>'."\n"; 
    349351                                echo '                                  </tr>'."\n"; 
    350352 
     
    728730                        } 
    729731                        echo '</script>'."\n"; 
    730732 
     733                        echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n"; 
     734                         
    731735                        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"; 
    732736                        echo ''.__('File Uploading support is not part of podPress', 'podpress').'.</p> '."\n"; 
    733737                        echo '  <h4>'.__('Podcasting', 'podpress').' '.__('Files', 'podpress').':</h4>'."\n"; 
     
    871875                                echo '                                                  <label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n"; 
    872876                                echo '                                          </td>'."\n"; 
    873877                                echo '                                          <td>'."\n"; 
    874                                 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"; 
     878                                echo '                                                  <input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPressPreviewImageOnChange('.$num.', this.value);" />'."\n"; 
    875879                                echo '                                          </td>'."\n"; 
    876880                                echo '                                  </tr>'."\n"; 
    877881                                echo '                                  <tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n"; 
     
    881885                                echo '                                          <td>'."\n"; 
    882886                                echo '                                                  <div id="podPressPlayerSpace_'.$num.'"></div>'."\n"; 
    883887                                echo '<script type="text/javascript"><!--'."\n"; 
    884                                 echo "  document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true, true);\n"; 
     888                                echo "  document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', ".$thisMedia['dimensionW'].", ".$thisMedia['dimensionH'].", document.getElementById('podPressMedia_".$num."_previewImage').value, true);\n"; 
    885889                                echo "--></script>\n"; 
    886890                                echo '                                          </td>'."\n"; 
    887891                                echo '                                  </tr>'."\n"; 
     
    891895                                echo '                                                  '.__('Dimensions', 'podpress').' (WxH): '."\n"; 
    892896                                echo '                                          </td>'."\n"; 
    893897                                echo '                                          <td>'."\n"; 
    894                                 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"; 
    895                                 echo '                                                  <select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);       echo '</select>'."\n"; 
     898                                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"; 
     899                                echo '                                                  <select id="podPressMedia_'.$num.'_dimensionList" onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']);     echo '</select>'."\n"; 
    896900                                echo '                                          </td>'."\n"; 
    897901                                echo '                                  </tr>'."\n"; 
    898902 
     
    968972 
    969973                                $num++; 
    970974                        } 
    971                         echo '                  <input type="button" name="podPressAddAnother" value="Add Media File" onclick="javascript: podPressAddMediaFile(true, \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'new\', true, false, false, \'free\'); podPressDisplayMediaFiles();"/>'."\n"; 
     975                        echo '                  <input type="button" name="podPressAddAnother" value="'.__('Add Media File', 'podpress').'" onclick="javascript: podPressAddMediaFile(true, \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'\', \'new\', true, false, false, \'free\'); podPressDisplayMediaFiles();"/>'."\n"; 
    972976                        if($entryType != 'page') { 
    973977                                echo '                  <br/>'."\n"; 
    974978                                echo '                  <h4>'.__('Post specific settings for iTunes', 'podpress').': </h4>'."\n"; 
     
    11861190                                                } 
    11871191                                                podPress_add_post_meta($post_id, 'podPressMedia', $verifiedMedia, true) ; 
    11881192                                        } 
    1189                                 }  
     1193                                } 
    11901194                                if(isset($_POST['iTunesSubtitleChoice']) AND $_POST['iTunesSummaryChoice'] AND $_POST['iTunesKeywordsChoice'] AND $_POST['iTunesAuthorChoice'] AND $_POST['iTunesExplicit'] AND $_POST['iTunesBlock']) { 
    11911195                                        if($_POST['iTunesSubtitleChoice'] == 'Custom' && !empty($_POST['iTunesSubtitle'])) { 
    11921196                                                $podPressPostSpecific['itunes:subtitle'] = $_POST['iTunesSubtitle']; 
     
    12531257                } 
    12541258 
    12551259                function edit_category_form($input) { 
     1260                        global $wp_version; 
    12561261                        $data = podPress_get_option('podPress_category_'.$input->cat_ID); 
    12571262                        $blog_charset = get_bloginfo('charset'); 
    12581263                        if(empty($data['podcastFeedURL'])) { 
    12591264                                $data['podcastFeedURL'] = get_settings('siteurl').'/?feed=rss2&cat='.$input->cat_ID; 
    12601265                        } 
    1261                         global $wp_version; 
     1266                        // Since WP 2.7 the column on the categories page is to small and scrollbars are necessary. This is only a short fix. 
    12621267                        if (TRUE == version_compare($wp_version, '2.7','<') ){ 
    12631268                                echo '<div class="wrap">'."\n"; 
    12641269                        } else { 
     
    13661371                        echo '                          <td width="50%">'; 
    13671372                        echo '                                  <label for="iTunesImageChoice"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'."\n"; 
    13681373                        echo '                                  <br/>'; 
    1369                         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"; 
     1374                        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"; 
    13701375                        echo '                                  <br/>'; 
    13711376                        echo '                                  <select id="iTunesImageChoice" name="iTunesImageChoice" onchange="javascript: podPress_updateCategoryCasting();">'."\n"; 
    13721377                        echo '                                          <option value="Global" '; if($data['iTunesImageChoice'] != 'Custom') { echo 'selected="selected"';      }       echo '>'.__('Use Global', 'podpress').'</option>'."\n"; 
     
    14831488                        echo '                                  <br/>'; 
    14841489                        echo '                                  <select id="iTunesCategory_0" name="iTunesCategory[0]" onchange="podPress_updateCategoryCasting();">'."\n"; 
    14851490                        echo '                                          <optgroup label="'.__('Select Primary', 'podpress').'">'."\n"; 
    1486                         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"; 
     1491                        if ('' == trim($this->settings['iTunes']['category'][0])) { 
     1492                                $current_global = '[ '.__('nothing', 'podpress').' ]'; 
     1493                        } else { 
     1494                                $current_global = $this->settings['iTunes']['category'][0]; 
     1495                        } 
     1496                        echo '                                          <option value="##Global##" '; if($data['iTunesCategory'][0] == '##Global##' || empty($data['iTunesCategory'][0])) { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n"; 
    14871497                        if (empty($data['iTunesCategory'][0])) { 
    14881498                                podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 
    14891499                        } else { 
     
    14941504                        echo '                                  <input type="hidden" id="global_iTunesCategory" value="'.htmlentities(stripslashes($this->settings['iTunes']['category'][0]), ENT_QUOTES, $blog_charset).'" />'."\n"; 
    14951505                        echo '                                  <select name="iTunesCategory[1]">'."\n"; 
    14961506                        echo '                                          <optgroup label="'.__('Select Second', 'podpress').'">'."\n"; 
    1497                         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"; 
     1507                        if ('' == trim($this->settings['iTunes']['category'][1])) { 
     1508                                $current_global = '[ '.__('nothing', 'podpress').' ]'; 
     1509                        } else { 
     1510                                $current_global = $this->settings['iTunes']['category'][1]; 
     1511                        } 
     1512                        echo '                                          <option value="##Global##" '; if($data['iTunesCategory'][1] == '##Global##' || empty($data['iTunesCategory'][1])) { echo 'selected="selected"'; }       echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n"; 
    14981513                        if (empty($data['iTunesCategory'][1])) { 
    14991514                                podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 
    15001515                        } else { 
     
    15041519                        echo '                                  </select><br/>'."\n"; 
    15051520                        echo '                                  <select name="iTunesCategory[2]">'."\n"; 
    15061521                        echo '                                          <optgroup label="'.__('Select Third', 'podpress').'">'."\n"; 
    1507                         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"; 
     1522                        if ('' == trim($this->settings['iTunes']['category'][2])) { 
     1523                                $current_global = '[ '.__('nothing', 'podpress').' ]'; 
     1524                        } else { 
     1525                                $current_global = $this->settings['iTunes']['category'][2]; 
     1526                        } 
     1527                        echo '                                          <option value="##Global##" '; if($data['iTunesCategory'][2] == '##Global##' || empty($data['iTunesCategory'][2])) { echo 'selected="selected"'; }       echo '>'.__('Use Global', 'podpress').' ('.$current_global.')</option>'."\n"; 
    15081528                        if (empty($data['iTunesCategory'][2])) { 
    15091529                                podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 
    15101530                        } else { 
     
    15261546                        echo '                                          <option value="Clean" '; if($data['iTunesExplicit'] == 'Clean') { echo 'selected="selected"';   }       echo '>'.__('Clean', 'podpress').'</option>'."\n"; 
    15271547                        echo '                                  </select>'."\n"; 
    15281548                        echo '                                  <div id="iTunesExplicitHelp" style="display: none;">'."\n"; 
    1529                         echo '                                          '.__('Headphones Required? Sets the parental advisory graphic in name column.', 'podpress')."\n"; 
     1549                        echo '                                  '.__('Setting to indicate whether or not your podcast contains explicit material', 'podpress')."\n"; 
     1550                        echo '                                  <br/>'.__('"No" (default) - no indicator will show up', 'podpress')."\n"; 
     1551                        echo '                                  <br/>'.__('"Yes" - an "EXPLICIT" parental advisory graphic will appear next to your podcast artwork or name in iTunes', 'podpress')."\n"; 
     1552                        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"; 
     1553                        echo '                                  <p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n"; 
    15301554                        echo '                                  </div>'."\n"; 
    15311555                        echo '                          </td>'."\n"; 
    15321556                        echo '                          <td width="50%">'."\n"; 
     
    15371561                        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"; 
    15381562                        echo '                                          <option value="Custom" '; if($data['rss_copyrightChoice'] == 'Custom') { echo 'selected="selected"';    }       echo '>'.__('Custom', 'podpress').'</option>'."\n"; 
    15391563                        echo '                                  </select>'."\n"; 
    1540                         echo '                                  <div id="rss_copyrightWrapper" style="display: none;">'."\n"; 
     1564                        echo '                                  <div id="rss_copyrightHelp" style="display: none;">'."\n"; 
    15411565                        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();"/>'; 
    15421566                        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"; 
    15431567                        echo '                                          <input type="hidden" id="global_rss_copyright" value="'.htmlentities(stripslashes($this->settings['rss_copyright']), ENT_QUOTES, $blog_charset).'" />'."\n"; 
    1544                         echo '                                  </div>'."\n"; 
    1545                         echo '                                  <div id="rss_copyrightHelp" style="display: none;">'."\n"; 
     1568                        echo '                                          <p>'."\n"; 
    15461569                        echo '                                          '.__('Used if this Copyright phrase should be different than the global copyright phrase.', 'podpress')."\n"; 
     1570                        echo '                                          </p>'."\n"; 
    15471571                        echo '                                  </div>'."\n"; 
    15481572                         
    15491573                        echo '                                  <br /><br />'."\n"; 
     
    15541578                        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"; 
    15551579                        echo '                                          <option value="Custom" '; if($data['rss_license_urlChoice'] == 'Custom') { echo 'selected="selected"';  }       echo '>'.__('Custom', 'podpress').'</option>'."\n"; 
    15561580                        echo '                                  </select>'."\n"; 
    1557                         echo '                                  <div id="rss_license_urlWrapper" style="display: none;">'."\n"; 
     1581                        echo '                                  <div id="rss_license_urlHelp" style="display: none;">'."\n"; 
    15581582                        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"; 
    15591583                        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"; 
    15601584                        echo '                                          <input type="hidden" id="global_rss_license_url" value="'.htmlentities(stripslashes($this->settings['rss_license_url']), ENT_QUOTES, $blog_charset).'" />'."\n"; 
    1561                         echo '                                  </div>'."\n"; 
    1562                         echo '                                  <div id="rss_license_urlHelp" style="display: none;">'."\n"; 
     1585                        echo '                                          <p>'."\n"; 
    15631586                        echo '                                          '.__('Used if this license URL should be different than the global license URL.', 'podpress')."\n"; 
     1587                        echo '                                          </p>'."\n"; 
    15641588                        echo '                                  </div>'."\n"; 
    15651589                         
    15661590                         
     
    15771601                        echo '                                          <option value="Yes" '; if($data['iTunesBlock'] == 'Yes') { echo 'selected="selected"';  }       echo '>'.__('Yes', 'podpress').'</option>'."\n"; 
    15781602                        echo '                                  </select>'."\n"; 
    15791603                        echo '                                  <div id="itunesBlockHelp" style="display: none;">'."\n"; 
    1580                         echo '                                          '.__('Prevent this episode or podcast from appearing in iTunes.', 'podpress')."\n"; 
     1604                        echo '                                  '.__('Use this if you are no longer creating a podcast and you want it removed from iTunes.', 'podpress')."\n"; 
     1605                        echo '                                  <br/>'.__('"No" (default) - the podcast appears in the iTunes Podcast directory', 'podpress')."\n"; 
     1606                        echo '                                  <br/>'.__('"Yes" - prevent the entire podcast from appearing in the iTunes Podcast directory', 'podpress')."\n"; 
     1607                        echo '                                  <p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n"; 
    15811608                        echo '                                  </div>'."\n"; 
    15821609                        echo '                          </td>'."\n"; 
    15831610                        echo '                          <td width="50%">&nbsp;</td>'."\n"; 
  • podpress_admin_feed_class.php

     
    104104                        echo '                          <td width="50%">'; 
    105105                        echo '                                  <label for="blogname"><strong>'.__('Blog/Podcast title', 'podpress').'</strong></label>'; 
    106106                        echo '                                  <br/>'; 
    107                         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'); 
     107                        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>'; 
    108108                        echo '                          </td>'."\n"; 
    109109                        echo '                  </tr>'."\n"; 
    110110 
     
    119119                        echo '                                  <label for="blogdescription"><strong>'.__('Blog Description', 'podpress').'</strong></label>'; 
    120120                        echo '                                  <br/>'; 
    121121                        echo '                                  <textarea id="blogdescription" name="blogdescription" rows="4" cols="40" onchange="podPress_updateFeedSettings();">'.htmlentities(stripslashes(get_option('blogdescription')), ENT_QUOTES, $blog_charset).'</textarea>'; 
    122                         echo '                                  <br/>'.__('Standard feed description.', 'podpress')."\n"; 
     122                        echo '                                  <br/>'.__('Standard feed description.', 'podpress').' <em class="message error">'.sprintf(__('Changes here will affect %1$s!', 'podpress'),__('the blog description', 'podpress')).'</em>'."\n"; 
    123123                        echo '                          </td>'."\n"; 
    124124                        echo '                  </tr>'."\n"; 
    125125 
     
    127127                        echo '                          <td width="50%">'."\n"; 
    128128                        echo '                                  <label for="iTunesImage"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'; 
    129129                        echo '                                  <br/>'; 
    130                         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"; 
     130                        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"; 
    131131                        echo '                                  <br/>'; 
    132132                        echo '                                  <input id="iTunesImage" type="text" name="iTunes[image]" value="'.$this->settings['iTunes']['image'].'" size="40" onchange="podPress_updateFeedSettings();"/>'."\n"; 
    133133                        echo '                                  <br />'; 
     
    152152                        echo '                          <td width="50%">'; 
    153153                        echo '                                  <label for="admin_email"><strong>'.__('Owner E-mail address', 'podpress').'</strong></label>'; 
    154154                        echo '                                  <br/>'; 
    155                         echo '                                  <input name="admin_email" type="text" id="admin_email" value="'.htmlentities(stripslashes(get_option('admin_email')), ENT_QUOTES, $blog_charset).'" size="40" />'; 
     155                        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>'; 
    156156                        echo '                          </td>'."\n"; 
    157157                        echo '                  </tr>'."\n"; 
    158158 
     
    164164                        echo '                                  <br/>'.__('Used as default Podcast Episode Title', 'podpress').' (255 '.__('characters', 'podpress').')'."\n"; 
    165165                        echo '                          </td>'."\n"; 
    166166                        echo '                          <td width="50%">'; 
    167                         echo '                                  <label for="rss_language"><strong>'.__('Language', 'podpress').'</strong></label>'; 
     167                        echo '                                  <label for="rss_language"><strong>'.__('Language of the News Feed content', 'podpress').'</strong></label>'; 
    168168                        echo '                                  <br/>'; 
    169169                        echo '                                  <select id="rss_language" name="rss_language" onchange="podPress_updateFeedSettings();">'."\n"; 
    170170                        echo '                                          <optgroup label="'.__('Select Language', 'podpress').'">'."\n"; 
    171171                        podPress_itunesLanguageOptions(get_option('rss_language')); 
    172172                        echo '                                          </optgroup>'."\n"; 
    173                         echo '                                  </select>'."\n"; 
     173                        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>'; 
    174174                        echo '                          </td>'."\n"; 
    175175                        echo '                  </tr>'."\n"; 
    176176 
     
    182182                        echo '                                  <br/>('.__('Comma seperated list', 'podpress').', '.__('max 8', 'podpress').')'; 
    183183                        echo '                          </td>'."\n"; 
    184184                        echo '                          <td width="50%">'; 
    185                         echo '                                  <label for="rss_showlinks"><strong>'.__('Show Download Links in RSS Encoded Content', 'podpress').'</strong></label>'; 
    186                         echo '                                  <br/>'; 
    187                         echo '                                  <select name="rss_showlinks" id="rss_showlinks">'."\n"; 
    188                         echo '                                          <option value="yes" '; if($this->settings['rss_showlinks'] == 'yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 
    189                         echo '                                          <option value="no" '; if($this->settings['rss_showlinks'] != 'yes') { echo 'selected="selected"'; }  echo '>'.__('No', 'podpress').'</option>'."\n"; 
    190                         echo '                                  </select>'."\n"; 
    191                         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"; 
     185                        //~ echo '                                      <label for="rss_showlinks"><strong>'.__('Show Download Links in RSS Encoded Content', 'podpress').'</strong></label>'; 
     186                        //~ echo '                                      <br/>'; 
     187                        //~ echo '                                      <select name="rss_showlinks" id="rss_showlinks">'."\n"; 
     188                        //~ echo '                                              <option value="yes" '; if($this->settings['rss_showlinks'] == 'yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 
     189                        //~ echo '                                              <option value="no" '; if($this->settings['rss_showlinks'] != 'yes') { echo 'selected="selected"'; }  echo '>'.__('No', 'podpress').'</option>'."\n"; 
     190                        //~ echo '                                      </select>'."\n"; 
     191                        //~ 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"; 
    192192                        echo '                          </td>'."\n"; 
    193193                        echo '                  </tr>'."\n"; 
    194194 
     
    229229                        echo '                                          <option value="Yes" '; if($this->settings['iTunes']['explicit'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 
    230230                        echo '                                          <option value="Clean" '; if($this->settings['iTunes']['explicit'] == 'Clean') { echo 'selected="selected"'; } echo '>'.__('Clean', 'podpress').'</option>'."\n"; 
    231231                        echo '                                  </select>'."\n"; 
    232                         echo '                                  <br/>'.__('Sets the parental advisory graphic in name column.', 'podpress')."\n"; 
     232                        echo '                                  <br/>'.__('Setting to indicate whether or not your podcast contains explicit material', 'podpress')."\n"; 
     233                        echo '                                  <br/>'.__('"No" (default) - no indicator will show up', 'podpress')."\n"; 
     234                        echo '                                  <br/>'.__('"Yes" - an "EXPLICIT" parental advisory graphic will appear next to your podcast artwork or name in iTunes', 'podpress')."\n"; 
     235                        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"; 
     236                        echo '                                  <p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n"; 
    233237                        echo '                          </td>'."\n"; 
    234238                        echo '                          <td width="50%">'."\n"; 
    235239                        echo '                                  <label for="rss_copyright"><strong>'.__('Feed Copyright / license name', 'podpress').'</strong></label>'; 
     
    262266                        echo '                          <td width="50%">'; 
    263267                        echo '                                  <label for="posts_per_rss"><strong>'.__('Show the most recent', 'podpress').'</strong></label>'; 
    264268                        echo '                                  <br/>'; 
    265                         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'); 
     269                        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>'; 
    266270                        echo '                          </td>'."\n"; 
    267271                        echo '                  </tr>'."\n"; 
    268272 
     
    275279                        echo '                                          <option value="Yes" '; if($this->settings['iTunes']['block'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 
    276280                        echo '                                  </select>'."\n"; 
    277281                        echo '                                  <br/>'.__('Use this if you are no longer creating a podcast and you want it removed from iTunes.', 'podpress')."\n"; 
     282                        echo '                                  <br/>'.__('"No" (default) - the podcast appears in the iTunes Podcast directory', 'podpress')."\n"; 
     283                        echo '                                  <br/>'.__('"Yes" - prevent the entire podcast from appearing in the iTunes Podcast directory', 'podpress')."\n"; 
     284                        echo '                                  <p>'.__('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress').'</p>'."\n"; 
     285                         
    278286                        echo '                          </td>'."\n"; 
    279287                        echo '                          <td width="50%">'; 
    280288                        echo '                                  <label for="blog_charset"><strong>'.__('Encoding for pages and feeds', 'podpress').'</strong></label>'; 
    281289                        echo '                                  <br/>'; 
    282                         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>)'; 
     290                        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>'; 
    283291                        echo '                          </td>'."\n"; 
    284292                        echo '                  </tr>'."\n"; 
    285293 
     
    324332 
    325333                                if(is_array($_POST['iTunes']['category'])) { 
    326334                                        foreach ($_POST['iTunes']['category'] as $value) { 
    327                                                 if($value != '#') { 
     335                                                if('#' != $value AND '[ '.__('nothing', 'podpress').' ]' != $value) { 
    328336                                                        $iTunesSettings['category'][] = $value; 
    329337                                                } 
    330338                                        } 
  • podpress_admin_functions.php

     
    345345                $options['video_mpg'] = __('MPG - Video', 'podpress'); 
    346346                $options['video_asf'] = __('ASF - Video', 'podpress'); 
    347347                $options['video_wmv'] = __('WMV - Video', 'podpress'); 
    348                 $options['video_wma'] = __('WMA - Video', 'podpress'); 
     348                $options['audio_wma'] = __('WMA - Audio', 'podpress'); 
    349349                $options['video_flv'] = __('FLV - Flash Video', 'podpress'); 
    350350                $options['video_swf'] = __('SWF - Flash content', 'podpress'); 
    351351                $options['ebook_pdf'] = __('PDF - eBook', 'podpress'); 
     
    362362        function podPress_videoDimensionOptions($selected='320:240') { 
    363363                $dimensions = array(); 
    364364                reset($dimensions); 
     365                $dimensions_noimage = array(); 
     366                reset($dimensions_noimage); 
    365367 
    366368                $dimensions['160:120'] = '160 x 120'; 
    367369                $dimensions['320:240'] = '320 x 240'; 
     
    371373                $dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]'; 
    372374                $dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]'; 
    373375                $dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]'; 
     376                 
    374377                echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n"; 
    375378                foreach ($dimensions as $key => $value) { 
    376379                        if ($key == $selected) { 
     
    381384                        echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n"; 
    382385                } 
    383386                echo '</optgroup>'."\n"; 
     387                $dimensions_noimage['160:0'] = __('width: 160 px', 'podpress'); 
     388                $dimensions_noimage['320:0'] = __('width: 320 px', 'podpress'); 
     389                $dimensions_noimage['640:0'] = __('width: 640 px', 'podpress'); 
     390                $dimensions_noimage['720:0'] = __('width: 720 px', 'podpress'); 
     391                echo '<optgroup label="'.__('player without images', 'podpress').'">'."\n"; 
     392                foreach ($dimensions_noimage as $key => $value) { 
     393                        if ($key == $selected) { 
     394                                $selected_str =' selected="selected"'; 
     395                        } else { 
     396                                $selected_str =''; 
     397                        } 
     398                        echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n"; 
     399                } 
     400                echo '</optgroup>'."\n"; 
     401 
    384402        } 
    385403 
    386404        function podPress_itunesLanguageArray() { 
     
    596614                                $foundit = true; 
    597615                                echo ' selected="selected"'; 
    598616                        } 
    599                         echo ' >'.$value.'</option>'."\n"; 
     617                        echo '>'.$value.'</option>'."\n"; 
    600618                } 
    601619                 
    602620                if(!$foundit AND '##Global##' != $current) { 
     
    880898         
    881899        function podPress_getID3tags($mediafile, $resolved = false, $limitDownload = false) { 
    882900                GLOBAL $podPress; 
     901                $tmp_download_exists = FALSE; 
     902                 
    883903                if($podPress->settings['enablePodangoIntegration']) { 
    884904                        if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') { 
    885905                                $fileNameParts = explode(':', $mediafile); 
     
    906926                        } else { 
    907927                                $uriFileName = $mediafile; 
    908928                        } 
    909                         $uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload); 
     929                        $siteurl = get_bloginfo('siteurl'); 
     930                        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 
     931                                // get the absolute folder of the file from the URL 
     932                                $purl = parse_url($uriFileName); 
     933                                $path_part = end(explode('wp-content', $purl['path'])); 
     934                                $uriFileName = WP_CONTENT_DIR.$path_part; 
     935                        } else { 
     936                                $uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload); 
     937                                $tmp_download_exists = TRUE; 
     938                        } 
    910939                } 
    911940 
    912941                $fileinfo = @$getID3->analyze($uriFileName); 
    913  
    914                 if(empty($fileinfo)) { 
     942                 
     943                if (empty($fileinfo)) { 
    915944                        return 'Remote MP3 File could not be read.'; 
    916945                } 
    917946 
    918947                getid3_lib::CopyTagsToComments($fileinfo); 
     948                 
     949                if (TRUE === $tmp_download_exists) { // if the file have been downloaded to a local folder then delete the tempfile 
     950                        if ('' != $fileinfo['filenamepath']) { // take the folder and file from getID3 if possible 
     951                                $unlink_result = @unlink($fileinfo['filenamepath']); 
     952                        } else { 
     953                                $unlink_result = @unlink($uriFileName); 
     954                        } 
     955                } 
    919956                return $fileinfo; 
    920957        } 
    921958         
     
    10341071                                if($pos) { 
    10351072                                        $ext = substr($ext, 0, $pos); 
    10361073                                } 
    1037                                 $localtempfilename = tempnam('/tmp', 'getID3').'.'.$ext; 
     1074                                $localtempfilename = @tempnam('/tmp', 'getID3').'.'.$ext; 
     1075                                if (FALSE == $localtempfilename OR '.'.$ext == $localtempfilename) { 
     1076                                        $localtempfilename = 'podpress_tmp.'.$ext; 
     1077                                } 
    10381078                                if (!$fp_local = @fopen($localtempfilename, 'wb')) { 
    10391079                                        $continue = false; 
    10401080                                } 
     
    11161156                if(file_exists($systemFileName)) { 
    11171157                        return filesize($systemFileName); 
    11181158                } 
     1159                 
     1160                // if it is a remote file then get the file size from the header information: 
    11191161                $uriFileName = $podPress->convertPodcastFileNameToValidWebPath($mediafile); 
     1162                 
    11201163                // Request headers 
    1121  
    11221164                $sRemoteHeaders = podPress_downloadFile($uriFileName, true); 
    11231165 
    11241166                // Parsing the headers 
  • podpress_feed_functions.php

     
    1919    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-107  USA 
    2020*/ 
    2121        /*************************************************************/ 
    22         /* feed generation functions                                 */ 
     22        /* feed generation functions                                             */ 
    2323        /*************************************************************/ 
    2424         
    2525        function podPress_feedSafeContent($input, $aggressive = false) { 
    2626                GLOBAL $podPress; 
    27                 /* 
    28                 // if the feed should not be protect agressively (option in the backend) then return immediately 
    29                 if ( ('no' == strtolower($podPress->settings['protectFeed']) OR FALSE === $podPress->settings['protectFeed']) AND FALSE === $aggressive) { 
    30                         return $input; 
    31                 } 
    32                 */ 
     27 
    3328                // replace the relevant characters with their HTML entities 
    3429                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 
    3530                        if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) { 
     
    152147                        $rss_category = $podPress->settings['rss_category']; 
    153148                } 
    154149                 
    155                 $data['rss_ttl'] = get_option('rss_ttl'); 
    156                 if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) { 
    157                         $data['rss_ttl'] = 1440; 
    158                 } 
    159150                echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 
     151                 
    160152                if (empty($data['rss_copyright'])) { 
    161153                        echo '  <copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' &#xA9; '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 
    162154                } else { 
    163155                        echo '  <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 
    164156                } 
    165                 if($data['new-feed-url'] == 'Enable') { 
    166                         if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) { 
    167                                 echo '          <itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n"; 
     157                 
     158                if (FALSE !== $data['admin_email'] AND FALSE === empty($data['admin_email'])) { 
     159                        if ('' != trim($data['author'])) { 
     160                                $admin_name = ' ('.podPress_feedSafeContent($data['author']).')'; 
     161                        } else { 
     162                                $admin_name = ''; 
    168163                        } 
     164                        echo '  <managingEditor>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</managingEditor>'."\n"; 
     165                        echo '  <webMaster>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</webMaster>'."\n"; 
    169166                } 
    170                 echo '  <managingEditor>'.podPress_feedSafeContent(stripslashes(get_option('admin_email'))).' ('.podPress_feedSafeContent($data['author']).')</managingEditor>'."\n"; 
    171                 echo '  <webMaster>'.podPress_feedSafeContent(get_option('admin_email')).' ('.podPress_feedSafeContent($data['author']).')</webMaster>'."\n"; 
     167                 
    172168                echo '  <category>'.podPress_feedSafeContent($rss_category).'</category>'."\n"; 
     169                 
     170                $data['rss_ttl'] = get_option('rss_ttl'); 
     171                if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) { 
     172                        $data['rss_ttl'] = 1440; 
     173                } 
    173174                if(!empty($data['rss_ttl'])) { 
    174175                        echo '  <ttl>'.$data['rss_ttl'].'</ttl>'."\n"; 
    175176                } 
    176                 echo '  <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n"; 
     177                 
     178                if ('' != trim($data['rss_image'])) { 
     179                        echo '  <image>'."\n"; 
     180                        echo '          <url>'.$data['rss_image'].'</url>'."\n"; 
     181                        echo '          <title>'.podPress_feedSafeContent(get_bloginfo('blogname')).'</title>'."\n"; 
     182                        echo '          <link>'.get_bloginfo('siteurl').'</link>'."\n"; 
     183                        echo '          <width>144</width>'."\n"; 
     184                        echo '          <height>144</height>'."\n"; 
     185                        echo '  </image>'."\n"; 
     186                } 
     187                 
     188                // iTunes - tags for the channnel: 
     189                if($data['new-feed-url'] == 'Enable') { 
     190                        if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) { 
     191                                echo '          <itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n"; 
     192                        } 
     193                } 
    177194                echo '  <itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle']), 255).'</itunes:subtitle>'."\n"; 
    178195                echo '  <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($data['summary']), 4000).'</itunes:summary>'."\n"; 
     196                echo '  <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n"; 
     197                echo podPress_getiTunesCategoryTags(); 
    179198                echo '  <itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n"; 
    180                 echo podPress_getiTunesCategoryTags(); 
    181199                echo '  <itunes:owner>'."\n"; 
    182200                echo '          <itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n"; 
    183201                echo '          <itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n"; 
    184202                echo '  </itunes:owner>'."\n"; 
    185                 if(empty($data['block'])) { 
    186                         $data['block'] = 'No'; 
     203                if ('yes' == strtolower($data['block']) OR 'no' == strtolower($data['block'])) { 
     204                        echo '  <itunes:block>'.strtolower($data['block']).'</itunes:block>'."\n"; 
     205                } else { 
     206                        echo '  <itunes:block>no</itunes:block>'."\n"; 
    187207                } 
    188                 echo '  <itunes:block>'.$data['block'].'</itunes:block>'."\n"; 
    189208                echo '  <itunes:explicit>'.podPress_feedSafeContent(strtolower($data['explicit'])).'</itunes:explicit>'."\n"; 
    190                 echo '  <itunes:image href="'.$data['image'].'" />'."\n"; 
    191                 echo '  <image>'."\n"; 
    192                 echo '          <url>'.$data['rss_image'].'</url>'."\n"; 
    193                 echo '          <title>'.podPress_feedSafeContent(get_bloginfo('blogname')).'</title>'."\n"; 
    194                 echo '          <link>'.get_bloginfo('siteurl').'</link>'."\n"; 
    195                 echo '          <width>144</width>'."\n"; 
    196                 echo '          <height>144</height>'."\n"; 
    197                 echo '  </image>'."\n"; 
     209                if ('' != trim($data['image'])) { 
     210                        echo '  <itunes:image href="'.$data['image'].'" />'."\n"; 
     211                } 
    198212        } 
    199213 
    200214        function podPress_rss2_item() { 
     
    253267                        } 
    254268                        echo '          <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</itunes:author>'."\n"; 
    255269 
    256                         if($post->podPressPostSpecific['itunes:explicit'] == 'Default') { 
     270                        if ($post->podPressPostSpecific['itunes:explicit'] == 'Default') { 
    257271                                $post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit']; 
    258                                 if(empty($post->podPressPostSpecific['itunes:explicit'])) { 
    259                                         $post->podPressPostSpecific['itunes:explicit'] = 'No'; 
    260                                 } 
    261272                        } 
     273                        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'])) ) { 
     274                                $post->podPressPostSpecific['itunes:explicit'] = 'No'; 
     275                        } 
    262276                        echo '          <itunes:explicit>'.podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:explicit'])).'</itunes:explicit>'."\n"; 
    263277 
    264                         if($post->podPressPostSpecific['itunes:block'] == 'Default') { 
     278                        if ($post->podPressPostSpecific['itunes:block'] == 'Default') { 
    265279                                $post->podPressPostSpecific['itunes:block'] = $podPress->settings['iTunes']['block']; 
    266                                 if(empty($post->podPressPostSpecific['itunes:block'])) { 
    267                                         $post->podPressPostSpecific['itunes:block'] = 'No'; 
    268                                 } 
    269280                        } 
    270                         if(empty($post->podPressPostSpecific['itunes:block'])) { 
     281                        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'])) ) { 
    271282                                $post->podPressPostSpecific['itunes:block'] = 'No'; 
    272283                        } 
    273                         echo '          <itunes:block>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:block']).'</itunes:block>'."\n"; 
     284                        echo '          <itunes:block>'.podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:block'])).'</itunes:block>'."\n"; 
    274285                        //echo '<comments>'. get_comments_link() .'</comments>'."\n"; 
     286                         
     287                        $episodeLicenseTags = podPress_getEpisodeLicenseTags(); 
     288                        if ($episodeLicenseTags != '') 
     289                        { 
     290                                echo $episodeLicenseTags; 
     291                        } 
    275292                } 
    276                 $episodeLicenseTags = podPress_getEpisodeLicenseTags(); 
    277                 if ($episodeLicenseTags != '') 
    278                 { 
    279                         echo $episodeLicenseTags; 
    280                 } 
    281                 if(isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) { 
     293                if (isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) { 
    282294                        $post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']; 
    283295                        unset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']); 
    284296                } 
     297                 
     298                // add the enclosures which are not added with podPress at last 
     299                podPress_add_nonpodpress_enclosures('rss2'); 
    285300        } 
    286301 
    287  
    288302        function podPress_atom_head() { 
    289303                GLOBAL $podPress; 
    290304                if(!isset($podPress->settings['category_data'])) { 
     
    308322 
    309323        function podPress_atom_entry() { 
    310324                $enclosureTag = podPress_getEnclosureTags('atom'); 
    311                 if ($enclosureTag != '') // if no enclosure tag, no need for iTunes tags 
    312                 { 
     325                if ($enclosureTag != '') { // if no enclosure tag, no need for iTunes tags 
    313326                        echo $enclosureTag; 
     327                         
     328                        $episodeLicenseTags = podPress_getEpisodeLicenseTags('atom'); 
     329                        if ($episodeLicenseTags != '')  { 
     330                                echo $episodeLicenseTags; 
     331                        } 
    314332                } 
    315                 $episodeLicenseTags = podPress_getEpisodeLicenseTags('atom'); 
    316                 if ($episodeLicenseTags != '') 
    317                 { 
    318                         echo $episodeLicenseTags; 
    319                 } 
     333                 
     334                // add the enclosures which are not added with podPress at last 
     335                podPress_add_nonpodpress_enclosures('atom'); 
    320336        } 
    321337 
    322338        function podPress_xspf_playlist() { 
     
    425441                                        $post->podPressMedia[$key]['URI'] = $post->podPressMedia[$key]['URI_torrent']; 
    426442                                } 
    427443                                $hasMediaFileAccessible = true; 
    428  
    429444                                if(isset($_GET['onlyformat']) && $_GET['onlyformat'] != $post->podPressMedia[$key]['ext']) { 
    430445                                        continue; 
    431446                                } 
    432  
    433447                                if(isset($_GET['format']) && $_GET['format'] == $post->podPressMedia[$key]['ext']) { 
    434448                                        $preferredFormat = true; 
    435449                                } 
    436450                                if ($post->podPressMedia[$key]['rss'] == 'on' || $post->podPressMedia[$key]['atom'] == 'on' || $preferredFormat == true) { 
    437451                                        if ($feedtype == 'atom' && $post->podPressMedia[$key]['atom'] == 'on') { 
    438452                                                $post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToWebPath($post->ID, $key, $post->podPressMedia[$key]['URI'], 'feed'); 
    439                                                 global $wp_version; 
    440                                                 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) 
    441                                                         // check if the URL is stored in postmeta as an enclosure (This is for the case that the wp ATOM template is in use) 
    442                                                         // TRUE: don't put the same enclosure tag into the feed (WP includes the postmeta enclosures since WP 1.5 viw rss_enlosure) 
    443                                                         // FALSE: ok, put the enclosure tag with the data from podPressMedia into the feed 
    444                                                         $same_enclosure_URL_in_postmeta_exists = podPress_meta_data_enclosure_exists($post->ID, $post->podPressMedia[$key]['URI']); 
    445                                                 } 
    446                                                 if ( FALSE === $same_enclosure_URL_in_postmeta_exists ) { 
    447                                                         $result .= '<link rel="enclosure" type="'.$post->podPressMedia[$key]['mimetype'].'" href="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" />'."\n"; 
    448                                                 } 
     453                                                $result .= '<link rel="enclosure" type="'.$post->podPressMedia[$key]['mimetype'].'" href="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" />'."\n"; 
    449454                                        } elseif ($feedtype == 'xspf') { 
    450455                                                $post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToValidWebPath($post->podPressMedia[$key]['URI']); 
    451                                                 if (podPress_getFileExt($post->podPressMedia[$key]['URI']) == 'mp3') { 
     456                                                if ( 'mp3' == podPress_getFileExt($post->podPressMedia[$key]['URI']) ) { 
    452457                                                        $result .= "\t\t\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n"; 
    453458                                                        if (!empty($post->podPressMedia[$key]['title'])) { 
    454459                                                                $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n"; 
     
    481486                                                } 
    482487                                                $durationTag = '<itunes:duration>'.$post->podPressMedia[$key]['duration'].'</itunes:duration>'."\n"; 
    483488                                                 
    484                                                 // check if the URL is stored in postmeta as an enclosure 
    485                                                 // TRUE: don't put the same enclosure tag into the feed (WP includes the postmeta enclosures since WP 1.5 viw rss_enlosure) 
    486                                                 // FALSE: ok, put the enclosure tag with the data from podPressMedia into the feed 
    487                                                 $same_enclosure_URL_in_postmeta_exists = podPress_meta_data_enclosure_exists($post->ID, $post->podPressMedia[$key]['URI']); 
    488                                                  
    489                                                 if($post->podPressMedia[$key]['rss'] == 'on' AND FALSE === $same_enclosure_URL_in_postmeta_exists ) { 
     489                                                if($post->podPressMedia[$key]['rss'] == 'on' ) { 
    490490                                                        if(!$preferredFormat && $foundPreferred) { 
    491491                                                                continue; 
    492492                                                        } elseif($preferredFormat) { 
     
    494494                                                        } 
    495495                                                        $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 
    496496                                                        $result .= "\t\t".$durationTag; 
    497                                                 } elseif ($preferredFormat && !$foundPreferred AND FALSE === $same_enclosure_URL_in_postmeta_exists) { 
     497                                                } elseif ($preferredFormat && !$foundPreferred) { 
    498498                                                        $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 
    499499                                                        $result .= "\t\t".$durationTag; 
    500500                                                        $foundPreferred = true; 
     
    504504                        } 
    505505                } 
    506506                if ($hasMediaFileAccessible && $result == '' && $feedtype != 'xspf' ) { 
    507                         if ( FALSE == $same_enclosure_URL_in_postmeta_exists ) { 
    508                                 echo "<!-- Media File exists for this post, but its not enabled for this feed -->\n"; 
    509                         }  
     507                        echo "<!-- Media File exists for this post, but its not enabled for this feed -->\n"; 
    510508                } 
    511                 return $result; 
     509                switch ($feedtype) { 
     510                        case 'atom' :  
     511                                return apply_filters('podpress_entry_enclosuretags', $result); 
     512                        break; 
     513                        case 'xspf' :  
     514                                return apply_filters('podpress_xspf_trackinformation', $result); 
     515                        break; 
     516                        case 'rss2' :  
     517                        default: 
     518                                return apply_filters('podpress_item_enclosure_and_itunesduration', $result); 
     519                        break; 
     520                } 
    512521        } 
    513522         
    514         function podPress_meta_data_enclosure_exists($post_id, $podPressMedia_enclosure_url='') { 
    515                 if (empty($post_id) or empty($podPressMedia_enclosure_url)) { 
    516                         return FALSE; 
    517                 } 
    518                 $exists = FALSE; 
    519                 $enclosures = (Array) get_post_meta($post_id, 'enclosure', FALSE); 
    520                 foreach ($enclosures as $enclosure) { 
    521                         if ( FALSE !== stristr($enclosure, $podPressMedia_enclosure_url) ) { 
    522                                 $exists = TRUE; 
    523                         }                
    524                 } 
    525                 return $exists; 
     523 
     524        // This function removes the enclosure tags of the enclosures which were not added with podPress 
     525        function podPress_dont_print_nonpodpress_enclosures($enclosure_tag = '') { 
     526                return ''; 
    526527        } 
    527  
    528 function podpress_strtomilliseconds($durationstr) { 
    529         $dstr_parts=explode(':', $durationstr); 
    530         $nr_dstr_parts=count($dstr_parts); 
    531         if (1 < $nr_dstr_parts AND 5 > $nr_dstr_parts) { 
    532                 switch ($nr_dstr_parts) { 
    533                         case 2 : 
    534                                 // this method is only good if the input data which consist of two parts is most likely in the format m:s because  
    535                                 // m:s 
    536                                 $duration = podpress_strtomilliseconds_core(1, 2, $dstr_parts); 
    537                                 if ($durationstr != podpress_millisecondstostring($duration)) { 
    538                                         // h:m 
    539                                         $duration = podpress_strtomilliseconds_core(0, 2, $dstr_parts); 
    540                                         if ($durationstr != podpress_millisecondstostring($duration)) { 
    541                                                 // s:ms 
    542                                                 $duration = podpress_strtomilliseconds_core(2, 2, $dstr_parts); 
     528         
     529        // This function prints the enclosure tags of the enclosure which were not added with podPress 
     530        function podPress_add_nonpodpress_enclosures($feedtype) { 
     531                GLOBAL $podPress, $post; 
     532                if ( post_password_required() ) { return; } 
     533                foreach ( (array) get_post_custom() as $key => $val) { 
     534                        if ($key == 'enclosure') { 
     535                                echo "\t\t".'<!-- non-podPress enclosures: -->'."\n"; 
     536                                foreach ( (array) $val as $enc ) { 
     537                                        $is_a_link_to_podPress_media = FALSE; 
     538                                        $enclosure = explode("\n", $enc); 
     539                                        $enclosure_url = trim(htmlspecialchars($enclosure[0])); 
     540                                        // check whether the enclosure URL is equal to a podPress enclosure URL 
     541                                        // If not then print the enclosure tag else don't. 
     542                                        if ( TRUE == is_array($post->podPressMedia) ) { 
     543                                                foreach ($post->podPressMedia as $key => $value) { 
     544                                                        if ( TRUE == isset($post->podPressMedia[$key]['URI']) AND $enclosure_url == $post->podPressMedia[$key]['URI'] ) { 
     545                                                                $is_a_link_to_podPress_media = TRUE; 
     546                                                        } 
     547                                                } 
    543548                                        } 
     549                                        if (FALSE == $is_a_link_to_podPress_media) { 
     550                                                //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3' 
     551                                                $t = preg_split('/[ \t]/', trim($enclosure[2]) ); 
     552                                                $type = $t[0]; 
     553                                                switch ($feedtype) { 
     554                                                        case 'atom' : 
     555                                                                echo apply_filters('nonpodpress_atom_enclosure', "\t\t".'<link href="' . $enclosure_url . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); 
     556                                                        break; 
     557                                                        case 'rss2': 
     558                                                        default : 
     559                                                                echo apply_filters('nonpodpress_rss_enclosure', "\t\t".'<enclosure url="' . $enclosure_url . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); 
     560                                                        break; 
     561                                                } 
     562                                        }  
    544563                                } 
    545                         break; 
    546                         case 3 : 
    547                                 // h:m:s 
    548                                 $duration = podpress_strtomilliseconds_core(0, 3, $dstr_parts); 
    549                                 if ($durationstr != podpress_millisecondstostring($duration)) { 
    550                                         // m:s:ms 
    551                                         $duration = podpress_strtomilliseconds_core(1, 3, $dstr_parts); 
    552                                 } 
    553                         break; 
    554                         case 4 : 
    555                                 $duration = podpress_strtomilliseconds_core(0, 4, $dstr_parts); 
    556                         break; 
     564                        } 
    557565                } 
    558566        } 
    559         if (!isset($duration) OR $duration < 0) { 
    560                 $duration = 0; 
    561         } 
    562         return $duration; 
    563 } 
    564567 
    565 function podpress_strtomilliseconds_core($startindex=0, $max_nr_parts=4, $dstr_parts=array()){ 
    566         $duration = $j = 0; 
    567         if (!empty($dstr_parts)) { 
    568                 for ($i=$startindex; $i < ($max_nr_parts+$startindex); $i++) { 
    569                         switch ($i) { 
    570                                 case 0 : // hours 
    571                                         $duration += 3600000 * intval(substr($dstr_parts[$j], 0, 2)); 
    572                                         $j++; 
     568        function podpress_strtomilliseconds($durationstr) { 
     569                // This function converts a string which is parted by at least one double point into a milliseconds value. 
     570                // 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. 
     571                // 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. 
     572                // Better ideas are welcome! Write a ticket http://plugins.trac.wordpress.org/ or post to the forum: http://wordpress.org/support/forum/10 
     573                $dstr_parts=explode(':', $durationstr); 
     574                $nr_dstr_parts=count($dstr_parts); 
     575                if (1 < $nr_dstr_parts AND 5 > $nr_dstr_parts) { 
     576                        switch ($nr_dstr_parts) { 
     577                                case 2 : 
     578                                        // this method is only good if the input data which consist of two parts is most likely in the format m:s because  
     579                                        // m:s 
     580                                        $duration = podpress_strtomilliseconds_core(1, 2, $dstr_parts); 
     581                                        if ($durationstr != podpress_millisecondstostring($duration)) { 
     582                                                // h:m 
     583                                                $duration = podpress_strtomilliseconds_core(0, 2, $dstr_parts); 
     584                                                if ($durationstr != podpress_millisecondstostring($duration)) { 
     585                                                        // s:ms 
     586                                                        $duration = podpress_strtomilliseconds_core(2, 2, $dstr_parts); 
     587                                                } 
     588                                        } 
    573589                                break; 
    574                                 case 1 : // minutes 
    575                                         $duration += 60000 * intval(substr($dstr_parts[$j], 0, 2)); 
    576                                         $j++; 
     590                                case 3 : 
     591                                        // h:m:s 
     592                                        $duration = podpress_strtomilliseconds_core(0, 3, $dstr_parts); 
     593                                        if ($durationstr != podpress_millisecondstostring($duration)) { 
     594                                                // m:s:ms 
     595                                                $duration = podpress_strtomilliseconds_core(1, 3, $dstr_parts); 
     596                                        } 
    577597                                break; 
    578                                 case 2 : // seconds 
    579                                         $duration += 1000 * intval(substr($dstr_parts[$j], 0, 2)); 
    580                                         $j++; 
     598                                case 4 : 
     599                                        $duration = podpress_strtomilliseconds_core(0, 4, $dstr_parts); 
    581600                                break; 
    582                                 case 3 : // milliseconds 
    583                                         $duration += intval(substr($dstr_parts[$j], 0, 2)); 
    584                                         $j++; 
    585                                 break; 
    586601                        } 
    587602                } 
     603                if (!isset($duration) OR $duration < 0) { 
     604                        $duration = 0; 
     605                } 
     606                return $duration; 
    588607        } 
    589         return $duration; 
    590 } 
    591608 
    592 function podpress_millisecondstostring($duration) { 
    593 // 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. 
    594 // If the leading parts is zero then the return string will not contain this part. 
    595         $hours = intval($duration / (3600000)); 
    596         $minutes = intval($duration / (60000) % 60); 
    597         $seconds = intval($duration / (1000) % 60); 
    598         $mseconds = intval($duration % 1000); 
    599         $duration_array = array($hours, $minutes, $seconds, $mseconds); 
    600         $dur_str =""; 
    601         $j=0; 
    602         foreach($duration_array as $key => $dur_part) { 
    603                 if ("" == $dur_str AND 0 == $dur_part) { 
    604                 } else { 
    605                         if (3 == $key AND  0 == $dur_part) { 
     609        function podpress_strtomilliseconds_core($startindex=0, $max_nr_parts=4, $dstr_parts=array()){ 
     610                $duration = $j = 0; 
     611                if (!empty($dstr_parts)) { 
     612                        for ($i=$startindex; $i < ($max_nr_parts+$startindex); $i++) { 
     613                                switch ($i) { 
     614                                        case 0 : // hours 
     615                                                $duration += 3600000 * intval(substr($dstr_parts[$j], 0, 2)); 
     616                                                $j++; 
     617                                        break; 
     618                                        case 1 : // minutes 
     619                                                $duration += 60000 * intval(substr($dstr_parts[$j], 0, 2)); 
     620                                                $j++; 
     621                                        break; 
     622                                        case 2 : // seconds 
     623                                                $duration += 1000 * intval(substr($dstr_parts[$j], 0, 2)); 
     624                                                $j++; 
     625                                        break; 
     626                                        case 3 : // milliseconds 
     627                                                $duration += intval(substr($dstr_parts[$j], 0, 2)); 
     628                                                $j++; 
     629                                        break; 
     630                                } 
     631                        } 
     632                } 
     633                return $duration; 
     634        } 
     635 
     636        function podpress_millisecondstostring($duration) { 
     637                // 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). 
     638                // If the leading part is zero then the return string will not contain this part. 
     639                $hours = intval($duration / (3600000)); 
     640                $minutes = intval($duration / (60000) % 60); 
     641                $seconds = intval($duration / (1000) % 60); 
     642                $mseconds = intval($duration % 1000); 
     643                $duration_array = array($hours, $minutes, $seconds, $mseconds); 
     644                $dur_str =""; 
     645                $j=0; 
     646                foreach($duration_array as $key => $dur_part) { 
     647                        if ("" == $dur_str AND 0 == $dur_part) { 
    606648                        } else { 
    607                                 if ($j > 0) {  
    608                                         $dur_str .= ":".strval($dur_part); 
     649                                if (3 == $key AND  0 == $dur_part) { 
    609650                                } else { 
    610                                         $dur_str .= strval($dur_part); 
     651                                        if ($j > 0) {  
     652                                                $dur_str .= ":".strval($dur_part); 
     653                                        } else { 
     654                                                $dur_str .= strval($dur_part); 
     655                                        } 
     656                                        $j++; 
    611657                                } 
    612                                 $j++; 
    613658                        } 
    614659                } 
     660                return $dur_str; 
    615661        } 
    616         return $dur_str; 
    617 } 
    618662 
    619663        function podPress_getiTunesCategoryTags() { 
    620664                GLOBAL $podPress, $post; 
     
    638682                        foreach($data as $thiscat) { 
    639683                                if (strstr($thiscat, ':')) { 
    640684                                        list($cat, $subcat) = explode(":", $thiscat); 
    641                                         $result .= "\t".'<itunes:category text="'.str_replace('&', '&amp;', $cat).'">'."\n"; 
    642                                         $result .= "\t\t".'<itunes:category text="'.str_replace('&', '&amp;', $subcat).'" />'."\n"; 
     685                                        $result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($cat).'">'."\n"; 
     686                                        $result .= "\t\t".'<itunes:category text="'.podPress_feedSafeContent($subcat).'" />'."\n"; 
    643687                                        $result .= "\t".'</itunes:category>'."\n"; 
    644688                                } elseif (!empty($thiscat) AND '[ '.__('nothing', 'podpress').' ]' != $thiscat ) { 
    645                                         $result .= "\t".'<itunes:category text="'.str_replace('&', '&amp;', $thiscat).'" />'."\n"; 
     689                                        $result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($thiscat).'" />'."\n"; 
    646690                                } 
    647691                        } 
    648692                }