Ticket #1064: new_feed_protection_and_fixes_for_feed_settings_pages.patch
| File new_feed_protection_and_fixes_for_feed_settings_pages.patch, 42.9 KB (added by ntm, 2 years ago) |
|---|
-
podpress_admin_class.php
344 344 echo ' </td>'."\n"; 345 345 echo ' <td>'."\n"; 346 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( ); echo '</select>'."\n";347 echo ' <select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']); echo '</select>'."\n"; 348 348 echo ' </td>'."\n"; 349 349 echo ' </tr>'."\n"; 350 350 … … 881 881 echo ' <td>'."\n"; 882 882 echo ' <div id="podPressPlayerSpace_'.$num.'"></div>'."\n"; 883 883 echo '<script type="text/javascript"><!--'."\n"; 884 echo " document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true );\n";884 echo " document.getElementById('podPressPlayerSpace_".$num."').innerHTML = podPressGenerateVideoPreview (".$num.", '', '', '', document.getElementById('podPressMedia_".$num."_previewImage').value, true, true);\n"; 885 885 echo "--></script>\n"; 886 886 echo ' </td>'."\n"; 887 887 echo ' </tr>'."\n"; … … 892 892 echo ' </td>'."\n"; 893 893 echo ' <td>'."\n"; 894 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( ); echo '</select>'."\n";895 echo ' <select onchange="javascript: podPressUpdateDimensions(\''.$num.'\', this.value);">'."\n"; podPress_videoDimensionOptions($thisMedia['dimensionW'].':'.$thisMedia['dimensionH']); echo '</select>'."\n"; 896 896 echo ' </td>'."\n"; 897 897 echo ' </tr>'."\n"; 898 898 … … 1276 1276 echo ' <fieldset class="options">'."\n"; 1277 1277 echo ' <legend>'.__('Podcast Feed Options', 'podpress').'</legend>'."\n"; 1278 1278 1279 echo ' <table width="110%" cellspacing="2" cellpadding="5" class="editform" >'."\n";1279 echo ' <table width="110%" cellspacing="2" cellpadding="5" class="editform" id="podpress_feed_options_table">'."\n"; 1280 1280 echo ' <tr>'."\n"; 1281 1281 echo ' <td width="50%"><h3>'.__('iTunes Settings', 'podpress').'</h3></td>'."\n"; 1282 1282 echo ' <td width="50%"><h3>'.__('Standard Settings', 'podpress').'</h3></td>'."\n"; … … 1364 1364 1365 1365 echo ' <tr valign="top">'."\n"; 1366 1366 echo ' <td width="50%">'; 1367 echo ' <label for="iTunesImageChoice"><strong>'.__('iTunes:Image', 'podpress').' (300*300 pixels)</strong></label>'."\n";1367 echo ' <label for="iTunesImageChoice"><strong>'.__('iTunes:Image', 'podpress').'</strong></label>'."\n"; 1368 1368 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"; 1370 echo ' <br/>'; 1369 1371 echo ' <select id="iTunesImageChoice" name="iTunesImageChoice" onchange="javascript: podPress_updateCategoryCasting();">'."\n"; 1370 1372 echo ' <option value="Global" '; if($data['iTunesImageChoice'] != 'Custom') { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').'</option>'."\n"; 1371 1373 echo ' <option value="Custom" '; if($data['iTunesImageChoice'] == 'Custom') { echo 'selected="selected"'; } echo '>'.__('Custom', 'podpress').'</option>'."\n"; … … 1376 1378 echo ' <input id="global_iTunesImage" type="hidden" value="'.$this->settings['iTunes']['image'].'"/>'."\n"; 1377 1379 echo ' </div>'."\n"; 1378 1380 echo ' <br/>'; 1379 echo ' <img id="itunes_image_display" width="300" height="300" alt="Podcast Image - Big" src="" />'."\n"; 1381 echo ' <img id="itunes_image_display" style="width:300px; height:300px;" alt="Podcast Image - Big" src="" /><br />'."\n"; 1382 echo ' <em>'.__('(This image is only a preview which is limited to 300 x 300 pixels.) ', 'podpress').'</em>'; 1380 1383 echo ' </td>'."\n"; 1381 1384 echo ' <td width="50%">'; 1382 echo ' <label for="rss_imageChoice"><strong>'.__('Blog/RSS Image ', 'podpress').' (144*144 pixels)</strong></label>'."\n";1385 echo ' <label for="rss_imageChoice"><strong>'.__('Blog/RSS Image (144 x 144 pixels)', 'podpress').'</strong></label>'."\n"; 1383 1386 echo ' <br/>'; 1384 1387 echo ' <select id="rss_imageChoice" name="rss_imageChoice" onchange="javascript: podPress_updateCategoryCasting();">'."\n"; 1385 1388 echo ' <option value="Global" '; if($data['rss_imageChoice'] != 'Custom') { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').'</option>'."\n"; … … 1391 1394 echo ' <input id="global_rss_image" type="hidden" value="'.get_option('rss_image').'"/>'."\n"; 1392 1395 echo ' </div>'."\n"; 1393 1396 echo ' <br/>'; 1394 echo ' <img id="rss_image_Display" width="144" height="144" alt="Podcast Image - Small" src="" />'."\n";1397 echo ' <img id="rss_image_Display" style="width:144px; height:144px;" alt="Podcast Image - Small" src="" />'."\n"; 1395 1398 echo ' </td>'."\n"; 1396 1399 echo ' </tr>'."\n"; 1397 1400 … … 1448 1451 echo ' <label for="rss_language"><strong>'.__('Language', 'podpress').'</strong></label>:'."\n"; 1449 1452 echo ' <br/>'; 1450 1453 echo ' <select id="rss_language" name="rss_language" onchange="javascript: podPress_updateCategoryCasting();">'."\n"; 1454 echo ' <optgroup label="'.__('Select Language', 'podpress').'">'."\n"; 1451 1455 echo ' <option value="##Global##" '; if($data['rss_language'] == '##Global##' || empty($data['rss_language'])) { echo 'selected="selected"'; } echo '>'.__('Use Global', 'podpress').' - '.$langs[get_option('rss_language')].' ['.get_option('rss_language').']</option>'."\n"; 1452 1456 podPress_itunesLanguageOptions($data['rss_language']); 1457 echo ' </optgroup>'."\n"; 1453 1458 echo ' </select>'."\n"; 1454 1459 echo ' <input type="hidden" id="global_rss_language" value="'.$langs[get_option('rss_language')].'['.stripslashes(get_option('rss_language')).']" /></td>'."\n"; 1455 1460 echo ' </td>'."\n"; … … 1477 1482 echo ' <label for="iTunesCategory_0"><strong>'.__('iTunes:Categories', 'podpress').'</strong></label>'; 1478 1483 echo ' <br/>'; 1479 1484 echo ' <select id="iTunesCategory_0" name="iTunesCategory[0]" onchange="podPress_updateCategoryCasting();">'."\n"; 1480 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"; 1481 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][0]), ENT_QUOTES, $blog_charset); 1485 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"; 1487 if (empty($data['iTunesCategory'][0])) { 1488 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1489 } else { 1490 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][0]), ENT_QUOTES, $blog_charset); 1491 } 1492 echo ' </optgroup>'."\n"; 1482 1493 echo ' </select><br/>'."\n"; 1483 1494 echo ' <input type="hidden" id="global_iTunesCategory" value="'.htmlentities(stripslashes($this->settings['iTunes']['category'][0]), ENT_QUOTES, $blog_charset).'" />'."\n"; 1484 1495 echo ' <select name="iTunesCategory[1]">'."\n"; 1496 echo ' <optgroup label="'.__('Select Second', 'podpress').'">'."\n"; 1485 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"; 1486 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][1]), ENT_QUOTES, $blog_charset); 1498 if (empty($data['iTunesCategory'][1])) { 1499 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1500 } else { 1501 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][1]), ENT_QUOTES, $blog_charset); 1502 } 1503 echo ' </optgroup>'."\n"; 1487 1504 echo ' </select><br/>'."\n"; 1488 1505 echo ' <select name="iTunesCategory[2]">'."\n"; 1506 echo ' <optgroup label="'.__('Select Third', 'podpress').'">'."\n"; 1489 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"; 1490 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][2]), ENT_QUOTES, $blog_charset); 1508 if (empty($data['iTunesCategory'][2])) { 1509 podPress_itunesCategoryOptions(htmlentities('##Global##'), ENT_QUOTES, $blog_charset); 1510 } else { 1511 podPress_itunesCategoryOptions(htmlentities($data['iTunesCategory'][2]), ENT_QUOTES, $blog_charset); 1512 } 1513 echo ' </optgroup>'."\n"; 1491 1514 echo ' </select>'."\n"; 1492 1515 echo ' </td>'."\n"; 1493 1516 echo ' </tr>'."\n"; -
podpress_admin_feed_class.php
47 47 echo ' <input type="submit" name="Submit" value="'.__('Update Options', 'podpress').' »" /> '."\n"; 48 48 echo ' </p> '."\n"; 49 49 */ 50 echo ' <table width="100%" cellspacing="2" cellpadding="5" class="editform" >'."\n";50 echo ' <table width="100%" cellspacing="2" cellpadding="5" class="editform" id="podpress_feed_options_table">'."\n"; 51 51 echo ' <tr>'."\n"; 52 52 echo ' <td width="50%"><h3>'.__('iTunes Settings', 'podpress').'</h3></td>'."\n"; 53 53 echo ' <td width="50%"><h3>'.__('Standard Settings', 'podpress').'</h3></td>'."\n"; … … 125 125 126 126 echo ' <tr valign="top">'."\n"; 127 127 echo ' <td width="50%">'."\n"; 128 echo ' <label for="iTunesImage"><strong>'.__('iTunes:Image', 'podpress').' (300*300 pixels)</strong></label>'."\n";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"; 131 echo ' <br/>'; 130 132 echo ' <input id="iTunesImage" type="text" name="iTunes[image]" value="'.$this->settings['iTunes']['image'].'" size="40" onchange="podPress_updateFeedSettings();"/>'."\n"; 131 133 echo ' <br />'; 132 echo ' <img id="iTunesImagePreview" width="300" height="300" alt="Podcast Image - Big" src="" />'."\n"; 134 echo ' <img id="iTunesImagePreview" style="width:300px; height:300px;" alt="Podcast Image - Big" src="" />'."<br />\n"; 135 echo ' <em>'.__('(This image is only a preview which is limited to 300 x 300 pixels.) ', 'podpress').'</em>'; 133 136 echo ' </td>'."\n"; 134 137 echo ' <td width="50%">'."\n"; 135 echo ' <label for="rss_image"><strong>'.__('Blog/RSS Image ', 'podpress').' (144*144 pixels)</strong></label>'."\n";138 echo ' <label for="rss_image"><strong>'.__('Blog/RSS Image (144 x 144 pixels)', 'podpress').'</strong></label>'."\n"; 136 139 echo ' <br/>'; 137 140 echo ' <input id="rss_image" type="text" name="rss_image" value="'.get_option('rss_image').'" size="40" onchange="podPress_updateFeedSettings();"/>'."\n"; 138 141 echo ' <br />'; 139 echo ' <img id="rss_imagePreview" width="144" height="144" alt="Podcast Image - Small" src="" />'."\n";142 echo ' <img id="rss_imagePreview" style="width:144px; height:144px;" alt="Podcast Image - Small" src="" />'."\n"; 140 143 echo ' </td>'."\n"; 141 144 echo ' </tr>'."\n"; 142 145 … … 164 167 echo ' <label for="rss_language"><strong>'.__('Language', 'podpress').'</strong></label>'; 165 168 echo ' <br/>'; 166 169 echo ' <select id="rss_language" name="rss_language" onchange="podPress_updateFeedSettings();">'."\n"; 167 echo ' <opt ion value="#">'.__('Select Language', 'podpress').'</option>'."\n";170 echo ' <optgroup label="'.__('Select Language', 'podpress').'">'."\n"; 168 171 podPress_itunesLanguageOptions(get_option('rss_language')); 172 echo ' </optgroup>'."\n"; 169 173 echo ' </select>'."\n"; 170 echo ' <br/>'.__('Used as default Podcast Episode Title', 'podpress').' (255 '.__('characters', 'podpress').')'."\n";171 174 echo ' </td>'."\n"; 172 175 echo ' </tr>'."\n"; 173 176 … … 194 197 echo ' <label for="iTunesCategory_0"><strong>'.__('iTunes:Categories', 'podpress').'</strong></label>'; 195 198 echo ' <br/>'; 196 199 echo ' <select id="iTunesCategory_0" name="iTunes[category][0]" onchange="podPress_updateFeedSettings();">'."\n"; 197 echo ' <opt ion value="#">'.__('Select Primary', 'podpress').'</option>'."\n";200 echo ' <optgroup label="'.__('Select Primary', 'podpress').'">'."\n"; 198 201 podPress_itunesCategoryOptions(htmlentities($this->settings['iTunes']['category'][0]), ENT_QUOTES, $blog_charset); 202 echo ' </optgroup>'."\n"; 199 203 echo ' </select>'."\n"; 200 204 echo ' <select name="iTunes[category][1]">'."\n"; 201 echo ' <opt ion value="#">'.__('Select Second', 'podpress').'</option>'."\n";205 echo ' <optgroup label="'.__('Select Second', 'podpress').'">'."\n"; 202 206 podPress_itunesCategoryOptions(htmlentities($this->settings['iTunes']['category'][1]), ENT_QUOTES, $blog_charset); 207 echo ' </optgroup>'."\n"; 203 208 echo ' </select>'."\n"; 204 209 echo ' <select name="iTunes[category][2]">'."\n"; 205 echo ' <opt ion value="#">'.__('Select Third', 'podpress').'</option>'."\n";210 echo ' <optgroup label="'.__('Select Third', 'podpress').'">'."\n"; 206 211 podPress_itunesCategoryOptions(htmlentities($this->settings['iTunes']['category'][2]), ENT_QUOTES, $blog_charset); 212 echo ' </optgroup>'."\n"; 207 213 echo ' </select>'."\n"; 208 214 echo ' </td>'."\n"; 209 215 echo ' <td width="50%">'."\n"; … … 286 292 echo ' <option value="No" '; if($this->settings['protectFeed'] != 'Yes') { echo 'selected="selected"'; } echo '>'.__('No', 'podpress').'</option>'."\n"; 287 293 echo ' <option value="Yes" '; if($this->settings['protectFeed'] == 'Yes') { echo 'selected="selected"'; } echo '>'.__('Yes', 'podpress').'</option>'."\n"; 288 294 echo ' </select>'."\n"; 289 echo ' <br/>'.__(' This will strip out any invalid characters, as well as images and links from your post content in the feeds. Only works with UTF-8 feeds.', 'podpress')."\n";295 echo ' <br/>'.__('"Yes" will convert any invalid characters to their numeric character references in the feeds. "No" will convert only ampersand, less-than, greater-than, apostrophe and quotation signs to their numeric character references.', 'podpress')."\n"; 290 296 echo ' </td>'."\n"; 291 297 echo ' </tr>'."\n"; 292 298 -
podpress_admin_functions.php
359 359 } 360 360 361 361 362 function podPress_videoDimensionOptions( ) {362 function podPress_videoDimensionOptions($selected='320:240') { 363 363 $dimensions = array(); 364 364 reset($dimensions); 365 365 366 $dimensions['0'] = __('Common Dimensions', 'podpress');367 366 $dimensions['160:120'] = '160 x 120'; 368 367 $dimensions['320:240'] = '320 x 240'; 369 368 $dimensions['640:480'] = '640 x 480'; … … 372 371 $dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]'; 373 372 $dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]'; 374 373 $dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]'; 375 374 echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n"; 376 375 foreach ($dimensions as $key => $value) { 377 echo '<option value="'.$key.'">'.$value.'</option>'."\n"; 376 if ($key == $selected) { 377 $selected_str =' selected="selected"'; 378 } else { 379 $selected_str =''; 380 } 381 echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n"; 378 382 } 383 echo '</optgroup>'."\n"; 379 384 } 380 385 381 386 function podPress_itunesLanguageArray() { … … 480 485 } 481 486 482 487 function podPress_itunesLanguageOptions($current = 'en-us') { 483 484 488 $langs = podPress_itunesLanguageArray(); 485 489 reset($langs); 486 490 foreach ($langs as $key => $value) { … … 494 498 495 499 function podPress_itunesCategoryOptions($current = '') { 496 500 $cats = array(); 501 if ('' == trim($current) AND '##Global##' != $current) { 502 $current='[ '.__('nothing', 'podpress').' ]'; 503 } 504 $cats[] = '[ '.__('nothing', 'podpress').' ]'; 497 505 498 506 $cats[] = 'Arts'; 499 507 $cats[] = 'Arts:Design'; … … 590 598 } 591 599 echo ' >'.$value.'</option>'."\n"; 592 600 } 593 594 if(!$foundit ) {601 602 if(!$foundit AND '##Global##' != $current) { 595 603 $current = podPress_upgradeCategory($current); 596 604 echo '<option selected="selected">'.$current.'</option>'."\n"; 597 605 } -
podpress_admin_wp27plus.css
8 8 line-height:100%; 9 9 padding-top:0.5em; 10 10 } 11 12 #podpress_feed_options_table td { 13 padding:15px 0px 0px 0px; 14 } 15 No newline at end of file -
podpress_feed_functions.php
21 21 /*************************************************************/ 22 22 /* feed generation functions */ 23 23 /*************************************************************/ 24 25 function podPress_feedSafeContent($input, $aggressive = false) 26 { 24 25 function podPress_feedSafeContent($input, $aggressive = false) { 27 26 GLOBAL $podPress; 28 if ( ('no' == strtolower($podPress->settings['protectFeed']) OR FALSE === $podPress->settings['protectFeed']) AND !$aggressive) { 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) { 29 30 return $input; 30 31 } 31 $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE); 32 if($aggressive) { 33 $result = str_replace(array('&', '<', '>', '&'), '', $result); 32 */ 33 // replace the relevant characters with their HTML entities 34 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 $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE); 36 } else { 37 $result = htmlspecialchars($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE); 34 38 } 39 40 if (TRUE === $aggressive) { // this option is only reachable via php source code and via the WP backend 41 $input = $result; 42 $result = str_replace(array('&', '<', '>', '&'), '', $input); 43 } 44 $input = $result; 45 46 // get the HTML translation table 47 $table = get_html_translation_table(HTML_ENTITIES);//HTML_SPECIALCHARS 48 49 // replace the HTML entities with their numeric entities which are okay for XML 50 foreach ($table as $chr => $htmlentity) { 51 $ord = ord($chr); // get the ASCII number of the character 52 $result = str_replace($htmlentity, '&#'.$ord.';', $input); 53 $input = $result; 54 } 35 55 return $result; 36 56 } 37 57 … … 54 74 } 55 75 } 56 76 } 57 58 77 if(!isset($podPress->settings['category_data'])) { 59 78 podPress_feed_getCategory(); 60 79 } … … 129 148 if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) { 130 149 $data['rss_ttl'] = 1440; 131 150 } 132 echo ' <!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n";151 echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 133 152 if (empty($data['rss_copyright'])) { 134 echo ' <copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n";153 echo ' <copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 135 154 } else { 136 echo ' <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n";155 echo ' <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 137 156 } 138 157 if($data['new-feed-url'] == 'Enable') { 139 158 if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) { 140 159 echo ' <itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n"; 141 160 } 142 161 } 143 echo ' <managingEditor>'.podPress_feedSafeContent(stripslashes(get_option('admin_email'))).' ('.podPress_feedSafeContent($data['author']).')</managingEditor>'."\n";144 echo ' <webMaster>'.podPress_feedSafeContent(get_option('admin_email')).' ('.podPress_feedSafeContent($data['author']).')</webMaster>'."\n";145 echo ' <category>'.podPress_feedSafeContent($rss_category).'</category>'."\n";162 echo ' <managingEditor>'.podPress_feedSafeContent(stripslashes(get_option('admin_email'))).' ('.podPress_feedSafeContent($data['author']).')</managingEditor>'."\n"; 163 echo ' <webMaster>'.podPress_feedSafeContent(get_option('admin_email')).' ('.podPress_feedSafeContent($data['author']).')</webMaster>'."\n"; 164 echo ' <category>'.podPress_feedSafeContent($rss_category).'</category>'."\n"; 146 165 if(!empty($data['rss_ttl'])) { 147 echo ' <ttl>'.$data['rss_ttl'].'</ttl>'."\n";166 echo ' <ttl>'.$data['rss_ttl'].'</ttl>'."\n"; 148 167 } 149 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords'], true), 255).'</itunes:keywords>'."\n";150 echo ' <itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle'], true), 255).'</itunes:subtitle>'."\n";151 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($data['summary'], true), 4000).'</itunes:summary>'."\n";152 echo ' <itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n";153 echo ' ' .podPress_getiTunesCategoryTags();154 echo ' <itunes:owner>'."\n";155 echo ' <itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n";156 echo ' <itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n";157 echo ' </itunes:owner>'."\n";168 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n"; 169 echo ' <itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle']), 255).'</itunes:subtitle>'."\n"; 170 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($data['summary']), 4000).'</itunes:summary>'."\n"; 171 echo ' <itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n"; 172 echo podPress_getiTunesCategoryTags(); 173 echo ' <itunes:owner>'."\n"; 174 echo ' <itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n"; 175 echo ' <itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n"; 176 echo ' </itunes:owner>'."\n"; 158 177 if(empty($data['block'])) { 159 178 $data['block'] = 'No'; 160 179 } 161 echo ' <itunes:block>'.$data['block'].'</itunes:block>'."\n";162 echo ' <itunes:explicit>'.podPress_feedSafeContent(strtolower($data['explicit'])).'</itunes:explicit>'."\n";163 echo ' <itunes:image href="'.$data['image'].'" />'."\n";164 echo ' <image>'."\n";165 echo ' <url>'.podPress_feedSafeContent($data['rss_image']).'</url>'."\n";166 echo ' <title>'; bloginfo_rss('name'); echo'</title>'."\n";167 echo ' <link>'; bloginfo_rss('url'); echo'</link>'."\n";168 echo ' <width>144</width>'."\n";169 echo ' <height>144</height>'."\n";170 echo ' </image>'."\n";180 echo ' <itunes:block>'.$data['block'].'</itunes:block>'."\n"; 181 echo ' <itunes:explicit>'.podPress_feedSafeContent(strtolower($data['explicit'])).'</itunes:explicit>'."\n"; 182 echo ' <itunes:image href="'.$data['image'].'" />'."\n"; 183 echo ' <image>'."\n"; 184 echo ' <url>'.$data['rss_image'].'</url>'."\n"; 185 echo ' <title>'.podPress_feedSafeContent(get_bloginfo('blogname')).'</title>'."\n"; 186 echo ' <link>'.get_bloginfo('siteurl').'</link>'."\n"; 187 echo ' <width>144</width>'."\n"; 188 echo ' <height>144</height>'."\n"; 189 echo ' </image>'."\n"; 171 190 } 172 191 173 192 function podPress_rss2_item() { … … 175 194 $enclosureTag = podPress_getEnclosureTags(); 176 195 if($enclosureTag != '') // if no enclosure tag, no need for iTunes tags 177 196 { 178 echo "\t" .$enclosureTag;197 echo $enclosureTag; 179 198 180 199 if($post->podPressPostSpecific['itunes:subtitle'] == '##PostExcerpt##') { 181 200 ob_start(); … … 187 206 if(empty($post->podPressPostSpecific['itunes:subtitle'])) { 188 207 $post->podPressPostSpecific['itunes:subtitle'] = get_the_title_rss(); 189 208 } 190 echo ' <itunes:subtitle>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:subtitle'] , true).'</itunes:subtitle>'."\n";209 echo ' <itunes:subtitle>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:subtitle']).'</itunes:subtitle>'."\n"; 191 210 192 211 if($post->podPressPostSpecific['itunes:summary'] == '##Global##') { 193 212 $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary']; … … 202 221 if(empty($post->podPressPostSpecific['itunes:summary'])) { 203 222 $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary']; 204 223 } 205 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:summary'] , true), 4000).'</itunes:summary>'."\n";224 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:summary']), 4000).'</itunes:summary>'."\n"; 206 225 207 226 if($post->podPressPostSpecific['itunes:keywords'] == '##WordPressCats##') { 208 227 $categories = get_the_category(); 209 228 $post->podPressPostSpecific['itunes:keywords'] = ''; 210 229 if(is_array($categories)) { 211 230 foreach ($categories as $category) { 212 $category->cat_name = $category->cat_name; 213 if($post->podPressPostSpecific['itunes:keywords'] != '') { 214 $post->podPressPostSpecific['itunes:keywords'] .= ', '; 215 } 216 $post->podPressPostSpecific['itunes:keywords'] .= $category->cat_name; 231 $category_names[] = $category->cat_name; 217 232 } 218 $post->podPressPostSpecific['itunes:keywords'] = trim($post->podPressPostSpecific['itunes:keywords']);233 $post->podPressPostSpecific['itunes:keywords'] = implode(', ', $category_names); 219 234 } 220 } elseif ($post->podPressPostSpecific['itunes:keywords'] == '##Global##') {235 } elseif ($post->podPressPostSpecific['itunes:keywords'] == '##Global##') { 221 236 $post->podPressPostSpecific['itunes:keywords'] = $podPress->settings['iTunes']['keywords']; 222 237 } 223 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent( str_replace(' ', ',', $post->podPressPostSpecific['itunes:keywords']), true), 255).'</itunes:keywords>'."\n";238 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:keywords']), 255).'</itunes:keywords>'."\n"; 224 239 225 240 if($post->podPressPostSpecific['itunes:author'] == '##Global##') { 226 241 $post->podPressPostSpecific['itunes:author'] = $podPress->settings['iTunes']['author']; … … 228 243 $post->podPressPostSpecific['itunes:author'] = stripslashes(get_option('admin_email')); 229 244 } 230 245 } 231 echo ' <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author'] , true).'</itunes:author>'."\n";246 echo ' <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</itunes:author>'."\n"; 232 247 233 248 if($post->podPressPostSpecific['itunes:explicit'] == 'Default') { 234 249 $post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit']; … … 253 268 $episodeLicenseTags = podPress_getEpisodeLicenseTags(); 254 269 if ($episodeLicenseTags != '') 255 270 { 256 echo "\t" .$episodeLicenseTags;271 echo $episodeLicenseTags; 257 272 } 258 273 if(isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) { 259 274 $post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']; … … 267 282 if(!isset($podPress->settings['category_data'])) { 268 283 podPress_feed_getCategory(); 269 284 } 270 echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n";285 echo "\t".'<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 271 286 if ($podPress->settings['category_data']['categoryCasting'] == 'true' && $podPress->settings['category_data']['rss_imageChoice'] == 'Custom') { 272 287 echo "\t".'<logo>'.podPress_feedSafeContent($podPress->settings['category_data']['rss_image']).'</logo>'."\n"; 273 288 } else { 274 289 echo "\t".'<logo>'.podPress_feedSafeContent(get_option('rss_image')).'</logo>'."\n"; 275 290 } 276 291 if (empty($data['rss_copyright'])) { 277 echo '<rights>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').'</rights>'."\n";292 echo "\t".'<rights>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').'</rights>'."\n"; 278 293 } else { 279 echo '<rights>'.podPress_feedSafeContent($data['rss_copyright']).'</rights>'."\n";294 echo "\t".'<rights>'.podPress_feedSafeContent($data['rss_copyright']).'</rights>'."\n"; 280 295 } 281 296 if ( !empty($podPress->settings['rss_license_url']) ) { 282 297 echo "\t".'<link rel="license" type="text/html" href="'.$podPress->settings['rss_license_url'].'" />'."\n"; … … 287 302 $enclosureTag = podPress_getEnclosureTags('atom'); 288 303 if ($enclosureTag != '') // if no enclosure tag, no need for iTunes tags 289 304 { 290 echo "\t" .$enclosureTag;305 echo $enclosureTag; 291 306 } 292 307 $episodeLicenseTags = podPress_getEpisodeLicenseTags('atom'); 293 308 if ($episodeLicenseTags != '') 294 309 { 295 echo "\t" .$episodeLicenseTags;310 echo $episodeLicenseTags; 296 311 } 297 312 } 298 313 … … 304 319 $more = 1; 305 320 echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'" ?'.">\n"; 306 321 echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">'."\n"; 307 echo "\t".'<title>'. get_bloginfo('blogname') . '</title>'."\n";322 echo "\t".'<title>'. podPress_feedSafeContent(get_bloginfo('blogname')) . '</title>'."\n"; 308 323 echo "\t".'<annotation><![CDATA['. $podPress->settings['iTunes']['summary'].']]></annotation>'."\n"; 309 324 if (empty($podPress->settings['iTunes']['author'])) { 310 325 $creator = get_bloginfo('blogname'); 311 326 } else { 312 327 $creator = $podPress->settings['iTunes']['author']; 313 328 } 314 echo "\t".'<creator>'. $creator. '</creator>'."\n";329 echo "\t".'<creator>'. podPress_feedSafeContent($creator). '</creator>'."\n"; 315 330 echo "\t".'<location>'.get_feed_link('playlist.xspf').'</location>'."\n"; 316 331 if ( !empty($podPress->settings['rss_license_url']) ) { 317 332 echo "\t".'<license>'.$podPress->settings['rss_license_url'].'</license>'."\n"; … … 357 372 case 'rss' : 358 373 case 'rdf' : // license tags for entries with the help of the Dublin Core 359 374 if (TRUE == isset($license['podcast_episode_license_url']) AND FALSE == isset($license['podcast_episode_license_name'])) { 360 $result = "\t ".'<dc:rights>'.$license['podcast_episode_license_url'].'</dc:rights>'."\n";375 $result = "\t\t".'<dc:rights>'.$license['podcast_episode_license_url'].'</dc:rights>'."\n"; 361 376 } elseif (TRUE == isset($license['podcast_episode_license_name']) AND TRUE == isset($license['podcast_episode_license_name'])) { 362 $result = "\t ".'<dc:rights>'.$license['podcast_episode_license_name'].' -'.$license['podcast_episode_license_url'].'</dc:rights>'."\n";377 $result = "\t\t".'<dc:rights>'.podPress_feedSafeContent($license['podcast_episode_license_name']).' '.$license['podcast_episode_license_url'].'</dc:rights>'."\n"; 363 378 } 364 379 break; 365 380 case 'atom' : // Atom License Extension - http://tools.ietf.org/html/rfc4946 … … 367 382 $result = "\t".'<rights>'.$license['podcast_episode_license_url'].'</rights>'."\n"; 368 383 $result .= "\t".'<link rel="license" type="text/html" href="'.$license['podcast_episode_license_url'].'" />'."\n"; 369 384 } elseif (TRUE == isset($license['podcast_episode_license_name']) AND TRUE == isset($license['podcast_episode_license_name'])) { 370 $result = "\t".'<rights>'. $license['podcast_episode_license_name'].'</rights>'."\n";385 $result = "\t".'<rights>'.podPress_feedSafeContent($license['podcast_episode_license_name']).'</rights>'."\n"; 371 386 $result .= "\t".'<link rel="license" type="text/html" href="'.$license['podcast_episode_license_url'].'" />'."\n"; 372 387 } 373 388 break; … … 380 395 } 381 396 return $result; 382 397 } 383 398 384 399 function podPress_getEnclosureTags($feedtype = 'rss2') { 385 400 GLOBAL $podPress, $post; 386 401 $result = ''; … … 426 441 } elseif ($feedtype == 'xspf') { 427 442 $post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToValidWebPath($post->podPressMedia[$key]['URI']); 428 443 if (podPress_getFileExt($post->podPressMedia[$key]['URI']) == 'mp3') { 429 $result .= "\t "."\t"."\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n";444 $result .= "\t\t\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n"; 430 445 if (!empty($post->podPressMedia[$key]['title'])) { 431 $result .= "\t "."\t"."\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n";432 $result .= "\t "."\t"."\t".'<title>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</title>\n";446 $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n"; 447 $result .= "\t\t\t".'<title>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</title>\n"; 433 448 } else { 434 $result .= "\t "."\t"."\t".'<annotation>'.podPress_feedSafeContent($post->post_title)."</annotation>\n";435 $result .= "\t "."\t"."\t".'<title>'.podPress_feedSafeContent($post->post_title)."</title>\n";449 $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->post_title)."</annotation>\n"; 450 $result .= "\t\t\t".'<title>'.podPress_feedSafeContent($post->post_title)."</title>\n"; 436 451 } 437 452 if ( '##Global##' == $post->podPressPostSpecific['itunes:author']) { 438 453 if (empty($podPress->settings['iTunes']['author'])) { … … 440 455 } else { 441 456 $creator = $podPress->settings['iTunes']['author']; 442 457 } 443 $result .= "\t "."\t"."\t".'<creator>'.$creator.'</creator>'."\n";458 $result .= "\t\t\t".'<creator>'.podPress_feedSafeContent($creator).'</creator>'."\n"; 444 459 } else { 445 $result .= "\t "."\t"."\t".'<creator>'.$post->podPressPostSpecific['itunes:author'].'</creator>'."\n";460 $result .= "\t\t\t".'<creator>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</creator>'."\n"; 446 461 } 447 if ( 'UNKNOWN' != $post->podPressMedia[$key]['duration'] ) {448 $result .= "\t "."\t"."\t".'<duration>'.$post->podPressMedia[$key]['duration'].'</duration>'."\n";462 if ( 'UNKNOWN' != $post->podPressMedia[$key]['duration'] AND FALSE === empty($post->podPressMedia[$key]['duration'])) { 463 $result .= "\t\t\t".'<duration>'.podpress_strtomilliseconds($post->podPressMedia[$key]['duration']).'</duration>'."\n"; 449 464 } 450 465 if(!empty($post->podPressMedia[$key]['previewImage'])) { 451 $result .= "\t "."\t"."\t".'<image>'.$post->podPressMedia[$key]['previewImage']."</image>\n";466 $result .= "\t\t\t".'<image>'.$post->podPressMedia[$key]['previewImage']."</image>\n"; 452 467 } 453 468 } 454 469 } elseif ($feedtype == 'rss2') { … … 469 484 } elseif($preferredFormat) { 470 485 $foundPreferred = true; 471 486 } 472 $result = '<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n";473 $result .= $durationTag;474 } elseif ($preferredFormat && !$foundPreferredAND FALSE === $same_enclosure_URL_in_postmeta_exists) {475 $result = '<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n";476 $result .= $durationTag;487 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 488 $result .= "\t\t".$durationTag; 489 } elseif ($preferredFormat && !$foundPreferred AND FALSE === $same_enclosure_URL_in_postmeta_exists) { 490 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 491 $result .= "\t\t".$durationTag; 477 492 $foundPreferred = true; 478 493 } 479 494 } … … 502 517 return $exists; 503 518 } 504 519 520 function podpress_strtomilliseconds($durationstr) { 521 $dstr_parts=explode(':', $durationstr); 522 $nr_dstr_parts=count($dstr_parts); 523 if (1 < $nr_dstr_parts AND 5 > $nr_dstr_parts) { 524 switch ($nr_dstr_parts) { 525 case 2 : 526 // this method is only good if the input data which consist of two parts is most likely in the format m:s because 527 // m:s 528 $duration = podpress_strtomilliseconds_core(1, 2, $dstr_parts); 529 if ($durationstr != podpress_millisecondstostring($duration)) { 530 // h:m 531 $duration = podpress_strtomilliseconds_core(0, 2, $dstr_parts); 532 if ($durationstr != podpress_millisecondstostring($duration)) { 533 // s:ms 534 $duration = podpress_strtomilliseconds_core(2, 2, $dstr_parts); 535 } 536 } 537 break; 538 case 3 : 539 // h:m:s 540 $duration = podpress_strtomilliseconds_core(0, 3, $dstr_parts); 541 if ($durationstr != podpress_millisecondstostring($duration)) { 542 // m:s:ms 543 $duration = podpress_strtomilliseconds_core(1, 3, $dstr_parts); 544 } 545 break; 546 case 4 : 547 $duration = podpress_strtomilliseconds_core(0, 4, $dstr_parts); 548 break; 549 } 550 } 551 if (!isset($duration) OR $duration < 0) { 552 $duration = 0; 553 } 554 return $duration; 555 } 556 557 function podpress_strtomilliseconds_core($startindex=0, $max_nr_parts=4, $dstr_parts=array()){ 558 $duration = $j = 0; 559 if (!empty($dstr_parts)) { 560 for ($i=$startindex; $i < ($max_nr_parts+$startindex); $i++) { 561 switch ($i) { 562 case 0 : // hours 563 $duration += 3600000 * intval(substr($dstr_parts[$j], 0, 2)); 564 $j++; 565 break; 566 case 1 : // minutes 567 $duration += 60000 * intval(substr($dstr_parts[$j], 0, 2)); 568 $j++; 569 break; 570 case 2 : // seconds 571 $duration += 1000 * intval(substr($dstr_parts[$j], 0, 2)); 572 $j++; 573 break; 574 case 3 : // milliseconds 575 $duration += intval(substr($dstr_parts[$j], 0, 2)); 576 $j++; 577 break; 578 } 579 } 580 } 581 return $duration; 582 } 583 584 function podpress_millisecondstostring($duration) { 585 // 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. 586 // If the leading parts is zero then the return string will not contain this part. 587 $hours = intval($duration / (3600000)); 588 $minutes = intval($duration / (60000) % 60); 589 $seconds = intval($duration / (1000) % 60); 590 $mseconds = intval($duration % 1000); 591 $duration_array = array($hours, $minutes, $seconds, $mseconds); 592 $dur_str =""; 593 $j=0; 594 foreach($duration_array as $key => $dur_part) { 595 if ("" == $dur_str AND 0 == $dur_part) { 596 } else { 597 if (3 == $key AND 0 == $dur_part) { 598 } else { 599 if ($j > 0) { 600 $dur_str .= ":".strval($dur_part); 601 } else { 602 $dur_str .= strval($dur_part); 603 } 604 $j++; 605 } 606 } 607 } 608 return $dur_str; 609 } 610 505 611 function podPress_getiTunesCategoryTags() { 506 612 GLOBAL $podPress, $post; 507 613 $result = ''; … … 522 628 } 523 629 if(is_array($data)) { 524 630 foreach($data as $thiscat) { 525 if (strstr($thiscat, ':')) {631 if (strstr($thiscat, ':')) { 526 632 list($cat, $subcat) = explode(":", $thiscat); 527 $result .= '<itunes:category text="'.str_replace('&', '&', $cat).'">'."\n"; 528 $result .= "\t".'<itunes:category text="'.str_replace('&', '&', $subcat).'"/>'."\n"; 529 $result .= '</itunes:category>'."\n"; 633 $result .= "\t".'<itunes:category text="'.str_replace('&', '&', $cat).'">'."\n"; 634 $result .= "\t\t".'<itunes:category text="'.str_replace('&', '&', $subcat).'" />'."\n"; 635 $result .= "\t".'</itunes:category>'."\n"; 636 } elseif (!empty($thiscat) AND '[ '.__('nothing', 'podpress').' ]' != $thiscat ) { 637 $result .= "\t".'<itunes:category text="'.str_replace('&', '&', $thiscat).'" />'."\n"; 530 638 } 531 elseif(!empty($thiscat))532 {533 $result .= '<itunes:category text="'.str_replace('&', '&', $thiscat).'"/>'."\n";534 }535 639 } 536 640 } 537 641 if(empty($result)) { 538 $result .= '<itunes:category text="Society & Culture"/>'."\n";642 $result .= "\t".'<itunes:category text="Society & Culture" />'."\n"; 539 643 } 540 644 return $result; 541 645 }
