function powerpressplayer_link_title($content, $media_url, $ExtraData = array()) { if ($content) { $extension = 'unknown'; $parts = pathinfo($media_url); if ($parts && isset($parts['extension'])) { $extension = strtolower($parts['extension']); } $prefix = ''; if ($extension == 'pdf') { $prefix .= __('E-Book PDF', 'powerpress') . ($ExtraData['feed'] == 'pdf' || $ExtraData['feed'] == 'podcast' ? '' : " ({$ExtraData['feed']})") . POWERPRESS_TEXT_SEPARATOR; } else { if ($ExtraData['feed'] != 'podcast') { $prefix .= htmlspecialchars(POWERPRESS_LINKS_TEXT) . ' (' . htmlspecialchars($ExtraData['feed']) . ')' . POWERPRESS_TEXT_SEPARATOR; } else { $prefix .= htmlspecialchars(POWERPRESS_LINKS_TEXT) . POWERPRESS_TEXT_SEPARATOR; } } if (!empty($prefix)) { $prefix .= ' '; } $return = '<p class="powerpress_links powerpress_links_' . $extension . '">' . $prefix . $content . '</p>'; $player = powerpressplayer_embedable($media_url, $ExtraData); if ($player) { $iframe_src = powerpress_generate_embed($player, $ExtraData); $return .= '<p class="powerpress_embed_box" id="powerpress_embed_' . "{$ExtraData['id']}-{$ExtraData['feed']}" . '" style="display: none;">'; $return .= '<input id="powerpress_embed_' . "{$ExtraData['id']}-{$ExtraData['feed']}" . '_t" type="text" value="' . htmlspecialchars($iframe_src) . '" onclick="javascript: this.select();" onfocus="javascript: this.select();" style="width: 70%;" readOnly>'; $return .= '</p>'; } return $return; } return ''; }
function powerpress_rss2_item() { global $post, $powerpress_feed; // are we processing a feed that powerpress should handle if (!powerpress_is_podcast_feed()) { return; } if (function_exists('post_password_required')) { if (post_password_required($post)) { return $content; } } // Check and see if we're working with a podcast episode $custom_enclosure = false; if (powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() && !is_tax() && !is_tag()) { $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed')); $custom_enclosure = true; } else { $EpisodeData = powerpress_get_enclosure_data($post->ID, 'podcast'); if (!$EpisodeData && !empty($powerpress_feed['process_podpress'])) { $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID); $custom_enclosure = true; } } if (!$EpisodeData || !$EpisodeData['url']) { return; } // If enclosure not added, check to see why... if (defined('POWERPRESS_ENCLOSURE_FIX') && POWERPRESS_ENCLOSURE_FIX && !$custom_enclosure && $GLOBALS['powerpress_rss_enclosure_post_id'] != $post->ID) { $enclosure_in_wp = apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($EpisodeData['url']) . '" length="' . $EpisodeData['size'] . '" type="' . $EpisodeData['type'] . '" />' . "\n")); if (!$enclosure_in_wp) { $custom_enclosure = true; } } $author = $powerpress_feed['itunes_talent_name']; if (isset($powerpress_feed['itunes_author_post'])) { $author = get_the_author(); } $explicit = $powerpress_feed['explicit']; $summary = false; $subtitle = false; $block = false; $cc = false; if (isset($EpisodeData['summary']) && strlen($EpisodeData['summary']) > 1) { $summary = $EpisodeData['summary']; } if (isset($EpisodeData['subtitle']) && strlen($EpisodeData['subtitle']) > 1) { $subtitle = $EpisodeData['subtitle']; } if (isset($EpisodeData['explicit']) && is_numeric($EpisodeData['explicit'])) { $explicit_array = array("no", "yes", "clean"); $explicit = $explicit_array[$EpisodeData['explicit']]; } // Code for future use: if (!empty($EpisodeData['author'])) { $author = $EpisodeData['author']; } if (!empty($EpisodeData['block'])) { $block = 'yes'; } if (!empty($EpisodeData['cc'])) { $cc = 'yes'; } if ($custom_enclosure) { if (empty($EpisodeData['size'])) { $EpisodeData['size'] = 5242880; } // Use the dummy 5MB size since we don't have a size to quote echo "\t" . sprintf('<enclosure url="%s" length="%d" type="%s" />%s', trim($EpisodeData['url']), trim($EpisodeData['size']), trim($EpisodeData['type']), PHP_EOL); } $excerpt_no_html = ''; $content_no_html = ''; $content_no_html_a = ''; if (!$subtitle || !$summary) { $excerpt_no_html_a = strip_tags($post->post_excerpt, '<a>'); $excerpt_no_html = strip_tags($post->post_excerpt); } if (!$subtitle && !$excerpt_no_html || !$summary && !$powerpress_feed['enhance_itunes_summary'] && !$excerpt_no_html) { // Strip and format the wordpress way, but don't apply any other filters for these itunes tags $content_no_html = $post->post_content; $content_no_html = strip_shortcodes($content_no_html); $content_no_html = str_replace(']]>', ']]>', $content_no_html); $content_no_html_a = strip_tags($content_no_html, '<a>'); $content_no_html = strip_tags($content_no_html); } if ($subtitle) { echo "\t<itunes:subtitle>" . powerpress_format_itunes_value($subtitle, 'subtitle') . '</itunes:subtitle>' . PHP_EOL; } else { if ($excerpt_no_html) { echo "\t<itunes:subtitle>" . powerpress_format_itunes_value($excerpt_no_html, 'subtitle') . '</itunes:subtitle>' . PHP_EOL; } else { if ($content_no_html) { echo "\t<itunes:subtitle>" . powerpress_format_itunes_value($content_no_html, 'subtitle') . '</itunes:subtitle>' . PHP_EOL; } } } if (empty($powerpress_feed['feed_maximizer_on'])) { if ($summary) { echo "\t\t<itunes:summary>" . powerpress_format_itunes_value($summary, 'summary') . '</itunes:summary>' . PHP_EOL; } else { if ($powerpress_feed['enhance_itunes_summary']) { echo "\t\t<itunes:summary><![CDATA[" . powerpress_itunes_summary($post->post_content) . ']]></itunes:summary>' . PHP_EOL; } else { if ($excerpt_no_html) { // $content_no_html_a echo "\t\t<itunes:summary>" . powerpress_format_itunes_value($excerpt_no_html, 'summary') . '</itunes:summary>' . PHP_EOL; } else { echo "\t\t<itunes:summary>" . powerpress_format_itunes_value($content_no_html_a, 'summary') . '</itunes:summary>' . PHP_EOL; } } } if ($author) { echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>' . PHP_EOL; } else { echo "\t\t<itunes:author>" . 'NO AUTHOR</itunes:author>' . PHP_EOL; } // itunes episode image if (!empty($EpisodeData['itunes_image'])) { echo "\t\t" . '<itunes:image href="' . esc_html(str_replace(' ', '+', $EpisodeData['itunes_image']), 'double') . '" />' . PHP_EOL; } else { if (!empty($powerpress_feed['itunes_image'])) { echo "\t\t" . '<itunes:image href="' . esc_html(str_replace(' ', '+', $powerpress_feed['itunes_image']), 'double') . '" />' . PHP_EOL; } } } if ($explicit) { echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>' . PHP_EOL; } if ($EpisodeData['duration'] && preg_match('/^(\\d{1,2}:){0,2}\\d{1,2}$/i', ltrim($EpisodeData['duration'], '0:'))) { // Include duration if it is valid echo "\t\t<itunes:duration>" . ltrim($EpisodeData['duration'], '0:') . '</itunes:duration>' . PHP_EOL; } if ($block && $block == 'yes') { echo "\t\t<itunes:block>yes</itunes:block>" . PHP_EOL; } if ($cc && $cc == 'yes') { echo "\t\t<itunes:isClosedCaptioned>yes</itunes:isClosedCaptioned>" . PHP_EOL; } if (!empty($powerpress_feed['itunes_feature'])) { // Skip inserting the order tag } else { if (isset($EpisodeData['order']) && is_numeric($EpisodeData['order'])) { echo "\t\t<itunes:order>" . $EpisodeData['order'] . "</itunes:order>" . PHP_EOL; } } // RawVoice RSS Tags if (empty($powerpress_feed['feed_maximizer_on'])) { if (!defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false) { if (!empty($EpisodeData['ishd'])) { echo "\t\t<rawvoice:isHD>yes</rawvoice:isHD>" . PHP_EOL; } if (!empty($EpisodeData['image'])) { echo "\t\t<rawvoice:poster url=\"" . $EpisodeData['image'] . "\" />" . PHP_EOL; } if (!empty($EpisodeData['embed'])) { echo "\t\t<rawvoice:embed>" . htmlspecialchars($EpisodeData['embed']) . "</rawvoice:embed>" . PHP_EOL; } else { if (!empty($powerpress_feed['podcast_embed_in_feed']) && function_exists('powerpress_generate_embed')) { $player = powerpressplayer_embedable($EpisodeData['url'], $EpisodeData); $embed_content = ''; // TODO: if ($player) { $embed_content = powerpress_generate_embed($player, $EpisodeData); } if ($embed_content) { echo "\t\t<rawvoice:embed>" . htmlspecialchars($embed_content) . "</rawvoice:embed>" . PHP_EOL; } } } if (!empty($EpisodeData['webm_src'])) { echo "\t\t<rawvoice:webm src=\"" . $EpisodeData['webm_src'] . "\""; if ($EpisodeData['webm_length']) { echo " length=\"" . $EpisodeData['webm_length'] . "\""; } echo " type=\"video/webm\" />" . PHP_EOL; } $GeneralSettings = get_option('powerpress_general'); if (!empty($GeneralSettings) && !empty($GeneralSettings['metamarks'])) { require_once POWERPRESS_ABSPATH . '/powerpressadmin-metamarks.php'; powerpress_metamarks_print_rss2($EpisodeData); } } } }