function powerpressplayer_build_videojs($media_url, $EpisodeData = array()) { $content = ''; if (function_exists('add_videojs_header')) { // Global Settings $Settings = get_option('powerpress_general'); $player_id = powerpressplayer_get_next_id(); $cover_image = ''; $player_width = 400; $player_height = 225; $autoplay = false; if (!empty($Settings['player_width'])) { $player_width = $Settings['player_width']; } if (!empty($Settings['player_height'])) { $player_height = $Settings['player_height']; } if (!empty($Settings['poster_image'])) { $cover_image = $Settings['poster_image']; } // Episode Settings if (!empty($EpisodeData['image'])) { $cover_image = $EpisodeData['image']; } if (!empty($EpisodeData['width'])) { $player_width = $EpisodeData['width']; } if (!empty($EpisodeData['height'])) { $player_height = $EpisodeData['height']; } if (!empty($EpisodeData['autoplay'])) { $autoplay = true; } // Poster image supplied $poster_attribute = ''; if ($cover_image) { $poster_attribute = ' poster="' . $cover_image . '"'; } // Autoplay the video? $autoplay_attribute = ''; if ($autoplay) { $autoplay_attribute = ' autoplay'; } // We never do pre-poading for podcasting as it inflates statistics // Is there a custom class? $class = ''; if (!empty($Settings['videojs_css_class'])) { $class = ' ' . $Settings['videojs_css_class']; } $content .= '<div class="powerpress_player" id="powerpress_player_' . $player_id . '">'; $content .= '<video id="videojs_player_' . $player_id . '" class="video-js vjs-default-skin' . $class . '" width="' . $player_width . '" height="' . $player_height . '"' . $poster_attribute . ' controls ' . $autoplay_attribute . ' data-setup="{}">'; $content_type = powerpress_get_contenttype($media_url); if ($content_type == 'video/x-m4v') { $content_type = 'video/mp4'; } // Mp4 $content .= '<source src="' . $media_url . '" type="' . $content_type . '" />'; if (!empty($EpisodeData['webm_src'])) { $EpisodeData['webm_src'] = powerpress_add_flag_to_redirect_url($EpisodeData['webm_src'], 'p'); $content .= '<source src="' . $EpisodeData['webm_src'] . '" type="video/webm; codecs="vp8, vorbis" />'; } $content .= '</video>'; $content .= "</div>\n"; } else { $content .= powerpressplayer_build_html5video($media_url, $EpisodeData); } return $content; }
function powerpressadmin_mt_do_import() { $wp_remote_options = array(); $wp_remote_options['user-agent'] = 'Blubrry PowerPress/' . POWERPRESS_VERSION; $wp_remote_options['httpversion'] = '1.1'; $Import = isset($_POST['Import']) ? $_POST['Import'] : array(); $Media = isset($_POST['Media']) ? $_POST['Media'] : array(); $Titles = isset($_POST['Titles']) ? $_POST['Titles'] : array(); set_time_limit(60 + 10 * count($Import)); $DetectDuration = !empty($_POST['DetectDuration']) ? $_POST['DetectDuration'] : 0; if ($DetectDuration) { require_once POWERPRESS_ABSPATH . '/mp3info.class.php'; $Mp3Info = new Mp3Info(); if (defined('POWERPRESS_DOWNLOAD_BYTE_LIMIT')) { $Mp3Info->SetDownloadBytesLimit(POWERPRESS_DOWNLOAD_BYTE_LIMIT); } } while (list($post_id, $episode_feeds) = each($Import)) { while (list($media_index, $feed_slug) = each($episode_feeds)) { if ($feed_slug == '') { continue; } // User decoded not to import this one.. $url = $Media[$post_id][$media_index]; //$headers = wp_remote_head($url, array('httpversion' => 1.1)); //$response = wp_remote_request($url, $options); $response = wp_remote_head($url, array('httpversion' => 1.1)); // Redirect 1 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 2 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 3 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 4 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } $headers = wp_remote_retrieve_headers($response); if (is_wp_error($response)) { powerpressadmin_mt_import_log($Titles[$post_id], $url, $feed_slug, 'A system error occurred.'); } else { if ($headers && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $EpisodeData = array(); $EpisodeData['url'] = $url; if ($headers['content-length']) { $EpisodeData['size'] = (int) $headers['content-length']; } else { $EpisodeData['size'] = 0; } $EpisodeData['type'] = powerpress_get_contenttype($EpisodeData['url']); $EpisodeData['duration'] = false; if ($EpisodeData['type'] == 'audio/mpeg' && $DetectDuration) { $Mp3Data = $Mp3Info->GetMp3Info($EpisodeData['url']); if ($Mp3Data) { $Duration = $Mp3Data['playtime_string']; $EpisodeData['duration'] = powerpress_readable_duration($Duration, true); // Fix so it looks better when viewed for editing } } $EnclosureData = $EpisodeData['url'] . "\n" . $EpisodeData['size'] . "\n" . $EpisodeData['type']; if ($EpisodeData['duration']) { $EnclosureData .= "\n" . serialize(array('duration' => $EpisodeData['duration'])); } // Save it here... if ($feed_slug == 'podcast') { add_post_meta($post_id, 'enclosure', $EnclosureData, true); } else { add_post_meta($post_id, '_' . $feed_slug . ':enclosure', $EnclosureData, true); } powerpressadmin_mt_import_log($Titles[$post_id], $EpisodeData['url'], $feed_slug); } else { powerpressadmin_mt_import_log($Titles[$post_id], $url, $feed_slug, __('HTTP return code', 'powerpress') . ' ' . $response['response']['code'] . '.'); } } } } }
function powerpress_get_media_info_local($media_file, $content_type = '', $file_size = 0, $duration = '', $return_warnings = false) { $error_msg = ''; $warning_msg = ''; if ($content_type == '') { $content_type = powerpress_get_contenttype($media_file); } if (isset($GLOBALS['objWPOSFLV']) && is_object($GLOBALS['objWPOSFLV'])) { return array('error' => __('The WP OS FLV plugin is not compatible with Blubrry PowerPress.', 'powerpress')); } $get_duration_info = ($content_type == 'audio/mpeg' || $content_type == 'audio/x-m4a' || $content_type == 'video/x-m4v' || $content_type == 'video/mp4' || $content_type == 'audio/ogg') && $duration === ''; // Lets use the mp3info class: require_once POWERPRESS_ABSPATH . '/mp3info.class.php'; $Mp3Info = new Mp3Info(); if ($get_duration_info) { if (preg_match('/video/i', $content_type)) { if (defined('POWERPRESS_DOWNLOAD_BYTE_LIMIT_VIDEO')) { $Mp3Info->SetDownloadBytesLimit(POWERPRESS_DOWNLOAD_BYTE_LIMIT_VIDEO); } } else { if (defined('POWERPRESS_DOWNLOAD_BYTE_LIMIT')) { $Mp3Info->SetDownloadBytesLimit(POWERPRESS_DOWNLOAD_BYTE_LIMIT); } } } $Mp3Data = $Mp3Info->GetMp3Info($media_file, !$get_duration_info); if ($Mp3Data) { if ($Mp3Info->GetRedirectCount() > 5) { // Add a warning that the redirect count exceeded 5, which may prevent some podcatchers from downloading the media. $warning = sprintf(__('Warning, the Media URL %s contains %d redirects.', 'powerpress'), $media_file, $Mp3Info->GetRedirectCount()); $warning .= ' [<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/warning-messages-explained/" title="' . __('PowerPress Warnings Explained', 'powerpress') . '" target="_blank">' . __('PowerPress Warnings Explained') . '</a>]'; if ($return_warnings) { $warning_msg .= $warning; } else { powerpress_add_error($warning); } } if ($file_size == 0) { $file_size = $Mp3Info->GetContentLength(); } if ($get_duration_info) { $playtime_string = !empty($Mp3Data['playtime_string']) ? $Mp3Data['playtime_string'] : ''; $duration = powerpress_readable_duration($playtime_string, true); // Fix so it looks better when viewed for editing } $GeneralSettings = get_option('powerpress_general'); if (empty($GeneralSettings['hide_warnings']) && count($Mp3Info->GetWarnings()) > 0) { $Warnings = $Mp3Info->GetWarnings(); while (list($null, $warning) = each($Warnings)) { $warning = sprintf(__('Warning, Media URL %s', 'powerpress'), $media_file) . ': ' . $warning . ' [<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/warning-messages-explained/" target="_blank">' . __('PowerPress Warnings Explained', 'powerpress') . '</a>]'; if ($return_warnings) { $warning_msg .= $warning; } else { powerpress_add_error($warning); } } } } else { if ($Mp3Info->GetError() != '') { return array('error' => $Mp3Info->GetError()); } else { return array('error' => __('Error occurred obtaining media information.', 'powerpress')); } } if ($file_size == 0) { return array('error' => __('Error occurred obtaining media file size.', 'powerpress')); } if ($return_warnings && $warning_msg != '') { return array('content-type' => $content_type, 'length' => $file_size, 'duration' => $duration, 'warnings' => $warning_msg); } return array('content-type' => $content_type, 'length' => $file_size, 'duration' => $duration); // OLD CODE FOLLOWS: if ($content_type == 'audio/mpeg' && $duration === '') { // Lets use the mp3info class: require_once POWERPRESS_ABSPATH . '/mp3info.class.php'; $Mp3Info = new Mp3Info(); if (defined('POWERPRESS_DOWNLOAD_BYTE_LIMIT')) { $Mp3Info->SetDownloadBytesLimit(POWERPRESS_DOWNLOAD_BYTE_LIMIT); } $Mp3Data = $Mp3Info->GetMp3Info($media_file); if ($Mp3Data) { if ($Mp3Info->GetRedirectCount() > 5) { // Add a warning that the redirect count exceeded 5, which may prevent some podcatchers from downloading the media. powerpress_add_error(sprintf(__('Warning, the Media URL %s contains %d redirects.', 'powerpress'), $media_file, $Mp3Info->GetRedirectCount()) . ' [<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/warning-messages-explained/" target="_blank">' . __('PowerPress Warnings Explained', 'powerpress') . '</a>]'); } if ($file_size == 0) { $file_size = $Mp3Info->GetContentLength(); } $playtime_string = !empty($Mp3Data['playtime_string']) ? $Mp3Data['playtime_string'] : ''; $duration = powerpress_readable_duration($playtime_string, true); // Fix so it looks better when viewed for editing if (count($Mp3Info->GetWarnings()) > 0) { $Warnings = $Mp3Info->GetWarnings(); while (list($null, $warning) = each($Warnings)) { powerpress_add_error(sprintf(__('Warning, Media URL %s', 'powerpress'), $media_file) . ': ' . $warning . ' [<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/warning-messages-explained/" target="_blank">' . __('PowerPress Warnings Explained', 'powerpress') . '</a>]'); } } } else { if ($Mp3Info->GetError()) { return array('error' => $Mp3Info->GetError()); } else { return array('error' => __('Error occurred obtaining media information.', 'powerpress')); } } } $wp_remote_options = array(); $wp_remote_options['user-agent'] = 'Blubrry PowerPress/' . POWERPRESS_VERSION; $wp_remote_options['httpversion'] = '1.1'; if ($content_type != '' && $file_size == 0) { $response = wp_remote_head($media_file, array('httpversion' => 1.1)); // Redirect 1 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 2 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 3 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } // Redirect 4 if (!is_wp_error($response) && ($response['response']['code'] == 301 || $response['response']['code'] == 302)) { $headers = wp_remote_retrieve_headers($response); $response = wp_remote_head($headers['location'], $wp_remote_options); } if (is_wp_error($response)) { return array('error' => $response->get_error_message()); } if (isset($response['response']['code']) && $response['response']['code'] < 200 || $response['response']['code'] > 290) { return array('error' => __('Error, HTTP', 'powerpress') . ' ' . $response['response']['code']); } $headers = wp_remote_retrieve_headers($response); if ($headers && $headers['content-length']) { $file_size = (int) $headers['content-length']; } else { return array('error' => __('Unable to obtain file size of media file.', 'powerpress')); } } if ($file_size == 0) { return array('error' => __('Error occurred obtaining media file size.', 'powerpress')); } return array('content-type' => $content_type, 'length' => $file_size, 'duration' => $duration); }
function powerpress_get_enclosure_data_podpress($post_id, $mediaNum = 0, $include_premium = false) { $podPressMedia = powerpress_get_post_meta($post_id, 'podPressMedia'); if (!$podPressMedia) { $podPressMedia = powerpress_get_post_meta($post_id, '_podPressMedia'); } // handles latest verions of PodPress if ($podPressMedia) { if (!is_array($podPressMedia)) { // Sometimes the stored data gets messed up, we can fix it here: $podPressMedia = powerpress_repair_serialize($podPressMedia); $podPressMedia = @unserialize($podPressMedia); } // Do it a second time in case it is double serialized if (!is_array($podPressMedia)) { // Sometimes the stored data gets messed up, we can fix it here: $podPressMedia = powerpress_repair_serialize($podPressMedia); $podPressMedia = @unserialize($podPressMedia); } if (is_array($podPressMedia) && isset($podPressMedia[$mediaNum]) && isset($podPressMedia[$mediaNum]['URI'])) { if ($include_premium == false && isset($podPressMedia[$mediaNum]['premium_only']) && ($podPressMedia[$mediaNum]['premium_only'] == 'on' || $podPressMedia[$mediaNum]['premium_only'] == true)) { return false; } $Data = array(); $Data['id'] = $post_id; $Data['feed'] = 'podcast'; $Data['duration'] = 0; $Data['url'] = ''; $Data['size'] = 0; $Data['type'] = ''; $Data['width'] = ''; $Data['height'] = ''; $Data['url'] = $podPressMedia[$mediaNum]['URI']; if (isset($podPressMedia[$mediaNum]['size'])) { $Data['size'] = $podPressMedia[$mediaNum]['size']; } if (isset($PodPressSettings[$mediaNum]['duration'])) { $Data['duration'] = $podPressMedia[$mediaNum]['duration']; } if (isset($PodPressSettings[$mediaNum]['previewImage'])) { $Data['image'] = $podPressMedia[$mediaNum]['previewImage']; } if (strpos($Data['url'], 'http://') !== 0 && strpos($Data['url'], 'https://') !== 0) { $PodPressSettings = get_option('podPress_config'); if ($PodPressSettings && isset($PodPressSettings['mediaWebPath'])) { $Data['url'] = rtrim($PodpressSettings['mediaWebPath'], '/') . '/' . ltrim($Data['url'], '/'); } unset($PodPressSettings); } if (strpos($Data['url'], 'http://') !== 0 && strpos($Data['url'], 'https://') !== 0) { $Settings = get_option('powerpress_general'); if ($Settings && isset($Settings['default_url'])) { $Data['url'] = rtrim($Settings['default_url'], '/') . '/' . ltrim($Data['url'], '/'); } } if (strpos($Data['url'], 'http://') !== 0 && strpos($Data['url'], 'https://') !== 0) { return false; } $Data['type'] = powerpress_get_contenttype($Data['url']); // Detect the content type $Data['url'] = powerpress_add_redirect_url($Data['url'], $Data['feed']); // Add redirects to Media URL return $Data; } } return false; }
function powerpress_get_podpress_episodes($hide_errors = true) { global $wpdb; $PodpressSettings = get_option('podPress_config'); if (empty($PodpressSettings)) { $PodpressSettings = array(); $PodpressSettings['mediaWebPath'] = ''; $powerpress_settings = get_option('powerpress_general'); if (!empty($powerpress_settings['default_url'])) { $PodpressSettings['mediaWebPath'] = $powerpress_settings['default_url']; powerpress_page_message_add_notice(sprintf(__('Unable to detect PodPress media URL setting. Using the PowerPress setting "Default Media URL" (%s) instead.', 'powerpress'), esc_attr($PodpressSettings['mediaWebPath']))); } else { // We need to print a warning that they need to configure their podPress settings as the settings are no longer found in the database. powerpress_page_message_add_error(__('Unable to detect PodPress media URL setting. Please set the "Default Media URL" setting in PowerPress to properly import podcast episodes.', 'powerpress')); } } $media_url = $PodpressSettings['mediaWebPath']; if (substr($media_url, 0, -1) != '/') { $media_url .= '/'; } // Make sure the URL has a trailing slash $return = array(); $return['feeds_required'] = 0; $query = "SELECT p.ID, p.post_title, p.post_date, pm.meta_value "; $query .= "FROM {$wpdb->posts} AS p "; $query .= "INNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id "; $query .= "WHERE (pm.meta_key = 'podPressMedia' OR pm.meta_key = '_podPressMedia') "; $query .= "AND p.post_type != 'revision' "; $query .= "GROUP BY p.ID "; $query .= "ORDER BY p.post_date DESC "; $results_data = $wpdb->get_results($query, ARRAY_A); if ($results_data) { while (list($null, $row) = each($results_data)) { //$return = $row; $podpress_data = @unserialize($row['meta_value']); if (!$podpress_data) { $podpress_data_serialized = powerpress_repair_serialize($row['meta_value']); $podpress_data = @unserialize($podpress_data_serialized); if (!is_array($podpress_data) && is_string($podpress_data)) { $podpress_data_two = @unserialize($podpress_data); if (!is_array($podpress_data_two)) { $podpress_data_serialized = powerpress_repair_serialize($podpress_data); $podpress_data_two = @unserialize($podPressMedia); } if (is_array($podpress_data_two)) { $podpress_data = $podpress_data_two; } } } else { if (is_string($podpress_data)) { // May have been double serialized... $podpress_unserialized = @unserialize($podpress_data); if (!$podpress_unserialized) { $podpress_data_serialized = powerpress_repair_serialize($podpress_data); $podpress_unserialized = @unserialize($podpress_data_serialized); } $podpress_data = $podpress_unserialized; } } if ($podpress_data) { if (!is_array($podpress_data)) { // display a warning here... if ($hide_errors == false) { powerpress_page_message_add_error(sprintf(__('Error decoding PodPress data for post "%s"', 'powerpress'), est_attr($row['post_title']))); } continue; } $clean_data = array(); while (list($episode_index, $episode_data) = each($podpress_data)) { if (trim($episode_data['URI']) != '') { $MediaURL = $episode_data['URI']; if (strtolower(substr($MediaURL, 0, 4)) != 'http') { $MediaURL = $media_url . rtrim($episode_data['URI'], '/'); } if (!powerpress_only_include_ext($MediaURL)) { // Skip this media type continue; } $clean_data[$episode_index] = array(); $clean_data[$episode_index]['url'] = $MediaURL; $clean_data[$episode_index]['size'] = $episode_data['size']; if (trim($episode_data['duration']) && $episode_data['duration'] != 'UNKNOWN') { $clean_data[$episode_index]['duration'] = powerpress_readable_duration($episode_data['duration'], true); } $ContentType = powerpress_get_contenttype($episode_data['URI']); if ($ContentType) { $clean_data[$episode_index]['type'] = trim($ContentType); } if (!empty($episode_data['previewImage'])) { $clean_data[$episode_index]['image'] = $episode_data['previewImage']; } } } if (count($clean_data) == 0) { continue; } // Go to the next record... if ($return['feeds_required'] < count($clean_data)) { $return['feeds_required'] = count($clean_data); } $return[$row['ID']] = array(); $return[$row['ID']]['podpress_data'] = $clean_data; $return[$row['ID']]['post_title'] = $row['post_title']; $return[$row['ID']]['post_date'] = $row['post_date']; // Check that there is no other enclosure... $enclosure_data = get_post_meta($row['ID'], 'enclosure', true); if ($enclosure_data) { $Included = false; list($EnclosureURL, $null) = explode("\n", $enclosure_data); $return[$row['ID']]['enclosure'] = $enclosure_data; while (list($episode_index_temp, $episode_data_temp) = each($clean_data)) { if (trim($EnclosureURL) == trim($episode_data_temp['url'])) { $Included = true; break; // We found the media already. } else { if (trim($episode_data_temp['url']) == '') { unset($clean_data[$episode_index_temp]); // Empty URL, lets remove it so we don't accidently use it } } } reset($clean_data); if ($Included == false && $return['feeds_required'] < count($clean_data) + 1) { $return['feeds_required'] = count($clean_data) + 1; // We can't remove this enclosure } } // Check for additional itunes data in the database.. if (false) { $itunes_data = get_post_meta($row['ID'], 'podPressPostSpecific', true); if ($itunes_data && is_array($itunes_data)) { $return[$row['ID']]['itunes'] = array(); // Add iTunes stuff... if ($itunes_data['itunes:subtitle'] != '##PostExcerpt##' && $itunes_data['itunes:subtitle'] != '') { $return[$row['ID']]['itunes']['subtitle'] = $itunes_data['itunes:subtitle']; } if ($itunes_data['itunes:summary'] != '##PostExcerpt##' && $itunes_data['itunes:summary'] != '##Global##' && $itunes_data['itunes:summary'] != '') { $return[$row['ID']]['itunes']['summary'] = $itunes_data['itunes:summary']; } if ($itunes_data['itunes:author'] != '##Global##' && $itunes_data['itunes:author'] != '') { $return[$row['ID']]['itunes']['author'] = $itunes_data['itunes:author']; } if (strtolower($itunes_data['itunes:explicit']) == 'yes') { $return[$row['ID']]['itunes']['explicit'] = 'yes'; } if (strtolower($itunes_data['itunes:block']) == 'yes') { $return[$row['ID']]['itunes']['block'] = 'yes'; } if (count($return[$row['ID']]['itunes']) == 0) { unset($return[$row['ID']]['itunes']); } } } } } } return $return; }
function _parse_enclosure($string, $post) { global $wpdb; $p = xml_parser_create(); xml_parse_into_struct($p, $string, $vals, $index); xml_parser_free($p); if (!empty($vals[0]['attributes']['URL'])) { $enclosure = array('url' => trim($vals[0]['attributes']['URL']), 'length' => 1, 'type' => ''); if (!empty($vals[0]['attributes']['LENGTH'])) { $enclosure['length'] = trim($vals[0]['attributes']['LENGTH']); } if (!empty($vals[0]['attributes']['TYPE'])) { $enclosure['type'] = trim($vals[0]['attributes']['TYPE']); } if (empty($enclosure['type'])) { $enclosure['type'] = powerpress_get_contenttype($enclosure['url']); } $matches = array(); if (preg_match('|<itunes:duration>(.*?)</itunes:duration>|is', $post, $matches)) { $enclosure['duration'] = $this->_sanatize_tag_value($matches[1]); } // keywords No longer supported by iTunes: if (preg_match('|<itunes:keywords>(.*?)</itunes:keywords>|is', $post, $matches)) { $enclosure['keywords'] = $this->_sanatize_tag_value($matches[1]); } if (preg_match('|<itunes:summary>(.*?)</itunes:summary>|is', $post, $matches)) { $enclosure['summary'] = $this->_sanatize_tag_value($matches[1]); } if (preg_match('|<itunes:subtitle>(.*?)</itunes:subtitle>|is', $post, $matches)) { $enclosure['subtitle'] = $this->_sanatize_tag_value($matches[1]); } if (preg_match('|<itunes:author>(.*?)</itunes:author>|is', $post, $matches)) { $enclosure['author'] = $this->_sanatize_tag_value($matches[1]); } if (preg_match('|<itunes:block>(.*?)</itunes:block>|is', $post, $matches)) { $value = strtolower(trim($matches[1])); if ($value == 'yes') { $enclosure['block'] = 1; } } // <itunes:image href="http://example.com/podcasts/everything/AllAboutEverything.jpg" /> if (preg_match('/<itunes:image[^h]*href="(.*?)".*(\\/>|>.*<\\/itunes:image>)/is', $post, $matches)) { $enclosure['itunes_image'] = html_entity_decode(trim($matches[1])); } if (preg_match('|<itunes:isClosedCaptioned>(.*?)</itunes:isClosedCaptioned>|is', $post, $matches)) { $value = strtolower(trim($matches[1])); if ($value == 'yes') { $enclosure['cc'] = 1; } } if (preg_match('|<itunes:order>(.*?)</itunes:order>|is', $post, $matches)) { $value = trim($matches[1]); if (!empty($value)) { $enclosure['order'] = intval($value); } } if (preg_match('|<itunes:explicit>(.*?)</itunes:explicit>|is', $post, $matches)) { $explicit_array = array('yes' => 1, 'clean' => 2); // No need to save 'no' $value = strtolower(trim($matches[1])); if (!empty($explicit_array[$value])) { $enclosure['explicit'] = $explicit_array[$value]; } } return $enclosure; } return ''; }