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
1 1 <?php 2 2 define('PODPRESS_VERSION', '8.8'); 3 define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 2');3 define('PODPRESS_MAINTENANCE_VERSION', '8.8.5 beta 3'); 4 4 /* 5 5 Info for WordPress: 6 6 ============================================================================== 7 7 Plugin Name: podPress 8 Version: 8.8.5-beta_ 28 Version: 8.8.5-beta_3 9 9 Plugin URI: http://www.mightyseek.com/podpress/ 10 10 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. 11 11 Author: Dan Kuykendall (Seek3r) … … 37 37 38 38 Contributors: 39 39 ============================================================================== 40 Developer Dan Kuykendallhttp://www.mightyseek.com/41 Developer David Maciejewskihttp://www.macx.de/42 Forum Support/BugBoy Jeff Norrishttp://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/ 43 43 44 Audio player Martin Lainehttp://www.1pixelout.net45 WP-iPodCatter Garrick Van Burenhttp://garrickvanburen.com/44 Audio player Martin Laine http://www.1pixelout.net 45 WP-iPodCatter Garrick Van Buren http://garrickvanburen.com/ 46 46 47 47 Thanks to all contributors and bug reporters! :) 48 48 … … 91 91 if (!defined('PLUGINDIR')) { define('PLUGINDIR', 'wp-content/plugins'); } 92 92 if (!defined('PODPRESSPLUGINDIR')) { define('PODPRESSPLUGINDIR', ABSPATH.PLUGINDIR); } 93 93 94 // Begin - XSPF Jukebox player configuration: 95 // Background-color of the player <object> 96 if ( ! 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.) 103 if ( ! 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. 106 if ( ! defined( 'PODPRESS_XSPF_PLAYER_HEIGHT' ) ) { define( 'PODPRESS_XSPF_PLAYER_HEIGHT', 210 ); } 107 if ( ! 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 94 119 if(!function_exists('memory_get_usage')) { 95 120 unset($_GET['podpress_showmem']); 96 121 function memory_get_usage() { return 0; } … … 154 179 podPress_checkmem('podPress base class included'); 155 180 require_once(ABSPATH.PLUGINDIR.'/podpress/podpress_functions.php'); 156 181 podPress_checkmem('podPress functions loaded'); 157 182 158 183 if($podPress_x = @parse_url($_SERVER['REQUEST_URI'])) { 159 184 $podPress_x = $podPress_x['path']; 160 185 if (strpos($podPress_x, 'crossdomain.xml')) { … … 271 296 echo 'podPressBackendURL = podPressBackendURL+"//"+location.hostname+"'.podPress_url(true).'";'."\n"; 272 297 echo 'var podPressDefaultPreviewImage = podPressBackendURL+"/images/vpreview_center.png";'."\n"; 273 298 274 if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] != '1pixelout') {299 if($podPress->settings['enablePodangoIntegration'] || $podPress->settings['mp3Player'] == 'podango') { 275 300 echo 'var podPressPlayerFile = "podango_player.swf";'."\n"; 276 301 } else { 277 302 echo 'var podPressPlayerFile = "1pixelout_player.swf";'."\n"; … … 546 571 add_action('the_content_rss', array(&$podPress, 'insert_content')); 547 572 add_action('rss2_ns', 'podPress_rss2_ns'); 548 573 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'); 549 576 add_action('rss2_item', 'podPress_rss2_item'); 550 577 551 578 /* stuff that goes in the atom feed */ 552 579 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'); 553 582 add_action('atom_entry', 'podPress_atom_entry'); 554 583 $podPress_feedHooksAdded = true; 555 584 } … … 781 810 $podPress->post_form_wp25plus('page'); 782 811 echo "\n<!-- podPress dbx for modern WP versions - page -->\n"; 783 812 } 813 ?> -
podpress_admin_class.php
178 178 } 179 179 echo '</script>'."\n"; 180 180 181 echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n"; 182 181 183 echo '<div id="podPressstuff" class="dbx-group">'."\n"; 182 184 echo ' <fieldset id="podpresscontent" class="dbx-box">'."\n"; 183 185 echo ' <h3 class="dbx-handle">'.__('Podcasting', 'podpress').'</h3> '."\n"; … … 323 325 echo ' <label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n"; 324 326 echo ' </td>'."\n"; 325 327 echo ' <td>'."\n"; 326 echo ' <input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPress MediaFiles['.$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"; 327 329 echo ' </td>'."\n"; 328 330 echo ' </tr>'."\n"; 329 331 echo ' <tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n"; … … 333 335 echo ' <td>'."\n"; 334 336 echo ' <div id="podPressPlayerSpace_'.$num.'"></div>'."\n"; 335 337 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"; 337 339 echo "--></script>\n"; 338 340 echo ' </td>'."\n"; 339 341 echo ' </tr>'."\n"; … … 343 345 echo ' '.__('Dimensions', 'podpress').' (WxH): '."\n"; 344 346 echo ' </td>'."\n"; 345 347 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"; 348 350 echo ' </td>'."\n"; 349 351 echo ' </tr>'."\n"; 350 352 … … 728 730 } 729 731 echo '</script>'."\n"; 730 732 733 echo '<input type="hidden" id="podPressMedia_defaultpreviewImage" value="'.PODPRESS_URL.'/images/vpreview_center.png" />'."\n"; 734 731 735 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"; 732 736 echo ''.__('File Uploading support is not part of podPress', 'podpress').'.</p> '."\n"; 733 737 echo ' <h4>'.__('Podcasting', 'podpress').' '.__('Files', 'podpress').':</h4>'."\n"; … … 871 875 echo ' <label for="podPressMedia_'.$num.'_previewImage">'.__('Preview Image URL', 'podpress').'</label>: '."\n"; 872 876 echo ' </td>'."\n"; 873 877 echo ' <td>'."\n"; 874 echo ' <input type="text" id="podPressMedia_'.$num.'_previewImage" name="podPressMedia['.$num.'][previewImage]" size="40" value="'.$thisMedia['previewImage'].'" onchange="javascript: podPress MediaFiles['.$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"; 875 879 echo ' </td>'."\n"; 876 880 echo ' </tr>'."\n"; 877 881 echo ' <tr id="podPressMediaPreviewImageDisplayWrapper_'.$num.'" style="display: none;">'."\n"; … … 881 885 echo ' <td>'."\n"; 882 886 echo ' <div id="podPressPlayerSpace_'.$num.'"></div>'."\n"; 883 887 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"; 885 889 echo "--></script>\n"; 886 890 echo ' </td>'."\n"; 887 891 echo ' </tr>'."\n"; … … 891 895 echo ' '.__('Dimensions', 'podpress').' (WxH): '."\n"; 892 896 echo ' </td>'."\n"; 893 897 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"; 896 900 echo ' </td>'."\n"; 897 901 echo ' </tr>'."\n"; 898 902 … … 968 972 969 973 $num++; 970 974 } 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"; 972 976 if($entryType != 'page') { 973 977 echo ' <br/>'."\n"; 974 978 echo ' <h4>'.__('Post specific settings for iTunes', 'podpress').': </h4>'."\n"; … … 1186 1190 } 1187 1191 podPress_add_post_meta($post_id, 'podPressMedia', $verifiedMedia, true) ; 1188 1192 } 1189 } 1193 } 1190 1194 if(isset($_POST['iTunesSubtitleChoice']) AND $_POST['iTunesSummaryChoice'] AND $_POST['iTunesKeywordsChoice'] AND $_POST['iTunesAuthorChoice'] AND $_POST['iTunesExplicit'] AND $_POST['iTunesBlock']) { 1191 1195 if($_POST['iTunesSubtitleChoice'] == 'Custom' && !empty($_POST['iTunesSubtitle'])) { 1192 1196 $podPressPostSpecific['itunes:subtitle'] = $_POST['iTunesSubtitle']; … … 1253 1257 } 1254 1258 1255 1259 function edit_category_form($input) { 1260 global $wp_version; 1256 1261 $data = podPress_get_option('podPress_category_'.$input->cat_ID); 1257 1262 $blog_charset = get_bloginfo('charset'); 1258 1263 if(empty($data['podcastFeedURL'])) { 1259 1264 $data['podcastFeedURL'] = get_settings('siteurl').'/?feed=rss2&cat='.$input->cat_ID; 1260 1265 } 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. 1262 1267 if (TRUE == version_compare($wp_version, '2.7','<') ){ 1263 1268 echo '<div class="wrap">'."\n"; 1264 1269 } else { … … 1366 1371 echo ' <td width="50%">'; 1367 1372 echo ' <label for="iTunesImageChoice"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'."\n"; 1368 1373 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"; 1370 1375 echo ' <br/>'; 1371 1376 echo ' <select id="iTunesImageChoice" name="iTunesImageChoice" onchange="javascript: podPress_updateCategoryCasting();">'."\n"; 1372 1377 echo ' <option value="Global" '; if($data['iTunesImageChoice'] != 'Custom') { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').'</option>'."\n"; … … 1483 1488 echo ' <br/>'; 1484 1489 echo ' <select id="iTunesCategory_0" name="iTunesCategory[0]" onchange="podPress_updateCategoryCasting();">'."\n"; 1485 1490 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"; 1487 1497 if (empty($data['iTunesCategory'][0])) { 1488 1498 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1489 1499 } else { … … 1494 1504 echo ' <input type="hidden" id="global_iTunesCategory" value="'.htmlentities(stripslashes($this->settings['iTunes']['category'][0]), ENT_QUOTES, $blog_charset).'" />'."\n"; 1495 1505 echo ' <select name="iTunesCategory[1]">'."\n"; 1496 1506 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"; 1498 1513 if (empty($data['iTunesCategory'][1])) { 1499 1514 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1500 1515 } else { … … 1504 1519 echo ' </select><br/>'."\n"; 1505 1520 echo ' <select name="iTunesCategory[2]">'."\n"; 1506 1521 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"; 1508 1528 if (empty($data['iTunesCategory'][2])) { 1509 1529 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1510 1530 } else { … … 1526 1546 echo ' <option value="Clean" '; if($data['iTunesExplicit'] == 'Clean') { echo 'selected="selected"'; } echo '>'.__('Clean', 'podpress').'</option>'."\n"; 1527 1547 echo ' </select>'."\n"; 1528 1548 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"; 1530 1554 echo ' </div>'."\n"; 1531 1555 echo ' </td>'."\n"; 1532 1556 echo ' <td width="50%">'."\n"; … … 1537 1561 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"; 1538 1562 echo ' <option value="Custom" '; if($data['rss_copyrightChoice'] == 'Custom') { echo 'selected="selected"'; } echo '>'.__('Custom', 'podpress').'</option>'."\n"; 1539 1563 echo ' </select>'."\n"; 1540 echo ' <div id="rss_copyright Wrapper" style="display: none;">'."\n";1564 echo ' <div id="rss_copyrightHelp" style="display: none;">'."\n"; 1541 1565 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();"/>'; 1542 1566 echo ' <br />'.__('Enter the complete copyright string or the license name. For example: Copyright © 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"; 1543 1567 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"; 1546 1569 echo ' '.__('Used if this Copyright phrase should be different than the global copyright phrase.', 'podpress')."\n"; 1570 echo ' </p>'."\n"; 1547 1571 echo ' </div>'."\n"; 1548 1572 1549 1573 echo ' <br /><br />'."\n"; … … 1554 1578 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"; 1555 1579 echo ' <option value="Custom" '; if($data['rss_license_urlChoice'] == 'Custom') { echo 'selected="selected"'; } echo '>'.__('Custom', 'podpress').'</option>'."\n"; 1556 1580 echo ' </select>'."\n"; 1557 echo ' <div id="rss_license_url Wrapper" style="display: none;">'."\n";1581 echo ' <div id="rss_license_urlHelp" style="display: none;">'."\n"; 1558 1582 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"; 1559 1583 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"; 1560 1584 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"; 1563 1586 echo ' '.__('Used if this license URL should be different than the global license URL.', 'podpress')."\n"; 1587 echo ' </p>'."\n"; 1564 1588 echo ' </div>'."\n"; 1565 1589 1566 1590 … … 1577 1601 echo ' <option value="Yes" '; if($data['iTunesBlock'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 1578 1602 echo ' </select>'."\n"; 1579 1603 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"; 1581 1608 echo ' </div>'."\n"; 1582 1609 echo ' </td>'."\n"; 1583 1610 echo ' <td width="50%"> </td>'."\n"; -
podpress_admin_feed_class.php
104 104 echo ' <td width="50%">'; 105 105 echo ' <label for="blogname"><strong>'.__('Blog/Podcast title', 'podpress').'</strong></label>'; 106 106 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>'; 108 108 echo ' </td>'."\n"; 109 109 echo ' </tr>'."\n"; 110 110 … … 119 119 echo ' <label for="blogdescription"><strong>'.__('Blog Description', 'podpress').'</strong></label>'; 120 120 echo ' <br/>'; 121 121 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"; 123 123 echo ' </td>'."\n"; 124 124 echo ' </tr>'."\n"; 125 125 … … 127 127 echo ' <td width="50%">'."\n"; 128 128 echo ' <label for="iTunesImage"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'; 129 129 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"; 131 131 echo ' <br/>'; 132 132 echo ' <input id="iTunesImage" type="text" name="iTunes[image]" value="'.$this->settings['iTunes']['image'].'" size="40" onchange="podPress_updateFeedSettings();"/>'."\n"; 133 133 echo ' <br />'; … … 152 152 echo ' <td width="50%">'; 153 153 echo ' <label for="admin_email"><strong>'.__('Owner E-mail address', 'podpress').'</strong></label>'; 154 154 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>'; 156 156 echo ' </td>'."\n"; 157 157 echo ' </tr>'."\n"; 158 158 … … 164 164 echo ' <br/>'.__('Used as default Podcast Episode Title', 'podpress').' (255 '.__('characters', 'podpress').')'."\n"; 165 165 echo ' </td>'."\n"; 166 166 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>'; 168 168 echo ' <br/>'; 169 169 echo ' <select id="rss_language" name="rss_language" onchange="podPress_updateFeedSettings();">'."\n"; 170 170 echo ' <optgroup label="'.__('Select Language', 'podpress').'">'."\n"; 171 171 podPress_itunesLanguageOptions(get_option('rss_language')); 172 172 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>'; 174 174 echo ' </td>'."\n"; 175 175 echo ' </tr>'."\n"; 176 176 … … 182 182 echo ' <br/>('.__('Comma seperated list', 'podpress').', '.__('max 8', 'podpress').')'; 183 183 echo ' </td>'."\n"; 184 184 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"; 192 192 echo ' </td>'."\n"; 193 193 echo ' </tr>'."\n"; 194 194 … … 229 229 echo ' <option value="Yes" '; if($this->settings['iTunes']['explicit'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 230 230 echo ' <option value="Clean" '; if($this->settings['iTunes']['explicit'] == 'Clean') { echo 'selected="selected"'; } echo '>'.__('Clean', 'podpress').'</option>'."\n"; 231 231 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"; 233 237 echo ' </td>'."\n"; 234 238 echo ' <td width="50%">'."\n"; 235 239 echo ' <label for="rss_copyright"><strong>'.__('Feed Copyright / license name', 'podpress').'</strong></label>'; … … 262 266 echo ' <td width="50%">'; 263 267 echo ' <label for="posts_per_rss"><strong>'.__('Show the most recent', 'podpress').'</strong></label>'; 264 268 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>'; 266 270 echo ' </td>'."\n"; 267 271 echo ' </tr>'."\n"; 268 272 … … 275 279 echo ' <option value="Yes" '; if($this->settings['iTunes']['block'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 276 280 echo ' </select>'."\n"; 277 281 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 278 286 echo ' </td>'."\n"; 279 287 echo ' <td width="50%">'; 280 288 echo ' <label for="blog_charset"><strong>'.__('Encoding for pages and feeds', 'podpress').'</strong></label>'; 281 289 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>'; 283 291 echo ' </td>'."\n"; 284 292 echo ' </tr>'."\n"; 285 293 … … 324 332 325 333 if(is_array($_POST['iTunes']['category'])) { 326 334 foreach ($_POST['iTunes']['category'] as $value) { 327 if( $value != '#') {335 if('#' != $value AND '[ '.__('nothing', 'podpress').' ]' != $value) { 328 336 $iTunesSettings['category'][] = $value; 329 337 } 330 338 } -
podpress_admin_functions.php
345 345 $options['video_mpg'] = __('MPG - Video', 'podpress'); 346 346 $options['video_asf'] = __('ASF - Video', 'podpress'); 347 347 $options['video_wmv'] = __('WMV - Video', 'podpress'); 348 $options[' video_wma'] = __('WMA - Video', 'podpress');348 $options['audio_wma'] = __('WMA - Audio', 'podpress'); 349 349 $options['video_flv'] = __('FLV - Flash Video', 'podpress'); 350 350 $options['video_swf'] = __('SWF - Flash content', 'podpress'); 351 351 $options['ebook_pdf'] = __('PDF - eBook', 'podpress'); … … 362 362 function podPress_videoDimensionOptions($selected='320:240') { 363 363 $dimensions = array(); 364 364 reset($dimensions); 365 $dimensions_noimage = array(); 366 reset($dimensions_noimage); 365 367 366 368 $dimensions['160:120'] = '160 x 120'; 367 369 $dimensions['320:240'] = '320 x 240'; … … 371 373 $dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]'; 372 374 $dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]'; 373 375 $dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]'; 376 374 377 echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n"; 375 378 foreach ($dimensions as $key => $value) { 376 379 if ($key == $selected) { … … 381 384 echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n"; 382 385 } 383 386 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 384 402 } 385 403 386 404 function podPress_itunesLanguageArray() { … … 596 614 $foundit = true; 597 615 echo ' selected="selected"'; 598 616 } 599 echo ' >'.$value.'</option>'."\n";617 echo '>'.$value.'</option>'."\n"; 600 618 } 601 619 602 620 if(!$foundit AND '##Global##' != $current) { … … 880 898 881 899 function podPress_getID3tags($mediafile, $resolved = false, $limitDownload = false) { 882 900 GLOBAL $podPress; 901 $tmp_download_exists = FALSE; 902 883 903 if($podPress->settings['enablePodangoIntegration']) { 884 904 if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') { 885 905 $fileNameParts = explode(':', $mediafile); … … 906 926 } else { 907 927 $uriFileName = $mediafile; 908 928 } 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 } 910 939 } 911 940 912 941 $fileinfo = @$getID3->analyze($uriFileName); 913 914 if (empty($fileinfo)) {942 943 if (empty($fileinfo)) { 915 944 return 'Remote MP3 File could not be read.'; 916 945 } 917 946 918 947 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 } 919 956 return $fileinfo; 920 957 } 921 958 … … 1034 1071 if($pos) { 1035 1072 $ext = substr($ext, 0, $pos); 1036 1073 } 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 } 1038 1078 if (!$fp_local = @fopen($localtempfilename, 'wb')) { 1039 1079 $continue = false; 1040 1080 } … … 1116 1156 if(file_exists($systemFileName)) { 1117 1157 return filesize($systemFileName); 1118 1158 } 1159 1160 // if it is a remote file then get the file size from the header information: 1119 1161 $uriFileName = $podPress->convertPodcastFileNameToValidWebPath($mediafile); 1162 1120 1163 // Request headers 1121 1122 1164 $sRemoteHeaders = podPress_downloadFile($uriFileName, true); 1123 1165 1124 1166 // Parsing the headers -
podpress_feed_functions.php
19 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-107 USA 20 20 */ 21 21 /*************************************************************/ 22 /* feed generation functions */22 /* feed generation functions */ 23 23 /*************************************************************/ 24 24 25 25 function podPress_feedSafeContent($input, $aggressive = false) { 26 26 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 33 28 // replace the relevant characters with their HTML entities 34 29 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 35 30 if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) { … … 152 147 $rss_category = $podPress->settings['rss_category']; 153 148 } 154 149 155 $data['rss_ttl'] = get_option('rss_ttl');156 if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) {157 $data['rss_ttl'] = 1440;158 }159 150 echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 151 160 152 if (empty($data['rss_copyright'])) { 161 153 echo ' <copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 162 154 } else { 163 155 echo ' <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 164 156 } 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 = ''; 168 163 } 164 echo ' <managingEditor>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</managingEditor>'."\n"; 165 echo ' <webMaster>'.podPress_feedSafeContent($data['admin_email']).$admin_name.'</webMaster>'."\n"; 169 166 } 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 172 168 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 } 173 174 if(!empty($data['rss_ttl'])) { 174 175 echo ' <ttl>'.$data['rss_ttl'].'</ttl>'."\n"; 175 176 } 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 } 177 194 echo ' <itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle']), 255).'</itunes:subtitle>'."\n"; 178 195 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(); 179 198 echo ' <itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n"; 180 echo podPress_getiTunesCategoryTags();181 199 echo ' <itunes:owner>'."\n"; 182 200 echo ' <itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n"; 183 201 echo ' <itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n"; 184 202 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"; 187 207 } 188 echo ' <itunes:block>'.$data['block'].'</itunes:block>'."\n";189 208 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 } 198 212 } 199 213 200 214 function podPress_rss2_item() { … … 253 267 } 254 268 echo ' <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</itunes:author>'."\n"; 255 269 256 if ($post->podPressPostSpecific['itunes:explicit'] == 'Default') {270 if ($post->podPressPostSpecific['itunes:explicit'] == 'Default') { 257 271 $post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit']; 258 if(empty($post->podPressPostSpecific['itunes:explicit'])) {259 $post->podPressPostSpecific['itunes:explicit'] = 'No';260 }261 272 } 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 } 262 276 echo ' <itunes:explicit>'.podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:explicit'])).'</itunes:explicit>'."\n"; 263 277 264 if ($post->podPressPostSpecific['itunes:block'] == 'Default') {278 if ($post->podPressPostSpecific['itunes:block'] == 'Default') { 265 279 $post->podPressPostSpecific['itunes:block'] = $podPress->settings['iTunes']['block']; 266 if(empty($post->podPressPostSpecific['itunes:block'])) {267 $post->podPressPostSpecific['itunes:block'] = 'No';268 }269 280 } 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'])) ) { 271 282 $post->podPressPostSpecific['itunes:block'] = 'No'; 272 283 } 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"; 274 285 //echo '<comments>'. get_comments_link() .'</comments>'."\n"; 286 287 $episodeLicenseTags = podPress_getEpisodeLicenseTags(); 288 if ($episodeLicenseTags != '') 289 { 290 echo $episodeLicenseTags; 291 } 275 292 } 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'])) { 282 294 $post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']; 283 295 unset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']); 284 296 } 297 298 // add the enclosures which are not added with podPress at last 299 podPress_add_nonpodpress_enclosures('rss2'); 285 300 } 286 301 287 288 302 function podPress_atom_head() { 289 303 GLOBAL $podPress; 290 304 if(!isset($podPress->settings['category_data'])) { … … 308 322 309 323 function podPress_atom_entry() { 310 324 $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 313 326 echo $enclosureTag; 327 328 $episodeLicenseTags = podPress_getEpisodeLicenseTags('atom'); 329 if ($episodeLicenseTags != '') { 330 echo $episodeLicenseTags; 331 } 314 332 } 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'); 320 336 } 321 337 322 338 function podPress_xspf_playlist() { … … 425 441 $post->podPressMedia[$key]['URI'] = $post->podPressMedia[$key]['URI_torrent']; 426 442 } 427 443 $hasMediaFileAccessible = true; 428 429 444 if(isset($_GET['onlyformat']) && $_GET['onlyformat'] != $post->podPressMedia[$key]['ext']) { 430 445 continue; 431 446 } 432 433 447 if(isset($_GET['format']) && $_GET['format'] == $post->podPressMedia[$key]['ext']) { 434 448 $preferredFormat = true; 435 449 } 436 450 if ($post->podPressMedia[$key]['rss'] == 'on' || $post->podPressMedia[$key]['atom'] == 'on' || $preferredFormat == true) { 437 451 if ($feedtype == 'atom' && $post->podPressMedia[$key]['atom'] == 'on') { 438 452 $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"; 449 454 } elseif ($feedtype == 'xspf') { 450 455 $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']) ) { 452 457 $result .= "\t\t\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n"; 453 458 if (!empty($post->podPressMedia[$key]['title'])) { 454 459 $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n"; … … 481 486 } 482 487 $durationTag = '<itunes:duration>'.$post->podPressMedia[$key]['duration'].'</itunes:duration>'."\n"; 483 488 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' ) { 490 490 if(!$preferredFormat && $foundPreferred) { 491 491 continue; 492 492 } elseif($preferredFormat) { … … 494 494 } 495 495 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 496 496 $result .= "\t\t".$durationTag; 497 } elseif ($preferredFormat && !$foundPreferred AND FALSE === $same_enclosure_URL_in_postmeta_exists) {497 } elseif ($preferredFormat && !$foundPreferred) { 498 498 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 499 499 $result .= "\t\t".$durationTag; 500 500 $foundPreferred = true; … … 504 504 } 505 505 } 506 506 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"; 510 508 } 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 } 512 521 } 513 522 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 ''; 526 527 } 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 } 543 548 } 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 } 544 563 } 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 } 557 565 } 558 566 } 559 if (!isset($duration) OR $duration < 0) {560 $duration = 0;561 }562 return $duration;563 }564 567 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 } 573 589 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 } 577 597 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); 581 600 break; 582 case 3 : // milliseconds583 $duration += intval(substr($dstr_parts[$j], 0, 2));584 $j++;585 break;586 601 } 587 602 } 603 if (!isset($duration) OR $duration < 0) { 604 $duration = 0; 605 } 606 return $duration; 588 607 } 589 return $duration;590 }591 608 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) { 606 648 } else { 607 if ($j > 0) { 608 $dur_str .= ":".strval($dur_part); 649 if (3 == $key AND 0 == $dur_part) { 609 650 } 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++; 611 657 } 612 $j++;613 658 } 614 659 } 660 return $dur_str; 615 661 } 616 return $dur_str;617 }618 662 619 663 function podPress_getiTunesCategoryTags() { 620 664 GLOBAL $podPress, $post; … … 638 682 foreach($data as $thiscat) { 639 683 if (strstr($thiscat, ':')) { 640 684 list($cat, $subcat) = explode(":", $thiscat); 641 $result .= "\t".'<itunes:category text="'. str_replace('&', '&',$cat).'">'."\n";642 $result .= "\t\t".'<itunes:category text="'. str_replace('&', '&',$subcat).'" />'."\n";685 $result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($cat).'">'."\n"; 686 $result .= "\t\t".'<itunes:category text="'.podPress_feedSafeContent($subcat).'" />'."\n"; 643 687 $result .= "\t".'</itunes:category>'."\n"; 644 688 } elseif (!empty($thiscat) AND '[ '.__('nothing', 'podpress').' ]' != $thiscat ) { 645 $result .= "\t".'<itunes:category text="'. str_replace('&', '&',$thiscat).'" />'."\n";689 $result .= "\t".'<itunes:category text="'.podPress_feedSafeContent($thiscat).'" />'."\n"; 646 690 } 647 691 } 648 692 }
