Ticket #1064: new_feed_protection_and_fixes_for_feed_settings_pages.2.patch
| File new_feed_protection_and_fixes_for_feed_settings_pages.2.patch, 43.2 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 if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) { 36 $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE); 37 } else { 38 $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset')); 39 } 40 } else { 41 if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) { 42 $result = htmlspecialchars($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE); 43 } else { 44 $result = htmlspecialchars($input, ENT_NOQUOTES, get_bloginfo('charset')); 45 } 34 46 } 47 48 if (TRUE === $aggressive) { // this option is only reachable via php source code and via the WP backend 49 $input = $result; 50 $result = str_replace(array('&', '<', '>', '&'), '', $input); 51 } 52 $input = $result; 53 54 // get the HTML translation table 55 $table = get_html_translation_table(HTML_ENTITIES);//HTML_SPECIALCHARS 56 57 // replace the HTML entities with their numeric entities which are okay for XML 58 foreach ($table as $chr => $htmlentity) { 59 $ord = ord($chr); // get the ASCII number of the character 60 $result = str_replace($htmlentity, '&#'.$ord.';', $input); 61 $input = $result; 62 } 35 63 return $result; 36 64 } 37 65 … … 54 82 } 55 83 } 56 84 } 57 58 85 if(!isset($podPress->settings['category_data'])) { 59 86 podPress_feed_getCategory(); 60 87 } … … 129 156 if(!empty($data['rss_ttl']) && $data['rss_ttl'] < 1440) { 130 157 $data['rss_ttl'] = 1440; 131 158 } 132 echo ' <!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n";159 echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 133 160 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";161 echo ' <copyright>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 135 162 } else { 136 echo ' <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n";163 echo ' <copyright>'.podPress_feedSafeContent($data['rss_copyright']).' '.$podPress->settings['rss_license_url'].'</copyright>'."\n"; 137 164 } 138 165 if($data['new-feed-url'] == 'Enable') { 139 166 if(!empty($data['podcastFeedURL']) && !strpos(strtolower($data['podcastFeedURL']), 'phobos.apple.com') && !strpos(strtolower($data['podcastFeedURL']), 'itpc://')) { 140 167 echo ' <itunes:new-feed-url>'.podPress_feedSafeContent($data['podcastFeedURL']).'</itunes:new-feed-url>'."\n"; 141 168 } 142 169 } 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";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"; 172 echo ' <category>'.podPress_feedSafeContent($rss_category).'</category>'."\n"; 146 173 if(!empty($data['rss_ttl'])) { 147 echo ' <ttl>'.$data['rss_ttl'].'</ttl>'."\n";174 echo ' <ttl>'.$data['rss_ttl'].'</ttl>'."\n"; 148 175 } 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";176 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($data['keywords']), 255).'</itunes:keywords>'."\n"; 177 echo ' <itunes:subtitle>'.podPress_stringLimiter(podPress_feedSafeContent($data['subtitle']), 255).'</itunes:subtitle>'."\n"; 178 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($data['summary']), 4000).'</itunes:summary>'."\n"; 179 echo ' <itunes:author>'.podPress_feedSafeContent($data['author']).'</itunes:author>'."\n"; 180 echo podPress_getiTunesCategoryTags(); 181 echo ' <itunes:owner>'."\n"; 182 echo ' <itunes:name>'.stripslashes(podPress_feedSafeContent($data['author'])).'</itunes:name>'."\n"; 183 echo ' <itunes:email>'.podPress_feedSafeContent($data['admin_email']).'</itunes:email>'."\n"; 184 echo ' </itunes:owner>'."\n"; 158 185 if(empty($data['block'])) { 159 186 $data['block'] = 'No'; 160 187 } 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";188 echo ' <itunes:block>'.$data['block'].'</itunes:block>'."\n"; 189 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"; 171 198 } 172 199 173 200 function podPress_rss2_item() { … … 175 202 $enclosureTag = podPress_getEnclosureTags(); 176 203 if($enclosureTag != '') // if no enclosure tag, no need for iTunes tags 177 204 { 178 echo "\t" .$enclosureTag;205 echo $enclosureTag; 179 206 180 207 if($post->podPressPostSpecific['itunes:subtitle'] == '##PostExcerpt##') { 181 208 ob_start(); … … 187 214 if(empty($post->podPressPostSpecific['itunes:subtitle'])) { 188 215 $post->podPressPostSpecific['itunes:subtitle'] = get_the_title_rss(); 189 216 } 190 echo ' <itunes:subtitle>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:subtitle'] , true).'</itunes:subtitle>'."\n";217 echo ' <itunes:subtitle>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:subtitle']).'</itunes:subtitle>'."\n"; 191 218 192 219 if($post->podPressPostSpecific['itunes:summary'] == '##Global##') { 193 220 $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary']; … … 202 229 if(empty($post->podPressPostSpecific['itunes:summary'])) { 203 230 $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary']; 204 231 } 205 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:summary'] , true), 4000).'</itunes:summary>'."\n";232 echo ' <itunes:summary>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:summary']), 4000).'</itunes:summary>'."\n"; 206 233 207 234 if($post->podPressPostSpecific['itunes:keywords'] == '##WordPressCats##') { 208 235 $categories = get_the_category(); 209 236 $post->podPressPostSpecific['itunes:keywords'] = ''; 210 237 if(is_array($categories)) { 211 238 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; 239 $category_names[] = $category->cat_name; 217 240 } 218 $post->podPressPostSpecific['itunes:keywords'] = trim($post->podPressPostSpecific['itunes:keywords']);241 $post->podPressPostSpecific['itunes:keywords'] = implode(', ', $category_names); 219 242 } 220 } elseif ($post->podPressPostSpecific['itunes:keywords'] == '##Global##') {243 } elseif ($post->podPressPostSpecific['itunes:keywords'] == '##Global##') { 221 244 $post->podPressPostSpecific['itunes:keywords'] = $podPress->settings['iTunes']['keywords']; 222 245 } 223 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent( str_replace(' ', ',', $post->podPressPostSpecific['itunes:keywords']), true), 255).'</itunes:keywords>'."\n";246 echo ' <itunes:keywords>'.podPress_stringLimiter(podPress_feedSafeContent($post->podPressPostSpecific['itunes:keywords']), 255).'</itunes:keywords>'."\n"; 224 247 225 248 if($post->podPressPostSpecific['itunes:author'] == '##Global##') { 226 249 $post->podPressPostSpecific['itunes:author'] = $podPress->settings['iTunes']['author']; … … 228 251 $post->podPressPostSpecific['itunes:author'] = stripslashes(get_option('admin_email')); 229 252 } 230 253 } 231 echo ' <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author'] , true).'</itunes:author>'."\n";254 echo ' <itunes:author>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</itunes:author>'."\n"; 232 255 233 256 if($post->podPressPostSpecific['itunes:explicit'] == 'Default') { 234 257 $post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit']; … … 253 276 $episodeLicenseTags = podPress_getEpisodeLicenseTags(); 254 277 if ($episodeLicenseTags != '') 255 278 { 256 echo "\t" .$episodeLicenseTags;279 echo $episodeLicenseTags; 257 280 } 258 281 if(isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) { 259 282 $post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']; … … 267 290 if(!isset($podPress->settings['category_data'])) { 268 291 podPress_feed_getCategory(); 269 292 } 270 echo '<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n";293 echo "\t".'<!-- podcast_generator="podPress/'.PODPRESS_VERSION.'" - maintenance_release="'.PODPRESS_MAINTENANCE_VERSION.'" -->'."\n"; 271 294 if ($podPress->settings['category_data']['categoryCasting'] == 'true' && $podPress->settings['category_data']['rss_imageChoice'] == 'Custom') { 272 295 echo "\t".'<logo>'.podPress_feedSafeContent($podPress->settings['category_data']['rss_image']).'</logo>'."\n"; 273 296 } else { 274 297 echo "\t".'<logo>'.podPress_feedSafeContent(get_option('rss_image')).'</logo>'."\n"; 275 298 } 276 299 if (empty($data['rss_copyright'])) { 277 echo '<rights>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').'</rights>'."\n";300 echo "\t".'<rights>'.podPress_feedSafeContent(__('Copyright', 'podpress').' © '. date('Y',time())).' '.get_bloginfo('blogname').'</rights>'."\n"; 278 301 } else { 279 echo '<rights>'.podPress_feedSafeContent($data['rss_copyright']).'</rights>'."\n";302 echo "\t".'<rights>'.podPress_feedSafeContent($data['rss_copyright']).'</rights>'."\n"; 280 303 } 281 304 if ( !empty($podPress->settings['rss_license_url']) ) { 282 305 echo "\t".'<link rel="license" type="text/html" href="'.$podPress->settings['rss_license_url'].'" />'."\n"; … … 287 310 $enclosureTag = podPress_getEnclosureTags('atom'); 288 311 if ($enclosureTag != '') // if no enclosure tag, no need for iTunes tags 289 312 { 290 echo "\t" .$enclosureTag;313 echo $enclosureTag; 291 314 } 292 315 $episodeLicenseTags = podPress_getEpisodeLicenseTags('atom'); 293 316 if ($episodeLicenseTags != '') 294 317 { 295 echo "\t" .$episodeLicenseTags;318 echo $episodeLicenseTags; 296 319 } 297 320 } 298 321 … … 304 327 $more = 1; 305 328 echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'" ?'.">\n"; 306 329 echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">'."\n"; 307 echo "\t".'<title>'. get_bloginfo('blogname') . '</title>'."\n";330 echo "\t".'<title>'. podPress_feedSafeContent(get_bloginfo('blogname')) . '</title>'."\n"; 308 331 echo "\t".'<annotation><![CDATA['. $podPress->settings['iTunes']['summary'].']]></annotation>'."\n"; 309 332 if (empty($podPress->settings['iTunes']['author'])) { 310 333 $creator = get_bloginfo('blogname'); 311 334 } else { 312 335 $creator = $podPress->settings['iTunes']['author']; 313 336 } 314 echo "\t".'<creator>'. $creator. '</creator>'."\n";337 echo "\t".'<creator>'. podPress_feedSafeContent($creator). '</creator>'."\n"; 315 338 echo "\t".'<location>'.get_feed_link('playlist.xspf').'</location>'."\n"; 316 339 if ( !empty($podPress->settings['rss_license_url']) ) { 317 340 echo "\t".'<license>'.$podPress->settings['rss_license_url'].'</license>'."\n"; … … 357 380 case 'rss' : 358 381 case 'rdf' : // license tags for entries with the help of the Dublin Core 359 382 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";383 $result = "\t\t".'<dc:rights>'.$license['podcast_episode_license_url'].'</dc:rights>'."\n"; 361 384 } 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";385 $result = "\t\t".'<dc:rights>'.podPress_feedSafeContent($license['podcast_episode_license_name']).' '.$license['podcast_episode_license_url'].'</dc:rights>'."\n"; 363 386 } 364 387 break; 365 388 case 'atom' : // Atom License Extension - http://tools.ietf.org/html/rfc4946 … … 367 390 $result = "\t".'<rights>'.$license['podcast_episode_license_url'].'</rights>'."\n"; 368 391 $result .= "\t".'<link rel="license" type="text/html" href="'.$license['podcast_episode_license_url'].'" />'."\n"; 369 392 } 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";393 $result = "\t".'<rights>'.podPress_feedSafeContent($license['podcast_episode_license_name']).'</rights>'."\n"; 371 394 $result .= "\t".'<link rel="license" type="text/html" href="'.$license['podcast_episode_license_url'].'" />'."\n"; 372 395 } 373 396 break; … … 380 403 } 381 404 return $result; 382 405 } 383 406 384 407 function podPress_getEnclosureTags($feedtype = 'rss2') { 385 408 GLOBAL $podPress, $post; 386 409 $result = ''; … … 426 449 } elseif ($feedtype == 'xspf') { 427 450 $post->podPressMedia[$key]['URI'] = $podPress->convertPodcastFileNameToValidWebPath($post->podPressMedia[$key]['URI']); 428 451 if (podPress_getFileExt($post->podPressMedia[$key]['URI']) == 'mp3') { 429 $result .= "\t "."\t"."\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n";452 $result .= "\t\t\t".'<location>'.$post->podPressMedia[$key]['URI']."</location>\n"; 430 453 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";454 $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</annotation>\n"; 455 $result .= "\t\t\t".'<title>'.podPress_feedSafeContent($post->podPressMedia[$key]['title'])."</title>\n"; 433 456 } 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";457 $result .= "\t\t\t".'<annotation>'.podPress_feedSafeContent($post->post_title)."</annotation>\n"; 458 $result .= "\t\t\t".'<title>'.podPress_feedSafeContent($post->post_title)."</title>\n"; 436 459 } 437 460 if ( '##Global##' == $post->podPressPostSpecific['itunes:author']) { 438 461 if (empty($podPress->settings['iTunes']['author'])) { … … 440 463 } else { 441 464 $creator = $podPress->settings['iTunes']['author']; 442 465 } 443 $result .= "\t "."\t"."\t".'<creator>'.$creator.'</creator>'."\n";466 $result .= "\t\t\t".'<creator>'.podPress_feedSafeContent($creator).'</creator>'."\n"; 444 467 } else { 445 $result .= "\t "."\t"."\t".'<creator>'.$post->podPressPostSpecific['itunes:author'].'</creator>'."\n";468 $result .= "\t\t\t".'<creator>'.podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']).'</creator>'."\n"; 446 469 } 447 if ( 'UNKNOWN' != $post->podPressMedia[$key]['duration'] ) {448 $result .= "\t "."\t"."\t".'<duration>'.$post->podPressMedia[$key]['duration'].'</duration>'."\n";470 if ( 'UNKNOWN' != $post->podPressMedia[$key]['duration'] AND FALSE === empty($post->podPressMedia[$key]['duration'])) { 471 $result .= "\t\t\t".'<duration>'.podpress_strtomilliseconds($post->podPressMedia[$key]['duration']).'</duration>'."\n"; 449 472 } 450 473 if(!empty($post->podPressMedia[$key]['previewImage'])) { 451 $result .= "\t "."\t"."\t".'<image>'.$post->podPressMedia[$key]['previewImage']."</image>\n";474 $result .= "\t\t\t".'<image>'.$post->podPressMedia[$key]['previewImage']."</image>\n"; 452 475 } 453 476 } 454 477 } elseif ($feedtype == 'rss2') { … … 469 492 } elseif($preferredFormat) { 470 493 $foundPreferred = true; 471 494 } 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;495 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 496 $result .= "\t\t".$durationTag; 497 } elseif ($preferredFormat && !$foundPreferred AND FALSE === $same_enclosure_URL_in_postmeta_exists) { 498 $result = "\t\t".'<enclosure url="'.$post->podPressMedia[$key]['URI'].'" length="'.$post->podPressMedia[$key]['size'].'" type="'.$post->podPressMedia[$key]['mimetype'].'"/>'."\n"; 499 $result .= "\t\t".$durationTag; 477 500 $foundPreferred = true; 478 501 } 479 502 } … … 502 525 return $exists; 503 526 } 504 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); 543 } 544 } 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; 557 } 558 } 559 if (!isset($duration) OR $duration < 0) { 560 $duration = 0; 561 } 562 return $duration; 563 } 564 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++; 573 break; 574 case 1 : // minutes 575 $duration += 60000 * intval(substr($dstr_parts[$j], 0, 2)); 576 $j++; 577 break; 578 case 2 : // seconds 579 $duration += 1000 * intval(substr($dstr_parts[$j], 0, 2)); 580 $j++; 581 break; 582 case 3 : // milliseconds 583 $duration += intval(substr($dstr_parts[$j], 0, 2)); 584 $j++; 585 break; 586 } 587 } 588 } 589 return $duration; 590 } 591 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) { 606 } else { 607 if ($j > 0) { 608 $dur_str .= ":".strval($dur_part); 609 } else { 610 $dur_str .= strval($dur_part); 611 } 612 $j++; 613 } 614 } 615 } 616 return $dur_str; 617 } 618 505 619 function podPress_getiTunesCategoryTags() { 506 620 GLOBAL $podPress, $post; 507 621 $result = ''; … … 522 636 } 523 637 if(is_array($data)) { 524 638 foreach($data as $thiscat) { 525 if (strstr($thiscat, ':')) {639 if (strstr($thiscat, ':')) { 526 640 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"; 641 $result .= "\t".'<itunes:category text="'.str_replace('&', '&', $cat).'">'."\n"; 642 $result .= "\t\t".'<itunes:category text="'.str_replace('&', '&', $subcat).'" />'."\n"; 643 $result .= "\t".'</itunes:category>'."\n"; 644 } elseif (!empty($thiscat) AND '[ '.__('nothing', 'podpress').' ]' != $thiscat ) { 645 $result .= "\t".'<itunes:category text="'.str_replace('&', '&', $thiscat).'" />'."\n"; 530 646 } 531 elseif(!empty($thiscat))532 {533 $result .= '<itunes:category text="'.str_replace('&', '&', $thiscat).'"/>'."\n";534 }535 647 } 536 648 } 537 649 if(empty($result)) { 538 $result .= '<itunes:category text="Society & Culture"/>'."\n";650 $result .= "\t".'<itunes:category text="Society & Culture" />'."\n"; 539 651 } 540 652 return $result; 541 653 }
