public function on_shoutem_post_start($params)
 {
     $attachments =& $params['attachments_ref'];
     $post = $params['wp_post'];
     //Powerpress support
     if (function_exists('powerpress_get_enclosure')) {
         $audio_meta = powerpress_get_enclosure_data($post->ID);
         if ($audio_meta) {
             $audio_meta = array($audio_meta);
         } else {
             $audio_meta = array();
         }
         $podpress_meta = powerpress_get_enclosure_data_podpress($post->ID);
         if ($podpress_meta && is_array($podpress_meta)) {
             //$podpress_meta['url'] = urlencode($podpress_meta['url']);
             $audio_meta = array_merge($audio_meta, array($podpress_meta));
         }
         foreach ($audio_meta as $audio) {
             $url = $audio['url'];
             $audio_record = array('id' => '', 'src' => $url, 'type' => 'audio', 'duration' => '');
             $attachments['audio'][] = $audio_record;
         }
     }
     return '';
 }
Ejemplo n.º 2
0
function powerpress_do_embed($player, $embed, $process_podpress)
{
    list($post_id, $feed_slug) = explode('-', $embed, 2);
    $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
    if ($EpisodeData == false && $process_podpress && $feed_slug == 'podcast') {
        $EpisodeData = powerpress_get_enclosure_data_podpress($post_id);
    }
    // Embeds are only available for the following players
    do_powerpressplayer_embed($player, $EpisodeData['url'], $EpisodeData);
    exit;
}
Ejemplo n.º 3
0
function get_the_powerpress_all_players($slug = false, $no_link = false)
{
    $return = '';
    //Use this function to insert the Powerpress player anywhere in the page.
    //Made by Nicolas Bouliane (http://nicolasbouliane.com/)
    /*We're going to use the Loop to retrieve the latest post with the 'enclosure' custom key set
    	//then interpret it and manually launch powerpressplayer_build with the URL contained within
    	//that data.*/
    //Let's reset the Loop to make sure we look through all posts
    rewind_posts();
    // Get the list of podcast channel slug names...
    $GeneralSettings = get_option('powerpress_general');
    // No player or links to add to content...
    if (!empty($GeneralSettings['disable_appearance'])) {
        return $return;
    }
    $ChannelSlugs = array('podcast');
    if ($slug == false) {
        if (isset($GeneralSettings['custom_feeds']['podcast'])) {
            $ChannelSlugs = array();
        }
        // Reset the array so it is added from the list in specified order
        while (list($feed_slug, $null) = each($GeneralSettings['custom_feeds'])) {
            $ChannelSlugs[] = $feed_slug;
        }
    } else {
        if (is_array($slug)) {
            $ChannelSlugs = $slug;
        } else {
            $ChannelSlugs = array($slug);
        }
    }
    // Loop through the posts
    while (have_posts()) {
        the_post();
        while (list($null, $feed_slug) = each($ChannelSlugs)) {
            // Do we follow the global settings to disable a player?
            if (isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) && $slug == false) {
                continue;
            }
            $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
            if (!$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast') {
                $EpisodeData = powerpress_get_enclosure_data_podpress(get_the_ID());
            }
            if (!$EpisodeData) {
                continue;
            }
            $AddDefaultPlayer = true;
            if (!empty($EpisodeData['embed'])) {
                $return .= $EpisodeData['embed'];
                if (!empty($GeneralSettings['embed_replace_player'])) {
                    $AddDefaultPlayer = false;
                }
            }
            if (isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug)) {
                $return .= powerpress_premium_content_message(get_the_ID(), $feed_slug, $EpisodeData);
                continue;
            }
            if (!isset($EpisodeData['no_player']) && $AddDefaultPlayer) {
                $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
            }
            if (!isset($EpisodeData['no_links']) && $no_link == false) {
                $return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
                $return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
            }
        }
        reset($ChannelSlugs);
    }
    return $return;
}