Example #1
0
function powerpress_do_pinw($pinw, $process_podpress)
{
    if (!WP_DEBUG && defined('POWERPRESS_FIX_WARNINGS')) {
        @error_reporting(E_ALL | E_CORE_ERROR | E_COMPILE_ERROR | E_PARSE);
    }
    list($post_id, $feed_slug) = explode('-', $pinw, 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);
    }
    $GeneralSettings = get_option('powerpress_general');
    echo '<!DOCTYPE html>';
    // HTML5!
    ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php 
    echo __('Blubrry PowerPress Player', 'powerpress');
    ?>
</title>
	<meta name="robots" content="noindex" />
<?php 
    if (defined('POWERPRESS_JS_DEBUG')) {
        wp_enqueue_script('powerpress-player', powerpress_get_root_url() . 'player.js');
    } else {
        wp_enqueue_script('powerpress-player', powerpress_get_root_url() . 'player.min.js');
    }
    if (version_compare($GLOBALS['wp_version'], '3.6-alpha', '>')) {
        $include_mejs = false;
        if (empty($GeneralSettings['player']) || empty($GeneralSettings['video_player'])) {
            $include_mejs = true;
        } else {
            if (!empty($GeneralSettings['player']) && ($GeneralSettings['player'] == 'mediaelement-audio' || $GeneralSettings['video_player'] == 'mediaelement-video')) {
                $include_mejs = true;
            }
        }
        if ($include_mejs) {
            wp_enqueue_style('mediaelement');
            wp_enqueue_style('wp-mediaelement');
            wp_enqueue_script('mediaelement');
            if (defined('POWERPRESS_JS_DEBUG')) {
                wp_enqueue_script('powerpress-mejs', powerpress_get_root_url() . 'powerpress-mejs.js');
            } else {
                wp_enqueue_script('powerpress-mejs', powerpress_get_root_url() . 'powerpress-mejs.min.js');
            }
        }
    }
    wp_print_styles();
    wp_print_scripts();
    //wp_head();
    ?>
<style type="text/css">
body { font-size: 13px; font-family: Arial, Helvetica, sans-serif; /* width: 100%; min-height: 100%; } html { height: 100%; */ }
</style>
</head>
<body>
<div style="margin: 5px;">
<?php 
    if (!$EpisodeData) {
        echo '<p>' . __('Unable to retrieve media information.', 'powerpress') . '</p>';
    } else {
        if (!empty($GeneralSettings['premium_caps']) && !powerpress_premium_content_authorized($feed_slug)) {
            echo powerpress_premium_content_message($post_id, $feed_slug, $EpisodeData);
        } else {
            if (!empty($EpisodeData['embed'])) {
                echo $EpisodeData['embed'];
            } else {
                echo apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('feed' => $feed_slug, 'autoplay' => true, 'type' => $EpisodeData['type']));
            }
        }
    }
    ?>
</div>
</body>
</html>
<?php 
    exit;
}
Example #2
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;
}