Esempio n. 1
0
function powerpress_get_program_title_by_taxonomy($term_id, $taxonomy = 'category')
{
    $General = get_option('powerpress_general');
    // Efficiently get the taxonomy program titles from WordPress
    if (!isset($GLOBALS['powerpress'][$taxonomy])) {
        $GLOBALS['powerpress'][$taxonomy] = array();
        // SELECT all the caegory podcasting / taxonomy podasting feeds...
        if ($taxonomy == 'category' && isset($General['custom_cat_feeds'])) {
            $Feeds = $General['custom_cat_feeds'];
            // Walk through the categories...
            while (list($null, $cat_id) = each($Feeds)) {
                $FeedSettings = get_option('powerpress_cat_feed_' . $cat_id);
                if (!empty($FeedSettings['title'])) {
                    $GLOBALS['powerpress'][$taxonomy][$cat_id] = $FeedSettings['title'];
                }
            }
        } else {
            $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
            if (!empty($PowerPressTaxonomies)) {
                $query_in = '';
                while (list($tt_id, $null) = each($PowerPressTaxonomies)) {
                    if (!empty($query_in)) {
                        $query_in .= ',';
                    }
                    $query_in .= $tt_id;
                }
                if (!empty($query_in)) {
                    $terms = $wpdb->get_results("SELECT term_taxonomy_id, term_id, taxonomy FROM {$wpdb->term_taxonomy} WHERE term_taxonomy_id IN ({$query_in})", ARRAY_A);
                    while (list($index, $term_info) = each($terms)) {
                        // TODO: We need to get term by the term_id and taxonomy
                        $FeedSettings = powerpress_get_settings('powerpress_taxonomy_' . $term_info['term_taxonomy_id']);
                        if (!empty($FeedSettings['title'])) {
                            $GLOBALS['powerpress'][$term_info['taxonomy']][$term_info['term_id']] = $FeedSettings['title'];
                        }
                    }
                }
            }
        }
    }
    if (!empty($GLOBALS['powerpress'][$taxonomy][$term_id])) {
        return $GLOBALS['powerpress'][$taxonomy][$term_id];
    }
    if (!empty($General['program_title'])) {
        return $General['program_title'];
    }
    // Get the default podcast title
    return '';
    // REturn the blog title last resort
}
function powerpress_strip_redirect_urls($url)
{
    $Settings = powerpress_get_settings('powerpress_general');
    for ($x = 1; $x <= 3; $x++) {
        $field = sprintf('redirect%d', $x);
        if (!empty($Settings[$field])) {
            $redirect_no_http = str_replace('http://', '', $Settings[$field]);
            if (substr($redirect_no_http, -1, 1) != '/') {
                $redirect_no_http .= '/';
            }
            $url = str_replace($redirect_no_http, '', $url);
        }
    }
    return $url;
}
function powerpress_admin_posttypefeeds()
{
    $General = powerpress_get_settings('powerpress_general');
    $post_types = powerpress_admin_get_post_types(false);
    ?>
<h2><?php 
    echo __('Post Type Podcasting', 'powerpress');
    ?>
</h2>
<p>
	<?php 
    echo __('Post Type Podcasting adds custom podcast settings to specific Post Type feeds.', 'powerpress');
    ?>
</p>
<style type="text/css">
.column-url {
	width: 40%;
}
.column-name {
	width: 30%;
}
.column-feed-slug {
	width: 15%;
}
.column-post-type {
	width: 15%;
}
.column-episode-count {
	width: 15%;
}
.category-list {
	width: 100%;
}
.form-field select {
	width: 95%;
}
</style>
<div id="col-container">

<div id="col-right">
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('powerpressadmin_posttypefeeds');
    ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
    print_column_headers('powerpressadmin_posttypefeeds', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $count = 0;
    while (list($null, $post_type) = each($post_types)) {
        $PostTypeSettingsArray = get_option('powerpress_posttype_' . $post_type);
        if (!$PostTypeSettingsArray) {
            continue;
        }
        while (list($feed_slug, $PostTypeSettings) = each($PostTypeSettingsArray)) {
            $feed_title = !empty($PostTypeSettings['title']) ? $PostTypeSettings['title'] : '(blank)';
            // $post_type
            // $feed_slug
            //global $wpdb;
            //	var_dump($term_info);
            //$category = get_category_to_edit($cat_ID);
            $columns = powerpress_admin_posttypefeeds_columns();
            $hidden = array();
            if ($count % 2 == 0) {
                echo '<tr valign="middle" class="alternate">';
            } else {
                echo '<tr valign="middle">';
            }
            $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_posttypefeeds.php&amp;action=powerpress-editposttypefeed&amp;feed_slug=' . $feed_slug . '&podcast_post_type=' . $post_type);
            $url = get_post_type_archive_feed_link($post_type, $feed_slug);
            $short_url = str_replace('http://', '', $url);
            $short_url = str_replace('www.', '', $short_url);
            if (strlen($short_url) > 35) {
                $short_url = substr($short_url, 0, 32) . '...';
            }
            foreach ($columns as $column_name => $column_display_name) {
                $class = "class=\"column-{$column_name}\"";
                switch ($column_name) {
                    case 'feed-slug':
                        echo "<td {$class}>{$feed_slug}";
                        echo "</td>";
                        break;
                    case 'name':
                        echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . $feed_title . '</a></strong><br />';
                        $actions = array();
                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>';
                        $actions['remove'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_posttypefeeds.php&amp;action=powerpress-delete-posttype-feed&amp;podcast_post_type={$post_type}&amp;feed_slug={$feed_slug}", 'powerpress-delete-posttype-feed-' . $post_type . '_' . $feed_slug) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for Post Type '%s'\n  'Cancel' to stop, 'OK' to delete.", 'powerpress'), $feed_title)) . "') ) { return true;}return false;\">" . __('Remove', 'powerpress') . "</a>";
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        foreach ($actions as $action => $linkaction) {
                            ++$i;
                            $i == $action_count ? $sep = '' : ($sep = ' | ');
                            echo '<span class="' . $action . '">' . $linkaction . $sep . '</span>';
                        }
                        echo '</div>';
                        echo '</td>';
                        break;
                    case 'url':
                        echo "<td {$class}><a href='{$url}' title='" . esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title)) . "' target=\"_blank\">{$short_url}</a>";
                        echo '<div class="row-actions">';
                        echo '<span class="' . $action . '"><a href="http://www.feedvalidator.org/check.cgi?url=' . urlencode(str_replace('&amp;', '&', $url)) . '" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
                        echo '</div>';
                        echo "</td>";
                        break;
                    case 'episode-count':
                        echo "<td {$class}>{$episode_total}";
                        echo "</td>";
                        break;
                    case 'post-type':
                        echo "<td {$class}>{$post_type}";
                        echo "</td>";
                        break;
                    default:
                        break;
                }
            }
            echo "\n    </tr>\n";
            $count++;
        }
    }
    ?>
	</tbody>
</table>
</div> <!-- col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
    echo __('Add Podcasting to a custom Post Type', 'powerpress');
    ?>
</h3>
<input type="hidden" name="action" value="powerpress-addposttypefeed" />


<div class="form-field form-required">
<label  for="powerpress_post_type_select"><?php 
    echo __('Post Type', 'powerpress');
    ?>
</label>
<select id="powerpress_post_type_select" name="podcast_post_type" style="width: 95%;">
	<option value=""><?php 
    echo __('Select Post Type', 'powerpress');
    ?>
</option>
<?php 
    reset($post_types);
    while (list($null, $post_type) = each($post_types)) {
        if ($post_type == 'post') {
            continue;
        }
        $post_type = htmlspecialchars($post_type);
        echo "\t<option value=\"{$post_type}\">{$post_type}</option>\n";
    }
    ?>
</select>
</div>

<div class="form-field form-required">
	<label for="feed_title"><?php 
    echo __('Feed Title', 'powerpress');
    ?>
</label>
	<input name="feed_title" id="feed_title" type="text" value="" size="100" />
</div>

<div class="form-field">
	<label for="feed_slug"><?php 
    echo __('Feed Slug', 'powerpress');
    ?>
</label>
	<input name="feed_slug" id="feed_slug" type="text" value="" size="40" />
    <p><?php 
    echo __('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'powerpress');
    ?>
</p>
</div>
<?php 
    wp_nonce_field('powerpress-add-posttype-feed');
    ?>
<p class="submit"><input type="submit" class="button" name="add_podcasting" value="<?php 
    echo __('Add Podcasting to Post Type', 'powerpress');
    ?>
" />  </p>


</div>
</div>

</div> <!-- col-left -->

</div> <!-- col-container -->

<?php 
}
function powerpress_admin_players($type = 'audio')
{
    $General = powerpress_get_settings('powerpress_general');
    if (version_compare($GLOBALS['wp_version'], '3.6-beta', '<') && empty($General['player'])) {
        $General['player'] = 'default';
    } else {
        if (empty($General['player'])) {
            $General['player'] = 'mediaelement-audio';
        }
    }
    if (version_compare($GLOBALS['wp_version'], '3.6-beta', '<') && empty($General['player'])) {
        $General['video_player'] = '';
    } else {
        if (empty($General['video_player'])) {
            $General['video_player'] = 'mediaelement-video';
        }
    }
    if (empty($General['audio_custom_play_button'])) {
        $General['audio_custom_play_button'] = '';
    }
    $select_player = false;
    if (isset($_GET['sp'])) {
        $select_player = true;
    }
    if ($type == 'video') {
        if (!isset($General['video_player'])) {
            $select_player = true;
        }
    } else {
        if (!isset($General['player'])) {
            $select_player = true;
        }
    }
    $Audio = array();
    $Audio['default'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/FlowPlayerClassic.mp3';
    $Audio['audio-player'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/1_Pixel_Out_Flash_Player.mp3';
    $Audio['flashmp3-maxi'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/Flash_Maxi_Player.mp3';
    $Audio['simple_flash'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/Simple_Flash_MP3_Player.mp3';
    $Audio['audioplay'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/AudioPlay.mp3';
    $Audio['html5audio'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/html5.mp3';
    $Audio['mediaelement-audio'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_audio.mp3';
    $Video = array();
    $Video['flare-player'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/FlarePlayer.mp4';
    $Video['flow-player-classic'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/flow.mp4';
    $Video['html5video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/html5.mp4';
    $Video['videojs-html5-video-player-for-wordpress'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/videojs.mp4';
    $Video['mediaelement-video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_video.mp4';
    //$Video['mediaelement-video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/videojs.mp4';
    /*
    <div><
    object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30">
    <PARAM NAME=movie VALUE="http://www.strangecube.com/audioplay/online/audioplay.swf?file=http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/AudioPlay.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.strangecube.com/audioplay/online/alpha_buttons/negative&bgcolor=0xffffff&mode=playpause"><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><embed src="http://www.strangecube.com/audioplay/online/audioplay.swf?file=http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/AudioPlay.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.strangecube.com/audioplay/online/alpha_buttons/negative&bgcolor=0xffffff&mode=playpause" quality=high wmode=transparent width="30" height="30" align="" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></div><!-- End of generated code -->
    */
    if ($type == 'video' && function_exists('add_videojs_header')) {
        add_videojs_header();
    }
    ?>
<link rel="stylesheet" href="<?php 
    echo powerpress_get_root_url();
    ?>
3rdparty/colorpicker/css/colorpicker.css" type="text/css" />
<script type="text/javascript" src="<?php 
    echo powerpress_get_root_url();
    ?>
3rdparty/colorpicker/js/colorpicker.js"></script>
<script type="text/javascript" src="<?php 
    echo powerpress_get_root_url();
    ?>
player.min.js"></script>
<script type="text/javascript"><!--

powerpress_url = '<?php 
    echo powerpress_get_root_url();
    ?>
';

function rgb2hex(rgb) {
 
 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
 function hex(x) {
  hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
  return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
 }
 
 if( rgb )
	return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
 return '';
}

function UpdatePlayerPreview(name, value)
{
	if( typeof(generator) != "undefined" ) // Update the Maxi player...
	{
		generator.updateParam(name, value);
		generator.updatePlayer();
	}
	
	if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
		update_audio_player();
}
				
jQuery(document).ready(function($) {
	
	jQuery('.color_preview').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			jQuery(el).css({ 'background-color' : '#' + hex });
			jQuery(el).ColorPickerHide();
			var Id = jQuery(el).attr('id');
			Id = Id.replace(/_prev/, '');
			jQuery('#'+ Id  ).val( '#' + hex );
			UpdatePlayerPreview(Id, '#'+hex );
		},
		onBeforeShow: function () {
			jQuery(this).ColorPickerSetColor( rgb2hex( jQuery(this).css("background-color") ) );
		}
	})
	.bind('keyup', function(){
		jQuery(this).ColorPickerSetColor( rgb2hex( jQuery(this).css("background-color") ) );
	});
	
	jQuery('.color_field').bind('change', function () {
		var Id = jQuery(this).attr('id');
		jQuery('#'+ Id + '_prev'  ).css( { 'background-color' : jQuery(this).val() } );
		if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
			update_audio_player();
	});
	
	jQuery('.other_field').bind('change', function () {
		if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
			update_audio_player();
	});

});
//-->
</script>


<!-- special page styling goes here -->
<style type="text/css">
div.color_control { display: block; float:left; width: 100%; padding:  0; }
div.color_control input { display: inline; float: left; }
div.color_control div.color_picker { display: inline; float: left; margin-top: 3px; }
#player_preview { margin-bottom: 0px; height: 50px; margin-top: 8px;}
input#colorpicker-value-input {
	width: 60px;
	height: 16px;
	padding: 0;
	margin: 0;
	font-size: 12px;
	border-spacing: 0;
	border-width: 0;
}
table.html5formats {
	width: 600px;
	margin: 0;
	padding: 0;
}
table.html5formats tr {
	margin: 0;
	padding: 0;
}
table.html5formats tr th {
	font-weight: bold;
	border-bottom: 1px solid #000000;
	margin: 0;
	padding: 0 5px;
	width: 25%;
}
table.html5formats tr td {
	
	border-right: 1px solid #000000;
	border-bottom: 1px solid #000000;
	margin: 0;
	padding: 0 10px;
}
table.html5formats tr > td:first-child {
	border-left: 1px solid #000000;
}
</style>
<?php 
    // mainly 2 pages, first page selects a player, second configures the player, if there are optiosn to configure for that player. If the user is on the second page,
    // a link should be provided to select a different player.
    if ($select_player) {
        ?>
<input type="hidden" name="action" value="powerpress-select-player" />
<h2><?php 
        echo __('Blubrry PowerPress Player Options', 'powerpress');
        ?>
</h2>
<p style="margin-bottom: 0;"><?php 
        echo __('Select the media player you would like to use.', 'powerpress');
        ?>
</p>

<?php 
        if ($type == 'video') {
            ?>
<table class="form-table">
<tr valign="top">
<th scope="row">&nbsp;</th>  
<td>
	<ul>
<?php 
            if (version_compare($GLOBALS['wp_version'], '3.6-alpha', '>')) {
                ?>
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_mediaelement_video" value="mediaelement-video" <?php 
                if ($General['video_player'] == 'mediaelement-video') {
                    echo 'checked';
                }
                ?>
 />
		<?php 
                echo __('MediaElement.js Media Player (default)', 'powerpress');
                ?>
</label> <?php 
                echo powerpressadmin_new();
                ?>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_mediaelement_video" class="activate-player"><?php 
                echo __('Activate and Configure Now', 'powerpress');
                ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
                echo powerpressplayer_build_mediaelementvideo($Video['mediaelement-video']);
                ?>
			</p>
			<?php 
                powerpressplayer_mediaelement_info();
                ?>
		</li>
<?php 
            }
            ?>
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_flow_player_classic_player" value="flow-player-classic" <?php 
            if ($General['video_player'] == 'flow-player-classic') {
                echo 'checked';
            }
            ?>
 />
		<?php 
            echo __('Flow Player Classic', 'powerpress');
            ?>
</label>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_flow_player_classic_player" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
            echo powerpressplayer_build_flowplayerclassic($Video['flow-player-classic']);
            ?>
			</p>
<?php 
            powerpressplayer_flowplayer_info();
            ?>
		</li>
		
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_html5video" value="html5video" <?php 
            if ($General['video_player'] == 'html5video') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('HTML5 Video Player', 'powerpress');
            ?>
  </label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_html5video" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
            <?php 
            echo powerpressplayer_build_html5video($Video['html5video']);
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 Video is an element introduced in the latest HTML specification (HTML5) for the purpose of playing videos.', 'powerpress');
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 Video Player is not format specific. See table below for a list of browsers and supported formats.', 'powerpress');
            ?>
			</p>
			<table class="html5formats" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<th><?php 
            echo __('Browser', 'powerpress');
            ?>
</th>
					<th>H.264 (.mp4/.m4v)</th>
					<th>WebM (.webm)</th>
					<th>Theora (.ogg/.ogv)</th>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Internet Explorer', 'powerpress');
            ?>
</i></td>
					<td><strong>9.0+</strong></td>
					<td>-</td>
					<td>-</td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Firefox', 'powerpress');
            ?>
</i></td>
					<td><strong>22.0+</strong></td>
					<td><strong>4.0+</strong></td>
					<td><strong>3.5+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Chrome', 'powerpress');
            ?>
 <sup>1</sup></i></td>
					<td>-</td>
					<td><strong>6.0+</strong></td>
					<td><strong>5.0+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Opera', 'powerpress');
            ?>
</i></td>
					<td>-</td>
					<td><strong>10.6+</strong></td>
					<td><strong>10.5+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Safari', 'powerpress');
            ?>
 <sup>2</sup></i></td>
					<td><strong>3.0+</strong></td>
					<td>-</td>
					<td>-</td>
				</tr>
			</table>
			<div><sup>1</sup> <?php 
            echo __('Chrome supported H.264 in previous versions, but no longer supports the format.', 'powerpress');
            ?>
</div>
			<div><sup>2</sup> <?php 
            echo __('Safari requires QuickTime installed for HTML5 playback.', 'powerpress');
            ?>
</div>
			<p>
				<?php 
            echo __('Flow Player Classic is used when HTML5 support is not available.', 'powerpress');
            ?>
			</p>
		</li>
		
		<!-- videojs-html5-video-player-for-wordpress -->
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_videojs_html5_video_player_for_wordpress" value="videojs-html5-video-player-for-wordpress" <?php 
            if ($General['video_player'] == 'videojs-html5-video-player-for-wordpress') {
                echo 'checked';
            }
            ?>
 <?php 
            echo function_exists('add_videojs_header') ? '' : 'disabled';
            ?>
 />
		<?php 
            echo __('VideoJS', 'powerpress');
            ?>
</label> <?php 
            echo powerpressadmin_new();
            ?>
		<?php 
            if (function_exists('add_videojs_header')) {
                ?>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_videojs_html5_video_player_for_wordpress" class="activate-player"><?php 
                echo __('Activate and Configure Now', 'powerpress');
                ?>
</a></strong>
		<?php 
            }
            ?>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
            if (function_exists('add_videojs_header')) {
                echo powerpressplayer_build_videojs($Video['videojs-html5-video-player-for-wordpress']);
            }
            ?>
			</p>
<?php 
            powerpressplayer_videojs_info();
            ?>
		</li>
		
		
		
	</ul>

</td>
</tr>
</table>
<?php 
        } else {
            ?>
<table class="form-table">
<tr valign="top">
<th scope="row">&nbsp;</th>  
<td>
	<ul>

<?php 
            if (version_compare($GLOBALS['wp_version'], '3.6-alpha', '>')) {
                ?>
		<li><label><input type="radio" name="Player[player]" id="player_mediaelement_audio" value="mediaelement-audio" <?php 
                if ($General['player'] == 'mediaelement-audio') {
                    echo 'checked';
                }
                ?>
 />
		<?php 
                echo __('MediaElement.js Media Player (default)', 'powerpress');
                ?>
</label> <?php 
                echo powerpressadmin_new();
                ?>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_mediaelement_audio" class="activate-player"><?php 
                echo __('Activate and Configure Now', 'powerpress');
                ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
                echo powerpressplayer_build_mediaelementaudio($Audio['mediaelement-audio']);
                ?>
			</p>
			<?php 
                powerpressplayer_mediaelement_info();
                ?>
		</li>
<?php 
            }
            ?>

		<li><label><input type="radio" name="Player[player]" id="player_default" value="default" <?php 
            if ($General['player'] == 'default') {
                echo 'checked';
            }
            ?>
 />
		<?php 
            echo __('Flow Player Classic', 'powerpress');
            ?>
</label>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_default" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
            echo powerpressplayer_build_flowplayerclassic($Audio['default']);
            ?>
			</p>
			<?php 
            powerpressplayer_flowplayer_info();
            ?>
		</li>
		
		<li><label><input type="radio" name="Player[player]" id="player_audio_player" value="audio-player" <?php 
            if ($General['player'] == 'audio-player') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('1 Pixel Out Audio Player', 'powerpress');
            ?>
</label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_audio_player" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
				<?php 
            echo powerpressplayer_build_1pxoutplayer($Audio['audio-player']);
            ?>
			</p>
			<p>
				<?php 
            echo __('1 Pixel Out Audio Player is a popular customizable audio (mp3 only) flash player. Features include an animated play/pause button, scroll-able position bar, elapsed/remaining time, volume control and color styling options.', 'powerpress');
            ?>
			</p>
		</li>
		
		<li><label><input type="radio" name="Player[player]" id="player_html5audio" value="html5audio" <?php 
            if ($General['player'] == 'html5audio') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('HTML5 Audio Player', 'powerpress');
            ?>
  </label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_html5audio" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
			<?php 
            echo powerpressplayer_build_html5audio($Audio['html5audio']);
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 audio is an element introduced in the latest HTML specification (HTML5) for the purpose of playing audio.', 'powerpress');
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 Audio Player is not format specific. See table below for a list of browsers and supported formats.', 'powerpress');
            ?>
			</p>
			<table class="html5formats" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<th><?php 
            echo __('Browser', 'powerpress');
            ?>
</th>
					<th>Mpeg3 (.mp3)</th>
					<th>AAC (.m4a)</th>
					<th>Vorbis (.ogg/.oga)</th>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Internet Explorer', 'powerpress');
            ?>
</i></td>
					<td><strong>9.0+</strong></td>
					<td><strong>9.0+</strong></td>
					<td>-</td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Firefox', 'powerpress');
            ?>
</i></td>
					<td><strong>26.0+</strong></td>
					<td>-</td>
					<td><strong>3.5+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Chrome', 'powerpress');
            ?>
 <sup>1</sup></i></td>
					<td><strong>5.0+</strong></td>
					<td>-</td>
					<td><strong>5.0+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Opera', 'powerpress');
            ?>
</i></td>
					<td>-</td>
					<td>-</td>
					<td><strong>10.5+</strong></td>
				</tr>
				<tr>
					<td><i><?php 
            echo __('Safari', 'powerpress');
            ?>
 <sup>2</sup></i></td>
					<td><strong>3.0+</strong></td>
					<td><strong>3.0+</strong></td>
					<td>-</td>
				</tr>
			</table>
			<div><sup>1</sup> <?php 
            echo __('Chrome supported AAC in previous versions, but no longer supports the format.', 'powerpress');
            ?>
</div>
			<div><sup>2</sup> <?php 
            echo __('Safari requires QuickTime installed for HTML5 playback.', 'powerpress');
            ?>
</div>
			<p>
				<?php 
            echo __('Flow Player Classic is used when HTML5 support is not available.', 'powerpress');
            ?>
			</p>
		</li>
		
		<li>
			<div class="updated fade powerpress-notice inline">
			<?php 
            echo __('NOTICE: Due to limited use, the players below (Mp3 Player Maxi, Simple Flash MP3 Player, and AudioPlay) will be moved to a separate plugin starting with PowerPress version 6.0.', 'powerpress');
            ?>
			</div>
		</li>
		
		<li><label><input type="radio" name="Player[player]" id="player_flashmp3_maxi" value="flashmp3-maxi" <?php 
            if ($General['player'] == 'flashmp3-maxi') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('Mp3 Player Maxi', 'powerpress');
            ?>
</label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_flashmp3_maxi" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
				<?php 
            echo powerpressplayer_build_flashmp3maxi($Audio['flashmp3-maxi']);
            ?>
			</p>
			<p>
				<?php 
            echo __('Flash Mp3 Maxi Player is a customizable open source audio (mp3 only) flash player. Features include pause/play/stop/file info buttons, scroll-able position bar, volume control and color styling options.', 'powerpress');
            ?>
			</p>
		</li>
		
		<li><label><input type="radio" name="Player[player]" id="player_simple_flash" value="simple_flash" <?php 
            if ($General['player'] == 'simple_flash') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('Simple Flash MP3 Player', 'powerpress');
            ?>
</label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_simple_flash" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
			<?php 
            echo powerpressplayer_build_simpleflash($Audio['simple_flash']);
            ?>
			</p>
			<p>
				<?php 
            echo __('Simple Flash MP3 Player is a free and simple audio (mp3 only) flash player. Features include play/pause and stop buttons.', 'powerpress');
            ?>
			</p>
		</li>
		
		<li><label><input type="radio" name="Player[player]" id="player_audioplay" value="audioplay" <?php 
            if ($General['player'] == 'audioplay') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('AudioPlay', 'powerpress');
            ?>
</label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_audioplay" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
			<?php 
            echo powerpressplayer_build_audioplay($Audio['audioplay']);
            ?>
			</p>
			<p>
				<?php 
            echo __('AudioPlay is one button freeware audio (mp3 only) flash player. Features include a play/stop or play/pause button available in two sizes in either black or white.', 'powerpress');
            ?>
			</p>
		</li>
		
	</ul>

</td>
</tr>
</table>
<?php 
        }
        ?>
<h4 style="margin-bottom: 0;"><?php 
        echo __('Click \'Save Changes\' to activate and configure selected player.', 'powerpress');
        ?>
</h4>
<?php 
    } else {
        ?>
<h2><?php 
        echo __('Configure Player', 'powerpress');
        ?>
</h2>
<?php 
        if ($type == 'audio') {
            ?>
<p style="margin-bottom: 20px;"><strong><a href="<?php 
            echo admin_url("admin.php?page=powerpress/powerpressadmin_player.php&amp;sp=1");
            ?>
"><?php 
            echo __('Select a different audio player', 'powerpress');
            ?>
</a></strong></p>
<?php 
        } else {
            ?>
<p style="margin-bottom: 20px;"><strong><a href="<?php 
            echo admin_url("admin.php?page=powerpress/powerpressadmin_videoplayer.php&amp;sp=1");
            ?>
"><?php 
            echo __('Select a different video player', 'powerpress');
            ?>
</a></strong></p>
<?php 
        }
        // Start adding logic here to display options based on the player selected...
        if ($type == 'audio') {
            switch ($General['player']) {
                case 'audio-player':
                    $PlayerSettings = powerpress_get_settings('powerpress_audio-player');
                    if ($PlayerSettings == "") {
                        $PlayerSettings = array('width' => '290', 'transparentpagebg' => 'yes', 'lefticon' => '#333333', 'leftbg' => '#CCCCCC', 'bg' => '#E5E5E5', 'voltrack' => '#F2F2F2', 'volslider' => '#666666', 'rightbg' => '#B4B4B4', 'rightbghover' => '#999999', 'righticon' => '#333333', 'righticonhover' => '#FFFFFF', 'loader' => '#009900', 'track' => '#FFFFFF', 'tracker' => '#DDDDDD', 'border' => '#CCCCCC', 'skip' => '#666666', 'text' => '#333333', 'pagebg' => '', 'rtl' => 'no', 'initialvolume' => '60', 'animation' => 'yes', 'remaining' => 'no');
                    }
                    if (empty($PlayerSettings['remaining'])) {
                        $PlayerSettings['remaining'] = 'no';
                    }
                    // New default setting
                    if (!isset($PlayerSettings['buffer'])) {
                        $PlayerSettings['buffer'] = '';
                    }
                    // New default setting
                    if (!isset($PlayerSettings['titles'])) {
                        $PlayerSettings['titles'] = '';
                    }
                    ?>
<script type="text/javascript"><!--

function update_audio_player()
{
	var myParams = new Array("lefticon","leftbg", "bg", "voltrack", "rightbg", "rightbghover", "righticon", "righticonhover", "loader", "track", "tracker", "border", "skip", "text", "pagebg", "rtl", "animation", "titles", "initialvolume");
	var myWidth = document.getElementById('player_width').value;
	var myBackground = '';
	if( myWidth < 10 || myWidth > 900 )
		myWidth = 290;
	
	var out = '<object type="application/x-shockwave-flash" data="<?php 
                    echo powerpress_get_root_url();
                    ?>
/audio-player.swf" width="'+myWidth+'" height="24">'+"\n";
	out += '    <param name="movie" value="<?php 
                    echo powerpress_get_root_url();
                    ?>
/audio-player.swf" />'+"\n";
	out += '    <param name="FlashVars" value="playerID=1&amp;soundFile=<?php 
                    echo $Audio['audio-player'];
                    ?>
';
	
	var x = 0;
	for( x = 0; x < myParams.length; x++ )
	{
		if( myParams[ x ] == 'border' )
			var Element = document.getElementById( 'player_border' );
		else
			var Element = document.getElementById( myParams[ x ] );
		
		if( Element )
		{
			if( Element.value != '' )
			{
				out += '&amp;';
				out += myParams[ x ];
				out += '=';
				out += Element.value.replace(/^#/, '');
				if( myParams[ x ] == 'pagebg' )
				{
					myBackground = '<param name="bgcolor" value="'+ Element.value +'" />';
					out += '&amp;transparentpagebg=no';
				}
			}
			else
			{
				if( myParams[ x ] == 'pagebg' )
				{
					out += '&amp;transparentpagebg=yes';
					myBackground = '<param name="wmode" value="transparent" />';
				}
			}
		}
	}
	
	out += '" />'+"\n";
	out += '<param name="quality" value="high" />';
	out += '<param name="menu" value="false" />';
	out += myBackground;
	out += '</object>';
	
	var player = document.getElementById("player_preview");
	player.innerHTML = out;
}

function audio_player_defaults()
{
 	if( confirm('<?php 
                    echo __("Set defaults, are you sure?\\n\\nAll of the current settings will be overwritten!", 'powerpress');
                    ?>
') )
	{
		jQuery('#player_width').val('290');
		UpdatePlayerPreview('player_width',jQuery('#player_width').val() );
		
		jQuery('#transparentpagebg').val( 'yes');
		UpdatePlayerPreview('transparentpagebg',jQuery('#transparentpagebg').val() );
		
		jQuery('#lefticon').val( '#333333');
		UpdatePlayerPreview('lefticon',jQuery('#lefticon').val() );
		jQuery('#lefticon_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#leftbg').val( '#CCCCCC');
		UpdatePlayerPreview('leftbg',jQuery('#leftbg').val() );
		jQuery('#leftbg_prev'  ).css( { 'background-color' : '#CCCCCC' } );
		
		jQuery('#bg').val( '#E5E5E5');
		UpdatePlayerPreview('bg',jQuery('#bg').val() );
		jQuery('#bg_prev'  ).css( { 'background-color' : '#E5E5E5' } );
		
		jQuery('#voltrack').val( '#F2F2F2');
		UpdatePlayerPreview('voltrack',jQuery('#voltrack').val() );
		jQuery('#voltrack_prev'  ).css( { 'background-color' : '#F2F2F2' } );
		
		jQuery('#volslider').val( '#666666');
		UpdatePlayerPreview('volslider',jQuery('#volslider').val() );
		jQuery('#volslider_prev'  ).css( { 'background-color' : '#666666' } );
		
		jQuery('#rightbg').val( '#B4B4B4');
		UpdatePlayerPreview('rightbg',jQuery('#rightbg').val() );
		jQuery('#rightbg_prev'  ).css( { 'background-color' : '#B4B4B4' } );
		
		jQuery('#rightbghover').val( '#999999');
		UpdatePlayerPreview('rightbghover',jQuery('#rightbghover').val() );
		jQuery('#rightbghover_prev'  ).css( { 'background-color' : '#999999' } );
		
		jQuery('#righticon').val( '#333333');
		UpdatePlayerPreview('righticon',jQuery('#righticon').val() );
		jQuery('#righticon_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#righticonhover').val( '#FFFFFF');
		UpdatePlayerPreview('righticonhover',jQuery('#righticonhover').val() );
		jQuery('#righticonhover_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#loader').val( '#009900');
		UpdatePlayerPreview('loader',jQuery('#loader').val() );
		jQuery('#loader_prev'  ).css( { 'background-color' : '#009900' } );
		
		jQuery('#track').val( '#FFFFFF');
		UpdatePlayerPreview('track',jQuery('#track').val() );
		jQuery('#track_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#tracker').val( '#DDDDDD');
		UpdatePlayerPreview('tracker',jQuery('#tracker').val() );
		jQuery('#tracker_prev'  ).css( { 'background-color' : '#DDDDDD' } );
		
		jQuery('#player_border').val( '#CCCCCC');
		UpdatePlayerPreview('player_border',jQuery('#player_border').val() );
		jQuery('#player_border_prev'  ).css( { 'background-color' : '#CCCCCC' } );
		
		jQuery('#skip').val( '#666666');
		UpdatePlayerPreview('skip',jQuery('#skip').val() );
		jQuery('#skip_prev'  ).css( { 'background-color' : '#666666' } );
		
		jQuery('#text').val( '#333333');
		UpdatePlayerPreview('text',jQuery('#text').val() );
		jQuery('#text_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#pagebg').val( '');
		UpdatePlayerPreview('pagebg',jQuery('#pagebg').val() );
		
		jQuery('#animation').val( 'yes');
		UpdatePlayerPreview('animation',jQuery('#animation').val() );
		
		jQuery('#remaining').val( 'no');
		UpdatePlayerPreview('remaining',jQuery('#remaining').val() );
		
		jQuery('#buffer').val( '');
		UpdatePlayerPreview('buffer',jQuery('#buffer').val() );
		
		jQuery('#rtl' ).val( 'no' );
		UpdatePlayerPreview('rtl',jQuery('#rtl').val() );
		
		jQuery('#initialvolume').val('60');
		UpdatePlayerPreview('initialvolume',jQuery('#initialvolume').val() );
		
		update_audio_player();
	}
}
//-->
</script>
	<input type="hidden" name="action" value="powerpress-audio-player" />
	<?php 
                    echo __('Configure the 1 pixel out Audio Player', 'powerpress');
                    ?>
	
	
<table class="form-table">
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
		</th>
		<td><div id="player_preview">
		<?php 
                    echo powerpressplayer_build_1pxoutplayer($Audio['audio-player'], array('nodiv' => true));
                    ?>
			</div>
		</td>
	</tr>
</table>

<div id="powerpress_settings_page" class="powerpress_tabbed_content" style="position: relative;">
	<div style="position: absolute; top: 6px; right:0px;">
		<a href="#" onclick="audio_player_defaults();return false;"><?php 
                    echo __('Set Defaults', 'powerpress');
                    ?>
</a>
	</div>
  <ul class="powerpress_settings_tabs"> 
		<li><a href="#tab_general"><span><?php 
                    echo __('Basic Settings', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_progress"><span><?php 
                    echo __('Progress Bar', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_volume"><span><?php 
                    echo __('Volume Button', 'powerpress');
                    ?>
</span></a></li>
		<li><a href="#tab_play"><span><?php 
                    echo __('Play / Pause Button', 'powerpress');
                    ?>
</span></a></li>
  </ul>
	
 <div id="tab_general" class="powerpress_tab">
 <h3><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h3>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Page Background Color', 'powerpress');
                    ?>
                        
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="pagebg" name="Player[pagebg]" class="color_field" value="<?php 
                    echo $PlayerSettings['pagebg'];
                    ?>
" maxlength="20" />
				<img id="pagebg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['pagebg'];
                    ?>
;" class="color_preview" />
			</div>
			<small>(<?php 
                    echo __('leave blank for transparent', 'powerpress');
                    ?>
)</small>
		</td>
	</tr>	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bg" name="Player[bg]" class="color_field" value="<?php 
                    echo $PlayerSettings['bg'];
                    ?>
" maxlength="20" />
				<img id="bg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Width (in pixels)', 'powerpress');
                    ?>
		</th>
		<td>
          <input type="text" style="width: 50px;" id="player_width" name="Player[width]" class="other_field" value="<?php 
                    echo $PlayerSettings['width'];
                    ?>
" maxlength="20" />
				<?php 
                    echo __('width of the player. e.g. 290 (290 pixels) or 100%', 'powerpress');
                    ?>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Right-to-Left', 'powerpress');
                    ?>
		</th>
		<td>
			<select style="width: 102px;" id="rtl" name="Player[rtl]" class="other_field"> 
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['rtl']);
                    ?>
          </select>			<?php 
                    echo __('switches the layout to animate from the right to the left', 'powerpress');
                    ?>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Loading Bar Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="loader" name="Player[loader]" class="color_field" value="<?php 
                    echo $PlayerSettings['loader'];
                    ?>
" maxlength="20" />
				<img id="loader_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['loader'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Text Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                <input type="text" style="width: 100px;" id="text" name="Player[text]" class="color_field" value="<?php 
                    echo $PlayerSettings['text'];
                    ?>
" maxlength="20" />
						<img id="text_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['text'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Text In Player', 'powerpress');
                    ?>
 
		</th>
		<td>
          <div><input type="text" style="width: 60%;" id="titles" name="Player[titles]" class="other_field" value="<?php 
                    echo $PlayerSettings['titles'];
                    ?>
" maxlength="100" /></div>
				<small><?php 
                    echo sprintf(__('Enter \'%s\' to display track name from mp3. Only works if media is hosted on same server as blog.', 'powerpress'), __('TRACK', 'powerpress'));
                    ?>
</small>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play Animation', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
<select style="width: 102px;" id="animation" name="Player[animation]" class="other_field"> 
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['animation']);
                    ?>
                                </select>			<?php 
                    echo __('if no, player is always open', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Display Remaining Time', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
<select style="width: 102px;" id="remaining" name="Player[remaining]" class="other_field">
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['remaining']);
                    ?>
                                </select>			<?php 
                    echo __('if yes, shows remaining track time rather than elapsed time (default: no)', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Buffering Time', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
<select style="width: 200px;" id="buffer" name="Player[buffer]" class="other_field"> 
<?php 
                    $options = array('0' => __('No buffering', 'powerpress'), '' => __('Default (5 seconds)', 'powerpress'), '10' => __('10 seconds', 'powerpress'), '15' => __('15 seconds', 'powerpress'), '20' => __('20 seconds', 'powerpress'), '30' => __('30 seconds', 'powerpress'), '60' => __('60 seconds', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['buffer']);
                    ?>
                                </select>		<?php 
                    echo __('buffering time in seconds', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	
</table>
</div>

 <div id="tab_progress" class="powerpress_tab">
	<h3><?php 
                    echo __('Progress Bar', 'powerpress');
                    ?>
</h3>
<table class="form-table">
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Background', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
										<input type="text" style="width: 100px;" id="track" name="Player[track]" class="color_field" value="<?php 
                    echo $PlayerSettings['track'];
                    ?>
" maxlength="20" />
										<img id="track_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['track'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                            <input type="text" style="width: 100px;" id="tracker" name="Player[tracker]" class="color_field" value="<?php 
                    echo $PlayerSettings['tracker'];
                    ?>
" maxlength="20" />
											<img id="tracker_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['tracker'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Border', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                            <input type="text" style="width: 100px;" id="player_border" name="Player[border]" class="color_field" value="<?php 
                    echo $PlayerSettings['border'];
                    ?>
" maxlength="20" />
											<img id="player_border_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['border'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>       
	</table>
	</div>
	
	
<div id="tab_volume" class="powerpress_tab">
	<h3><?php 
                    echo __('Volume Button Settings', 'powerpress');
                    ?>
</h3>
	<table class="form-table">	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Initial Volume', 'powerpress');
                    ?>
 
		</th>
		<td>
			<select style="width: 100px;" id="initialvolume" name="Player[initialvolume]" class="other_field">
<?php 
                    for ($x = 0; $x <= 100; $x += 5) {
                        echo '<option value="' . $x . '"' . ($PlayerSettings['initialvolume'] == $x ? ' selected' : '') . '>' . $x . '%</option>';
                    }
                    ?>
			</select> <?php 
                    echo __('initial volume level (default: 60)', 'powerpress');
                    ?>
		</td>
	</tr>
				
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volumn Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="leftbg" name="Player[leftbg]" class="color_field" value="<?php 
                    echo $PlayerSettings['leftbg'];
                    ?>
" maxlength="20" />
				<img id="leftbg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['leftbg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Speaker Icon Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="lefticon" name="Player[lefticon]" class="color_field" value="<?php 
                    echo $PlayerSettings['lefticon'];
                    ?>
" maxlength="20" />
				<img id="lefticon_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['lefticon'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Icon Background', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="voltrack" name="Player[voltrack]" class="color_field" value="<?php 
                    echo $PlayerSettings['voltrack'];
                    ?>
" maxlength="20" />
				<img id="voltrack_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['voltrack'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Slider Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="volslider" name="Player[volslider]" class="color_field" value="<?php 
                    echo $PlayerSettings['volslider'];
                    ?>
" maxlength="20" />
				<img id="volslider_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['volslider'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
</table>
</div>

<div id="tab_play" class="powerpress_tab">
	<h3><?php 
                    echo __('Play / Pause Button Settings', 'powerpress');
                    ?>
</h3>
	<table class="form-table">	
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="rightbg" name="Player[rightbg]" class="color_field" value="<?php 
                    echo $PlayerSettings['rightbg'];
                    ?>
" maxlength="20" />
				<img id="rightbg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['rightbg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Hover Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="rightbghover" name="Player[rightbghover]" class="color_field" value="<?php 
                    echo $PlayerSettings['rightbghover'];
                    ?>
" maxlength="20" />
				<img id="rightbghover_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['rightbghover'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Icon Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="righticon" name="Player[righticon]" class="color_field" value="<?php 
                    echo $PlayerSettings['righticon'];
                    ?>
" maxlength="20" />
				<img id="righticon_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['righticon'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Icon Hover Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="righticonhover" name="Player[righticonhover]" class="color_field" value="<?php 
                    echo $PlayerSettings['righticonhover'];
                    ?>
" maxlength="20" />
				<img id="righticonhover_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['righticonhover'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>

</table>
</div> <!-- end tab -->
</div> <!-- end tab wrapper -->

<?php 
                    break;
                case 'simple_flash':
                    ?>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
		</th>
		<td><p>
		<?php 
                    // TODO
                    echo powerpressplayer_build_simpleflash($Audio['simple_flash']);
                    ?>
			</p>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			&nbsp;
		</th>
		<td>
			<p><?php 
                    echo __('Simple Flash Player has no additional settings.', 'powerpress');
                    ?>
</p>
		</td>
	</tr>
</table>                            
              <?php 
                    break;
                case 'flashmp3-maxi':
                    //get settings for Flash MP3 Maxi player
                    $PlayerSettings = powerpress_get_settings('powerpress_flashmp3-maxi');
                    //set array values for dropdown lists
                    $autoload = array('always' => 'Always', 'never' => 'Never', 'autohide' => 'Auto Hide');
                    $volume = array('0' => '0', '25' => '25', '50' => '50', '75' => '75', '100' => '100', '125' => '125', '150' => '150', '175' => '175', '200' => '200');
                    //set PlayerSettings as blank array for initial setup
                    //This keeps the foreach loop from returning an error
                    if (empty($PlayerSettings)) {
                        $PlayerSettings = array('bgcolor1' => '#7c7c7c', 'bgcolor2' => '#333333', 'bgcolor' => '', 'textcolor' => '#FFFFFF', 'buttoncolor' => '#FFFFFF', 'buttonovercolor' => '#FFFF00', 'showstop' => '0', 'showinfo' => '0', 'showvolume' => '1', 'height' => '20', 'width' => '200', 'showloading' => 'autohide', 'buttonwidth' => '26', 'volume' => '100', 'showslider' => '1', 'slidercolor1' => '#cccccc', 'slidercolor2' => '#888888', 'sliderheight' => '10', 'sliderwidth' => '20', 'loadingcolor' => '#FFFF00', 'volumeheight' => '6', 'volumewidth' => '30', 'sliderovercolor' => '#eeee00');
                    }
                    ?>
<script type="text/javascript"><!--

function audio_player_defaults()
{
	if( confirm('<?php 
                    echo __("Set defaults, are you sure?\\n\\nAll of the current settings will be overwritten!'", 'powerpress');
                    ?>
) )
	{
		jQuery('#bgcolor1').val('#7c7c7c');
		UpdatePlayerPreview('bgcolor1',jQuery('#bgcolor1').val() );
		jQuery('#bgcolor1_prev'  ).css( { 'background-color' : '#7c7c7c' } );
		
		jQuery('#bgcolor2').val('#333333' );
		UpdatePlayerPreview('bgcolor2',jQuery('#bgcolor2').val() );
		jQuery('#bgcolor2_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#textcolor' ).val( '#FFFFFF' );
		UpdatePlayerPreview('textcolor',jQuery('#textcolor').val() );
		jQuery('#textcolor_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#buttoncolor' ).val( '#FFFFFF' );
		UpdatePlayerPreview('buttoncolor',jQuery('#buttoncolor').val() );
		jQuery('#buttoncolor_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#buttonovercolor' ).val( '#FFFF00' );
		UpdatePlayerPreview('buttonovercolor',jQuery('#buttonovercolor').val() );
		jQuery('#buttonovercolor_prev'  ).css( { 'background-color' : '#FFFF00' } );
		
		jQuery('#showstop' ).val( '0' );
		UpdatePlayerPreview('showstop',jQuery('#showstop').val() );
		jQuery('#showinfo' ).val( '0' );
		UpdatePlayerPreview('showinfo',jQuery('#showinfo').val() );
		jQuery('#showvolume' ).val( '1' );
		UpdatePlayerPreview('showvolume',jQuery('#showvolume').val() );
		
		jQuery('#player_height' ).val( '20' );
		UpdatePlayerPreview('height',jQuery('#player_height').val() );
		
		jQuery('#player_width' ).val( '200' );
		UpdatePlayerPreview('width',jQuery('#player_width').val() );
		
		jQuery('#showloading' ).val( 'autohide' );
		UpdatePlayerPreview('showloading',jQuery('#showloading').val() );
		
		
		jQuery('#slidercolor1').val('#cccccc' );
		UpdatePlayerPreview('slidercolor1',jQuery('#slidercolor1').val() );
		jQuery('#slidercolor1_prev'  ).css( { 'background-color' : '#cccccc' } );
		
		jQuery('#slidercolor2').val('#888888' );
		UpdatePlayerPreview('slidercolor2',jQuery('#slidercolor2').val() );
		jQuery('#slidercolor2_prev'  ).css( { 'background-color' : '#888888' } );
		
		jQuery('#sliderheight' ).val( '10' );
		UpdatePlayerPreview('sliderheight',jQuery('#sliderheight').val() );
		jQuery('#sliderwidth' ).val( '20' );
		UpdatePlayerPreview('sliderwidth',jQuery('#sliderwidth').val() );
		
		jQuery('#loadingcolor' ).val( '#FFFF00' );
		UpdatePlayerPreview('loadingcolor',jQuery('#loadingcolor').val() );
		jQuery('#loadingcolor_prev'  ).css( { 'background-color' : '#FFFF00' } );
		
		jQuery('#bgcolor').val('');
		UpdatePlayerPreview('bgcolor',jQuery('#bgcolor').val() );
		jQuery('#bgcolor_prev'  ).css( { 'background-color' : '' } );
		
		jQuery('#volumeheight' ).val( '6' );
		UpdatePlayerPreview('volumeheight',jQuery('#volumeheight').val() );
		jQuery('#volumewidth' ).val( '30' );
		UpdatePlayerPreview('volumewidth',jQuery('#volumewidth').val() );
		
		jQuery('#sliderovercolor' ).val( '#eeee00' );
		UpdatePlayerPreview('sliderovercolor',jQuery('#sliderovercolor').val() );
		jQuery('#sliderovercolor_prev'  ).css( { 'background-color' : '#eeee00' } );
		
		jQuery('#volume' ).val( '100' );
		UpdatePlayerPreview('volume',jQuery('#volume').val() );
		
		jQuery('#showslider' ).val( '1' );
		UpdatePlayerPreview('showslider',jQuery('#showslider').val() );
		
		jQuery('#buttonwidth' ).val( '26' );
		UpdatePlayerPreview('buttonwidth',jQuery('#buttonwidth').val() );
		
		//update_audio_player();
		generator.updatePlayer();
	}
}
//-->
</script>
	<input type="hidden" name="action" value="powerpress-flashmp3-maxi" />
	<p><?php 
                    echo __('Configure Flash Mp3 Maxi Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div id="player_preview"></div>

<script type="text/javascript" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
3rdparty/maxi_player/generator.js"></script>
<input type="hidden" id="gen_mp3" name="gen_mp3" value="<?php 
                    echo $Audio['flashmp3-maxi'];
                    ?>
" />


		</td>
	</tr>
</table>

<div id="powerpress_settings_page" class="powerpress_tabbed_content" style="position: relative;">
	<div style="position: absolute; top: 6px; right:0px;">
		<a href="#" onclick="audio_player_defaults();return false;"><?php 
                    echo __('Set Defaults', 'powerpress');
                    ?>
</a>
	</div>
  <ul class="powerpress_settings_tabs"> 
		<li><a href="#tab_general"><span><?php 
                    echo __('Basic Settings', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_buttons"><span><?php 
                    echo __('Button Settings', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_volume"><span><?php 
                    echo __('Volume Settings', 'powerpress');
                    ?>
</span></a></li>
		<li><a href="#tab_slider"><span><?php 
                    echo __('Slider Settings', 'powerpress');
                    ?>
</span></a></li>
  </ul>
	
 <div id="tab_general" class="powerpress_tab">
		<h3><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h3>
		<table class="form-table">
        <tr valign="top">
            <td colspan="2">
            
            <?php 
                    echo __('leave blank for default values', 'powerpress');
                    ?>
            </td>
        </tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Gradient Color Top', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bgcolor1"  name="Player[bgcolor1]" class="color_field" value="<?php 
                    echo $PlayerSettings['bgcolor1'];
                    ?>
" maxlength="20" />
				<img id="bgcolor1_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bgcolor1'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Gradient Color Bottom', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bgcolor2" name="Player[bgcolor2]" class="color_field" value="<?php 
                    echo $PlayerSettings['bgcolor2'];
                    ?>
" maxlength="20" />
				<img id="bgcolor2_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bgcolor2'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Background Color', 'powerpress');
                    ?>
                        
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bgcolor" name="Player[bgcolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['bgcolor'];
                    ?>
" maxlength="20" />
				<img id="bgcolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bgcolor'];
                    ?>
;" class="color_preview" />
			</div>
			<small><?php 
                    echo __('leave blank for transparent', 'powerpress');
                    ?>
</small>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Text Color', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="textcolor" name="Player[textcolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['textcolor'];
                    ?>
" maxlength="20" />
				<img id="textcolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['textcolor'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Height (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="player_height" name="Player[height]" value="<?php 
                    echo $PlayerSettings['height'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Width (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="player_width" name="Player[width]" value="<?php 
                    echo $PlayerSettings['width'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
</table>
</div>

 <div id="tab_buttons" class="powerpress_tab">
		<h3><?php 
                    echo __('Button Settings', 'powerpress');
                    ?>
</h3>
		<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Button Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="buttoncolor" name="Player[buttoncolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['buttoncolor'];
                    ?>
" maxlength="20" />
				<img id="buttoncolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['buttoncolor'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Button Hover Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="buttonovercolor" name="Player[buttonovercolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['buttonovercolor'];
                    ?>
" maxlength="20" />
				<img id="buttonovercolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['buttonovercolor'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Button Width (in pixels)', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="buttonwidth" name="Player[buttonwidth]" value="<?php 
                    echo $PlayerSettings['buttonwidth'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Show Stop Button', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="showstop" name="Player[showstop]">
<?php 
                    $options = array('1' => __('Yes', 'powerpress'), '0' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['showstop']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Show Info', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="showinfo" name="Player[showinfo]">
<?php 
                    $options = array('1' => __('Yes', 'powerpress'), '0' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['showinfo']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>
</table>
</div>

 <div id="tab_volume" class="powerpress_tab">
		<h3><?php 
                    echo __('Volume Settings', 'powerpress');
                    ?>
</h3>
		<table class="form-table">
        
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Show Volume', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="showvolume" name="Player[showvolume]">
<?php 
                    $options = array('1' => __('Yes', 'powerpress'), '0' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['showvolume']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>	
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="volume" name="Player[volume]">
<?php 
                    powerpress_print_options($volume, $PlayerSettings['volume']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Height (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="volumeheight" name="Player[volumeheight]" value="<?php 
                    echo $PlayerSettings['volumeheight'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Width (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="volumewidth" name="Player[volumewidth]" value="<?php 
                    echo $PlayerSettings['volumewidth'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>

</table>
</div>

 <div id="tab_slider" class="powerpress_tab">
		<h3><?php 
                    echo __('Slider Settings', 'powerpress');
                    ?>
</h3>
		<table class="form-table">
		
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Show Slider', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="showslider" name="Player[showslider]">
<?php 
                    $options = array('1' => __('Yes', 'powerpress'), '0' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['showslider']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>	
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Slider Color Top', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="slidercolor1" name="Player[slidercolor1]" class="color_field" value="<?php 
                    echo $PlayerSettings['slidercolor1'];
                    ?>
" maxlength="20" />
				<img id="slidercolor1_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['slidercolor1'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Slider Color Bottom', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="slidercolor2" name="Player[slidercolor2]" class="color_field" value="<?php 
                    echo $PlayerSettings['slidercolor2'];
                    ?>
" maxlength="20" />
				<img id="slidercolor2_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['slidercolor2'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Slider Hover Color', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="sliderovercolor" name="Player[sliderovercolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['sliderovercolor'];
                    ?>
" maxlength="20" />
				<img id="sliderovercolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['sliderovercolor'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Slider Height (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="sliderheight" name="Player[sliderheight]" value="<?php 
                    echo $PlayerSettings['sliderheight'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Slider Width (in pixels)', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 50px;" id="sliderwidth" name="Player[sliderwidth]" value="<?php 
                    echo $PlayerSettings['sliderwidth'];
                    ?>
" maxlength="20" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Show Loading Buffer', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<select style="width: 100px;" id="showloading" name="Player[showloading]">
<?php 
                    powerpress_print_options($autoload, $PlayerSettings['showloading']);
                    ?>
                                </select>
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Loading Buffer Color', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="loadingcolor" name="Player[loadingcolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['loadingcolor'];
                    ?>
" maxlength="20" />
				<img id="loadingcolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['loadingcolor'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>

</table>
</div> <!-- end tab -->
</div><!-- end tab container -->

<script type="text/javascript"><!--

	generator.player = '<?php 
                    echo powerpress_get_root_url();
                    ?>
player_mp3_maxi.swf';
	generator.addParam("gen_mp3", "mp3", "url", '');
	generator.addParam("player_height", "height", "int", "20");
	generator.addParam("player_width", "width", "int", "200");
	generator.addParam("bgcolor1", "bgcolor1", "color", "#7c7c7c");
	generator.addParam("bgcolor2", "bgcolor2", "color", "#333333");
	generator.addParam("bgcolor", "bgcolor", "color", "");
	generator.addParam("textcolor", "textcolor", "color", "#FFFFFF");
	generator.addParam("loadingcolor", "loadingcolor", "color", "#FFFF00");
	generator.addParam("buttoncolor", "buttoncolor", "color", "#FFFFFF");
	generator.addParam("buttonovercolor", "buttonovercolor", "color", "#FFFF00");
	generator.addParam("showloading", "showloading", "text", "autohide");
	generator.addParam("showinfo", "showinfo", "bool", "0");
	generator.addParam("showstop", "showstop", "int", "0");
	generator.addParam("showvolume", "showvolume", "int", "0");
	generator.addParam("buttonwidth", "buttonwidth", "int", "26");
	generator.addParam("volume", "volume", "int", "100");
	generator.addParam("volumeheight", "volumeheight", "int", "6");
	generator.addParam("volumewidth", "volumewidth", "int", "30");
	generator.addParam("sliderovercolor", "sliderovercolor", "color", "#eeee00");
	generator.addParam("showslider", "showslider", "bool", "1");
	generator.addParam("slidercolor1", "slidercolor1", "color", "#cccccc");
	generator.addParam("slidercolor2", "slidercolor2", "color", "#888888");
	generator.addParam("sliderheight", "sliderheight", "int", "10");
	generator.addParam("sliderwidth", "sliderwidth", "int", "20");
	
	generator.updatePlayer();
//-->
</script>
<?php 
                    break;
                case 'audioplay':
                    $PlayerSettings = powerpress_get_settings('powerpress_audioplay');
                    if (empty($PlayerSettings)) {
                        $PlayerSettings = array('bgcolor' => '', 'buttondir' => 'negative', 'mode' => 'playpause');
                    }
                    ?>
        	<input type="hidden" name="action" value="powerpress-audioplay" />
	<?php 
                    echo __('Configure the AudioPlay Player', 'powerpress');
                    ?>
<br clear="all" />

<table class="form-table">
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td colspan="2">
			<div id="player_preview">
                        
<?php 
                    echo powerpressplayer_build_audioplay($Audio['audioplay']);
                    ?>
                </div>
            </td>
        </tr>
</table>
				
		<h2><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h2>
	<table class="form-table">
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Background Color', 'powerpress');
                    ?>
                        
		</th>
		<td valign="top">
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bgcolor" name="Player[bgcolor]" class="color_field" value="<?php 
                    echo $PlayerSettings['bgcolor'];
                    ?>
" maxlength="20" />
				<img id="bgcolor_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bgcolor'];
                    ?>
;" class="color_preview" />
			</div>
			<small><?php 
                    echo __('leave blank for transparent', 'powerpress');
                    ?>
</small>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Mode', 'powerpress');
                    ?>
		</th>
		<td valign="top">
			<div class="color_control">
                            <select name="Player[mode]" id="mode">
<?php 
                    $options = array('playpause' => __('Play/Pause', 'powerpress'), 'playstop' => __('Play/Stop', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['mode']);
                    ?>
     
                            </select>
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Button', 'powerpress');
                    ?>
		</th>
		<td valign="top">
			<div class="color_control">
                        <table cellpadding="0" cellspacing="0">
                                <?php 
                    $options = array('classic', 'classic_small', 'negative', 'negative_small');
                    foreach ($options as $option) {
                        if ($PlayerSettings['buttondir'] == $option) {
                            $selected = " CHECKED";
                        } else {
                            $selected = "";
                        }
                        if ($option == "classic" || $option == "classic_small") {
                            $td = '<td style="background: #999;" align="center">';
                            $warning = "(ideal for dark backgrounds)";
                            if ($option == "classic_small") {
                                $name = __('Small White', 'powerpress');
                            } else {
                                $name = __('Large White', 'powerpress');
                            }
                        } else {
                            $td = '<td align="center">';
                            $warning = "";
                            if ($option == "negative_small") {
                                $name = __('Small Black', 'powerpress');
                            } else {
                                $name = __('Large Black', 'powerpress');
                            }
                        }
                        echo '<tr><td><input type="radio" name="Player[buttondir]" value="' . $option . '"' . $selected . ' /></td>' . $td . '<img src="' . powerpress_get_root_url() . 'buttons/' . $option . '/playup.png" /></td><td>' . $name . ' Button ' . $warning . '</td></tr>';
                    }
                    ?>
                                
                            </table>
			</div>
		</td>
	</tr>

</table>
<?php 
                    break;
                case 'html5audio':
                    $SupportUploads = powerpressadmin_support_uploads();
                    ?>
<p><?php 
                    echo __('Configure HTML5 Audio Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_html5audio($Audio['default']);
                    ?>
			</p>
		</td>
	</tr>

	
	<tr>
	<th scope="row">
	<?php 
                    echo __('Play Icon', 'powerpress');
                    ?>
</th>
	<td>

	<input type="text" id="audio_custom_play_button" name="General[audio_custom_play_button]" style="width: 60%;" value="<?php 
                    echo $General['audio_custom_play_button'];
                    ?>
" maxlength="250" />
	<a href="#" onclick="javascript: window.open( document.getElementById('audio_custom_play_button').value ); return false;"><?php 
                    echo __('preview', 'powerpress');
                    ?>
</a>

	<p><?php 
                    echo __('Place the URL to the play icon above.', 'powerpress');
                    ?>
 <?php 
                    echo __('Example', 'powerpress');
                    ?>
: http://example.com/images/audio_play_icon.jpg<br /><br />
	<?php 
                    echo __('Leave blank to use default play icon image.', 'powerpress');
                    ?>
</p>

	<?php 
                    if ($SupportUploads) {
                        ?>
	<p><input name="audio_custom_play_button_checkbox" type="checkbox" onchange="powerpress_show_field('audio_custom_play_button_upload', this.checked)" value="1" /> <?php 
                        echo __('Upload new image', 'powerpress');
                        ?>
 </p>
	<div style="display:none" id="audio_custom_play_button_upload">
		<label for="audio_custom_play_button_file"><?php 
                        echo __('Choose file', 'powerpress');
                        ?>
:</label><input type="file" name="audio_custom_play_button_file"  />
	</div>
	<?php 
                    }
                    ?>
	</td>
	</tr>
</table>

<?php 
                    break;
                case 'mediaelement-audio':
                    $SupportUploads = powerpressadmin_support_uploads();
                    // TODO!
                    ?>
<p><?php 
                    echo __('Configure MediaElement.js Audio Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
		</th>
		<td><p>
		<?php 
                    // TODO
                    echo powerpressplayer_build_mediaelementaudio($Audio['mediaelement-audio']);
                    ?>
			</p>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			&nbsp;
		</th>
		<td>
			<p><?php 
                    echo __('MediaElement.js Player has no additional settings at this time.', 'powerpress');
                    ?>
</p>
		</td>
	</tr>
</table>  

<?php 
                    break;
                default:
                    if (empty($General['player_width_audio'])) {
                        $General['player_width_audio'] = '';
                    }
                    ?>
<p><?php 
                    echo __('Configure Flow Player Classic', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_flowplayerclassic($Audio['default']);
                    ?>
			</p>
		</td>
	</tr>
</table>

<h2><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h2>
	<table class="form-table">
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Width', 'powerpress');
                    ?>
   
		</th>
		<td valign="top">
				<input type="text" style="width: 50px;" id="player_width" name="General[player_width_audio]" class="player-width" value="<?php 
                    echo $General['player_width_audio'];
                    ?>
" maxlength="4" />
			<?php 
                    echo __('Width of Audio mp3 player (leave blank for 320 default)', 'powerpress');
                    ?>
		</td>
	</tr>
</table>
<?php 
                    break;
            }
        } else {
            switch ($General['video_player']) {
                case 'flow-player-classic':
                    ?>
					<p><?php 
                    echo __('Configure Flow Player Classic', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_flowplayerclassic($Video['flow-player-classic']);
                    ?>
			</p>
		</td>
	</tr>
</table>

					<?php 
                    break;
                case 'html5video':
                    ?>
					<p><?php 
                    echo __('Configure HTML5 Video Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_html5video($Video['html5video']);
                    ?>
			</p>
		</td>
	</tr>
</table>

					<?php 
                    break;
                case 'videojs-html5-video-player-for-wordpress':
                    ?>
					<p><?php 
                    echo __('Configure VideoJS', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_videojs($Video['videojs-html5-video-player-for-wordpress']);
                    ?>
			</p>
		</td>
	</tr>
</table>
<h3><?php 
                    echo __('VideoJS Settings', 'powerpress');
                    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
                    echo __('VideoJS CSS Class', 'powerpress');
                    ?>
</th>
<td>
<p>
<input type="text" name="General[videojs_css_class]" style="width: 150px;" value="<?php 
                    echo empty($General['videojs_css_class']) ? '' : htmlspecialchars($General['videojs_css_class']);
                    ?>
" /> 
<?php 
                    echo __('Apply specific CSS styling to your Video JS player.', 'powerpress');
                    ?>
</p>
</td>
</tr>
</table>
					<?php 
                    break;
                case 'mediaelement-video':
                    ?>
					<p><?php 
                    echo __('Configure MediaElement.js Video Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_mediaelementvideo($Video['mediaelement-video']);
                    ?>
			</p>
		</td>
	</tr>
</table>

					<?php 
                    break;
            }
            if (!isset($General['poster_play_image'])) {
                $General['poster_play_image'] = 1;
            }
            if (!isset($General['poster_image_audio'])) {
                $General['poster_image_audio'] = 0;
            }
            if (!isset($General['player_width'])) {
                $General['player_width'] = '';
            }
            if (!isset($General['player_height'])) {
                $General['player_height'] = '';
            }
            if (!isset($General['poster_image'])) {
                $General['poster_image'] = '';
            }
            if (!isset($General['video_custom_play_button'])) {
                $General['video_custom_play_button'] = '';
            }
            ?>
<!-- Global Video Player settings (Appy to all video players -->
<input type="hidden" name="action" value="powerpress-save-videocommon" />
<h3><?php 
            echo __('Common Settings', 'powerpress');
            ?>
</h3>
<p><?php 
            echo __('The following video settings apply to the video player above as well as to classic video &lt;embed&gt; formats such as Microsoft Windows Media (.wmv), QuickTime (.mov) and RealPlayer.', 'powerpress');
            ?>
</p>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
            echo __('Player Width', 'powerpress');
            ?>
</th>
<td>
<input type="text" name="General[player_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
            echo $General['player_width'];
            ?>
" maxlength="4" />
<?php 
            echo __('Width of player (leave blank for 400 default)', 'powerpress');
            ?>
</td>
</tr>

<tr valign="top">
<th scope="row">
<?php 
            echo __('Player Height', 'powerpress');
            ?>
</th>
<td>
<input type="text" name="General[player_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
            echo $General['player_height'];
            ?>
" maxlength="4" />
<?php 
            echo __('Height of player (leave blank for 225 default)', 'powerpress');
            ?>
</td>
</tr>
<?php 
            $SupportUploads = powerpressadmin_support_uploads();
            // Play icon, only applicable to HTML5/FlowPlayerClassic
            if (in_array($General['video_player'], array('flow-player-classic', 'html5video'))) {
                ?>
<tr valign="top">
<th scope="row">
<?php 
                echo __('QuickTime Scale', 'powerpress');
                ?>
</th>
<td>
	<select name="General[player_scale]" class="bpp_input_sm" onchange="javascript:jQuery('#player_scale_custom').css('display', (this.value=='tofit'||this.value=='aspect'? 'none':'inline' ))">
<?php 
                $scale_options = array('tofit' => __('ToFit (default)', 'powerpress'), 'aspect' => __('Aspect', 'powerpress'));
                if (!isset($General['player_scale'])) {
                    $General['player_scale'] = 'tofit';
                }
                // Tofit works in almost all cases
                if (is_numeric($General['player_scale'])) {
                    $scale_options[$General['player_scale']] = __('Custom', 'powerpress');
                } else {
                    $scale_options['custom'] = __('Custom', 'powerpress');
                }
                while (list($value, $desc) = each($scale_options)) {
                    echo "\t<option value=\"{$value}\"" . ($General['player_scale'] == $value ? ' selected' : '') . ">{$desc}</option>\n";
                }
                ?>
</select>
<span id="player_scale_custom" style="display: <?php 
                echo is_numeric($General['player_scale']) ? 'inline' : 'none';
                ?>
">
	<?php 
                echo __('Scale:', 'powerpress');
                ?>
 <input type="text" name="PlayerScaleCustom" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9.]/g, '');" value="<?php 
                echo is_numeric($General['player_scale']) ? $General['player_scale'] : '';
                ?>
" maxlength="4" /> <?php 
                echo __('e.g.', 'powerpress');
                ?>
 1.5
</span>
<p style="margin-top: 5px; margin-bottom: 0;">
	<?php 
                echo __('If you do not see video, adjust the width, height and scale settings above.', 'powerpress');
                ?>
</p>
</td>
</tr>
<?php 
            }
            ?>
<tr>
<th scope="row">
<?php 
            echo __('Default Poster Image', 'powerpress');
            ?>
</th>
<td>

<input type="text" id="poster_image" name="General[poster_image]" style="width: 60%;" value="<?php 
            echo $General['poster_image'];
            ?>
" maxlength="250" />
<a href="#" onclick="javascript: window.open( document.getElementById('poster_image').value ); return false;"><?php 
            echo __('preview', 'powerpress');
            ?>
</a>

<p><?php 
            echo __('Place the URL to the poster image above.', 'powerpress');
            ?>
 <?php 
            echo __('Example', 'powerpress');
            ?>
: http://example.com/images/poster.jpg<br /><br />
<?php 
            echo __('Image should be at minimum the same width/height as the player above. Leave blank to use default black background image.', 'powerpress');
            ?>
</p>

<?php 
            if ($SupportUploads) {
                ?>
<p><input name="poster_image_checkbox" type="checkbox" onchange="powerpress_show_field('poster_image_upload', this.checked)" value="1" /> <?php 
                echo __('Upload new image', 'powerpress');
                ?>
 </p>
<div style="display:none" id="poster_image_upload">
	<label for="poster_image_file"><?php 
                echo __('Choose file', 'powerpress');
                ?>
:</label><input type="file" name="poster_image_file"  />
</div>
<?php 
            }
            if (in_array($General['video_player'], array('flow-player-classic', 'html5video'))) {
                ?>
<p><input name="General[poster_play_image]" type="checkbox" value="1" <?php 
                echo $General['poster_play_image'] ? 'checked' : '';
                ?>
 /> <?php 
                echo __('Include play icon over poster image when applicable', 'powerpress');
                ?>
 </p>
<p><input name="General[poster_image_audio]" type="checkbox" value="1" <?php 
                echo $General['poster_image_audio'] ? 'checked' : '';
                ?>
 /> <?php 
                echo __('Use poster image, player width and height above for audio (Flow Player only)', 'powerpress');
                ?>
 </p>
<?php 
            }
            ?>
</td>
</tr>

<?php 
            // Play icon, only applicable to HTML5/FlowPlayerClassic
            if (in_array($General['video_player'], array('flow-player-classic', 'html5video'))) {
                ?>
<tr>
<th scope="row">
<?php 
                echo __('Play Icon', 'powerpress');
                ?>
</th>
<td>

<input type="text" id="video_custom_play_button" name="General[video_custom_play_button]" style="width: 60%;" value="<?php 
                echo $General['video_custom_play_button'];
                ?>
" maxlength="250" />
<a href="#" onclick="javascript: window.open( document.getElementById('video_custom_play_button').value ); return false;"><?php 
                echo __('preview', 'powerpress');
                ?>
</a>

<p><?php 
                echo __('Place the URL to the play icon above.', 'powerpress');
                ?>
 <?php 
                echo __('Example', 'powerpress');
                ?>
: http://example.com/images/video_play_icon.jpg<br /><br />
<?php 
                echo __('Image should 60 pixels by 60 pixels. Leave blank to use default play icon image.', 'powerpress');
                ?>
</p>

<?php 
                if ($SupportUploads) {
                    ?>
<p><input name="video_custom_play_button_checkbox" type="checkbox" onchange="powerpress_show_field('video_custom_play_button_upload', this.checked)" value="1" /> <?php 
                    echo __('Upload new image', 'powerpress');
                    ?>
 </p>
<div style="display:none" id="video_custom_play_button_upload">
	<label for="video_custom_play_button_file"><?php 
                    echo __('Choose file', 'powerpress');
                    ?>
:</label><input type="file" name="video_custom_play_button_file"  />
</div>
<?php 
                }
                ?>
</td>
</tr>
<?php 
            }
            ?>
</table>
<?php 
        }
        ?>

<?php 
    }
}
function powerpress_admin_editfeed($type = '', $type_value = '', $feed_slug = false)
{
    $SupportUploads = powerpressadmin_support_uploads();
    $General = powerpress_get_settings('powerpress_general');
    $FeedAttribs = array('type' => $type, 'feed_slug' => '', 'category_id' => 0, 'term_taxonomy_id' => 0, 'term_id' => 0, 'taxonomy_type' => '', 'post_type' => '');
    $cat_ID = false;
    $term_taxonomy_id = false;
    $FeedTitle = __('Feed Settings', 'powerpress');
    switch ($type) {
        case 'channel':
            $feed_slug = $type_value;
            $FeedAttribs['feed_slug'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_feed_' . $feed_slug);
            if (!$FeedSettings) {
                $FeedSettings = array();
                $FeedSettings['title'] = '';
                if (!empty($General['custom_feeds'][$feed_slug])) {
                    $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
                }
            }
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            if (!isset($General['custom_feeds'][$feed_slug])) {
                $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
            }
            $FeedTitle = sprintf('Podcast Settings for Channel: %s', htmlspecialchars($General['custom_feeds'][$feed_slug]));
            echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
            echo '<input type="hidden" name="action" value="powerpress-save-channel" />';
            break;
        case 'category':
            $cat_ID = $type_value;
            $FeedAttribs['category_id'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_cat_feed_' . $cat_ID);
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            $category = get_category_to_edit($cat_ID);
            $FeedTitle = sprintf(__('Podcast Settings for Category: %s', 'powerpress'), htmlspecialchars($category->name));
            echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
            echo '<input type="hidden" name="action" value="powerpress-save-category" />';
            break;
        case 'ttid':
            $term_taxonomy_id = $type_value;
            $FeedAttribs['term_taxonomy_id'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_taxonomy_' . $term_taxonomy_id);
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            global $wpdb;
            $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM {$wpdb->term_taxonomy} WHERE term_taxonomy_id = {$term_taxonomy_id}", ARRAY_A);
            if (!empty($term_info[0]['term_id'])) {
                $term_ID = $term_info[0]['term_id'];
                $taxonomy_type = $term_info[0]['taxonomy'];
                $FeedAttribs['term_id'] = $term_ID;
                $FeedAttribs['taxonomy_type'] = $taxonomy_type;
                $term_object = get_term_to_edit($term_ID, $taxonomy_type);
                $FeedTitle = sprintf(__('Podcast Settings for Taxonomy Term: %s', 'powerpress'), htmlspecialchars($term_object->name));
            } else {
                $FeedTitle = sprintf(__('Podcast Settings for Taxonomy Term: %s', 'powerpress'), 'Term ID ' . htmlspecialchars($term_taxonomy_id));
            }
            echo sprintf('<input type="hidden" name="ttid" value="%s" />', $term_taxonomy_id);
            echo '<input type="hidden" name="action" value="powerpress-save-ttid" />';
            break;
        case 'post_type':
            $FeedAttribs['post_type'] = $type_value;
            $FeedAttribs['feed_slug'] = $feed_slug;
            $FeedSettingsArray = powerpress_get_settings('powerpress_posttype_' . $FeedAttribs['post_type']);
            if (!is_array($FeedSettingsArray[$feed_slug])) {
                $FeedSettingsArray[$feed_slug] = array();
            }
            $FeedSettings = powerpress_default_settings($FeedSettingsArray[$feed_slug], 'editfeed_custom');
            //$category = get_category_to_edit($cat_ID);
            $PostTypeTitle = $FeedAttribs['post_type'];
            // TODO: Get readable title of post type
            $FeedTitle = sprintf(__('Podcast Settings for Post Type %s with slug %s', 'powerpress'), htmlspecialchars($PostTypeTitle), htmlspecialchars($feed_slug));
            echo sprintf('<input type="hidden" name="podcast_post_type" value="%s" />', $FeedAttribs['post_type']);
            echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
            echo '<input type="hidden" name="action" value="powerpress-save-post_type" />';
            break;
        default:
            $FeedSettings = powerpress_get_settings('powerpress_feed');
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
            echo '<input type="hidden" name="action" value="powerpress-save-settings" />';
            break;
    }
    echo '<h2>' . $FeedTitle . '</h2>';
    if ($cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories']))) {
        echo '<input type="hidden" name="from_categories" value="1" />';
    }
    ?>
<div id="powerpress_settings_page" class="powerpress_tabbed_content"> 
  <ul class="powerpress_settings_tabs">
		<li><a href="#feed_tab_feed"><span><?php 
    echo htmlspecialchars(__('Feed Settings', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#feed_tab_itunes"><span><?php 
    echo htmlspecialchars(__('iTunes Settings', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#feed_tab_artwork"><span><?php 
    echo htmlspecialchars(__('Artwork', 'powerpress'));
    ?>
</span></a></li>
	<?php 
    if (in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel'))) {
        ?>
		<li><a href="#feed_tab_appearance"><span><?php 
        echo htmlspecialchars(__('Media Appearance', 'powerpress'));
        ?>
</span></a></li>
	<?php 
    }
    ?>
	<?php 
    if (in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel'))) {
        ?>
		<li><a href="#feed_tab_other"><span><?php 
        echo htmlspecialchars(__('Other Settings', 'powerpress'));
        ?>
</span></a></li> 
	<?php 
    }
    ?>
  </ul>
	
	
	<div id="feed_tab_feed" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
    if (!empty($General['advanced_mode_2'])) {
        powerpressadmin_edit_tv($FeedSettings, $feed_slug);
    }
    ?>
	</div>
	
	<div id="feed_tab_itunes" class="powerpress_tab">
		<?php 
    if ($feed_slug != 'podcast') {
        powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    }
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    ?>
	</div>
	
	<div id="feed_tab_artwork" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_artwork($FeedSettings, $General);
    ?>
	</div>
	
	<?php 
    if ($feed_slug || $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'ttid') {
        ?>
	<div id="feed_tab_appearance" class="powerpress_tab">
		<?php 
        //powerpressadmin_appearance($General);
        if ($feed_slug) {
            powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug, $FeedAttribs);
        }
        powerpress_admin_appearance_common($FeedSettings, $FeedAttribs);
        ?>
	</div>
	
	<div id="feed_tab_other" class="powerpress_tab">
		<?php 
        powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID, $FeedAttribs);
        ?>
	</div>
	<?php 
    }
    ?>
	
</div>
<div class="clear"></div>
<?php 
}
function powerpress_admin_players($type = 'audio')
{
    $General = powerpress_get_settings('powerpress_general');
    $select_player = false;
    if (isset($_GET['sp'])) {
        $select_player = true;
    } else {
        if ($type == 'video') {
            if (empty($General['video_player'])) {
                $select_player = true;
            } else {
                switch ($General['video_player']) {
                    case 'mediaelement-video':
                    case 'videojs-html5-video-player-for-wordpress':
                    case 'html5video':
                        break;
                    default:
                        $select_player = true;
                }
            }
        } else {
            if (empty($General['player'])) {
                $select_player = true;
            } else {
                switch ($General['player']) {
                    case 'mediaelement-audio':
                    case 'html5audio':
                    case 'audio-player':
                        break;
                    default:
                        $select_player = true;
                }
            }
        }
    }
    if (empty($General['player'])) {
        $General['player'] = 'mediaelement-audio';
    }
    if (empty($General['player'])) {
        $General['video_player'] = 'mediaelement-video';
    }
    if (empty($General['audio_custom_play_button'])) {
        $General['audio_custom_play_button'] = '';
    }
    $Audio = array();
    $Audio['audio-player'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/1_Pixel_Out_Flash_Player.mp3';
    $Audio['html5audio'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/html5.mp3';
    $Audio['mediaelement-audio'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_audio.mp3';
    $Video = array();
    $Video['html5video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/html5.mp4';
    $Video['videojs-html5-video-player-for-wordpress'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/videojs.mp4';
    $Video['mediaelement-video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_video.mp4';
    wp_enqueue_style('wp-color-picker');
    if ($type == 'video' && function_exists('add_videojs_header')) {
        add_videojs_header();
    }
    ?>
<link rel="stylesheet" href="<?php 
    echo powerpress_get_root_url();
    ?>
3rdparty/colorpicker/css/colorpicker.css" type="text/css" />
<script type="text/javascript" src="<?php 
    echo powerpress_get_root_url();
    ?>
3rdparty/colorpicker/js/colorpicker.js"></script>
<script type="text/javascript" src="<?php 
    echo powerpress_get_root_url();
    ?>
player.min.js"></script>
<script type="text/javascript"><!--

function rgb2hex(rgb) {
 
 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
 function hex(x) {
  hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
  return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
 }
 
 if( rgb )
	return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
 return '';
}

function UpdatePlayerPreview(name, value)
{
	if( typeof(generator) != "undefined" ) // Update the Maxi player...
	{
		generator.updateParam(name, value);
		generator.updatePlayer();
	}
	
	if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
		update_audio_player();
}
				
jQuery(document).ready(function($) {
	
	jQuery('.color_preview').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			jQuery(el).css({ 'background-color' : '#' + hex });
			jQuery(el).ColorPickerHide();
			var Id = jQuery(el).attr('id');
			Id = Id.replace(/_prev/, '');
			jQuery('#'+ Id  ).val( '#' + hex );
			UpdatePlayerPreview(Id, '#'+hex );
		},
		onBeforeShow: function () {
			jQuery(this).ColorPickerSetColor( rgb2hex( jQuery(this).css("background-color") ) );
		}
	})
	.bind('keyup', function(){
		jQuery(this).ColorPickerSetColor( rgb2hex( jQuery(this).css("background-color") ) );
	});
	
	jQuery('.color_field').bind('change', function () {
		var Id = jQuery(this).attr('id');
		jQuery('#'+ Id + '_prev'  ).css( { 'background-color' : jQuery(this).val() } );
		if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
			update_audio_player();
	});
	
	jQuery('.other_field').bind('change', function () {
		if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
			update_audio_player();
	});

});
//-->
</script>


<!-- special page styling goes here -->
<style type="text/css">
div.color_control { display: block; float:left; width: 100%; padding:  0; }
div.color_control input { display: inline; float: left; }
div.color_control div.color_picker { display: inline; float: left; margin-top: 3px; }
#player_preview { margin-bottom: 0px; height: 50px; margin-top: 8px;}
input#colorpicker-value-input {
	width: 60px;
	height: 16px;
	padding: 0;
	margin: 0;
	font-size: 12px;
	border-spacing: 0;
	border-width: 0;
}
table.html5formats {
	width: 600px;
	margin: 0;
	padding: 0;
}
table.html5formats tr {
	margin: 0;
	padding: 0;
}
table.html5formats tr th {
	font-weight: bold;
	border-bottom: 1px solid #000000;
	margin: 0;
	padding: 0 5px;
	width: 25%;
}
table.html5formats tr td {
	
	border-right: 1px solid #000000;
	border-bottom: 1px solid #000000;
	margin: 0;
	padding: 0 10px;
}
table.html5formats tr > td:first-child {
	border-left: 1px solid #000000;
}
</style>
<?php 
    // mainly 2 pages, first page selects a player, second configures the player, if there are optiosn to configure for that player. If the user is on the second page,
    // a link should be provided to select a different player.
    if ($select_player) {
        ?>
<input type="hidden" name="action" value="powerpress-select-player" />
<h2><?php 
        echo __('Blubrry PowerPress Player Options', 'powerpress');
        ?>
</h2>
<p style="margin-bottom: 0;"><?php 
        echo __('Select the media player you would like to use.', 'powerpress');
        ?>
</p>

<?php 
        if ($type == 'video') {
            if (empty($General['video_player'])) {
                $General['video_player'] = '';
            }
            ?>
<table class="form-table">
<tr valign="top">
<th scope="row">&nbsp;</th>  
<td>
	<ul>
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_mediaelement_video" value="mediaelement-video" <?php 
            if ($General['video_player'] == 'mediaelement-video') {
                echo 'checked';
            }
            ?>
 />
		<?php 
            echo __('MediaElement.js Media Player (default)', 'powerpress');
            ?>
</label>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_mediaelement_video" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<div style="max-width: 70%;">
				<div class="powerpressadmin-mejs-video">
<?php 
            echo powerpressplayer_build_mediaelementvideo($Video['mediaelement-video']);
            ?>
				</div>
			</div>
			<?php 
            powerpressplayer_mediaelement_info();
            ?>
		</li>

		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_html5video" value="html5video" <?php 
            if ($General['video_player'] == 'html5video') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('HTML5 Video Player', 'powerpress');
            ?>
  </label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_html5video" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
            <?php 
            echo powerpressplayer_build_html5video($Video['html5video']);
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 Video is an element introduced in the latest HTML specification (HTML5) for the purpose of playing videos.', 'powerpress');
            ?>
			</p>
		</li>
		
		<!-- videojs-html5-video-player-for-wordpress -->
		<li><label><input type="radio" name="VideoPlayer[video_player]" id="player_videojs_html5_video_player_for_wordpress" value="videojs-html5-video-player-for-wordpress" <?php 
            if ($General['video_player'] == 'videojs-html5-video-player-for-wordpress') {
                echo 'checked';
            }
            ?>
 <?php 
            echo function_exists('add_videojs_header') ? '' : 'disabled';
            ?>
 />
		<?php 
            echo __('VideoJS', 'powerpress');
            ?>
</label> 
		<?php 
            if (function_exists('add_videojs_header')) {
                ?>
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_videojs_html5_video_player_for_wordpress" class="activate-player"><?php 
                echo __('Activate and Configure Now', 'powerpress');
                ?>
</a></strong>
		<?php 
            }
            ?>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
            if (function_exists('add_videojs_header')) {
                echo powerpressplayer_build_videojs($Video['videojs-html5-video-player-for-wordpress']);
            }
            ?>
			</p>
<?php 
            powerpressplayer_videojs_info();
            ?>
		</li>
		
	</ul>

</td>
</tr>
</table>
<?php 
        } else {
            ?>
<table class="form-table">
<tr valign="top">
<th scope="row">&nbsp;</th>  
<td>
	<ul>

		<li><label><input type="radio" name="Player[player]" id="player_mediaelement_audio" value="mediaelement-audio" <?php 
            if ($General['player'] == 'mediaelement-audio') {
                echo 'checked';
            }
            ?>
 />
		<?php 
            echo __('MediaElement.js Media Player (default)', 'powerpress');
            ?>
</label> 
			 <strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_mediaelement_audio" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
<?php 
            echo powerpressplayer_build_mediaelementaudio($Audio['mediaelement-audio']);
            ?>
			</p>
			<?php 
            powerpressplayer_mediaelement_info();
            ?>
			<div style="margin: 30px 0;">
			<?php 
            powerpresspartner_clammr_info(false);
            ?>
			</div>
		</li>
	
		<li><label><input type="radio" name="Player[player]" id="player_html5audio" value="html5audio" <?php 
            if ($General['player'] == 'html5audio') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('HTML5 Audio Player', 'powerpress');
            ?>
  </label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_html5audio" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
			<?php 
            echo powerpressplayer_build_html5audio($Audio['html5audio']);
            ?>
			</p>
			<p>
				<?php 
            echo __('HTML5 audio is an element introduced in the latest HTML specification (HTML5) for the purpose of playing audio.', 'powerpress');
            ?>
			</p>
		</li>
				
		<li><label><input type="radio" name="Player[player]" id="player_audio_player" value="audio-player" <?php 
            if ($General['player'] == 'audio-player') {
                echo 'checked';
            }
            ?>
 /> <?php 
            echo __('1 Pixel Out Audio Player', 'powerpress');
            ?>
</label>
			<strong style="padding-top: 8px; margin-left: 20px;"><a href="#" id="activate_audio_player" class="activate-player"><?php 
            echo __('Activate and Configure Now', 'powerpress');
            ?>
</a></strong>
		</li>
		<li>
			<div class="updated fade powerpress-notice inline">
			<?php 
            echo __('NOTICE: Flash based players are no longer recommended. We highly recommend picking an HTM5 based player.', 'powerpress');
            ?>
			</div>
		</li>
		<li style="margin-left: 30px; margin-bottom:16px;">
			<p>
				<?php 
            echo powerpressplayer_build_1pxoutplayer($Audio['audio-player']);
            ?>
			</p>
			<p>
				<?php 
            echo __('1 Pixel Out Audio Player is a popular customizable audio (mp3 only) flash player. Features include an animated play/pause button, scroll-able position bar, elapsed/remaining time, volume control and color styling options.', 'powerpress');
            ?>
			</p>
		</li>
		
	</ul>

</td>
</tr>
</table>
<?php 
        }
        ?>
<h4 style="margin-bottom: 0;"><?php 
        echo __('Click \'Save Changes\' to activate and configure selected player.', 'powerpress');
        ?>
</h4>
<?php 
    } else {
        ?>
<h2><?php 
        echo __('Configure Player', 'powerpress');
        ?>
</h2>
<?php 
        if ($type == 'audio') {
            ?>
<p style="margin-bottom: 20px;"><strong>&#8592;  <a href="<?php 
            echo admin_url("admin.php?page=powerpress/powerpressadmin_player.php&amp;sp=1");
            ?>
"><?php 
            echo __('Select a different audio player', 'powerpress');
            ?>
</a></strong></p>
<?php 
        } else {
            if ($type == 'video') {
                ?>
<p style="margin-bottom: 20px;"><strong>&#8592;  <a href="<?php 
                echo admin_url("admin.php?page=powerpress/powerpressadmin_videoplayer.php&amp;sp=1");
                ?>
"><?php 
                echo __('Select a different video player', 'powerpress');
                ?>
</a></strong></p>
<?php 
            } else {
                ?>
<p style="margin-bottom: 20px;"><strong>&#8592;  <a href="<?php 
                echo admin_url("admin.php?page=powerpress/powerpressadmin_mobileplayer.php&amp;sp=1");
                ?>
"><?php 
                echo __('Select a different mobile player', 'powerpress');
                ?>
</a></strong></p>
<?php 
            }
        }
        // Start adding logic here to display options based on the player selected...
        if ($type == 'audio') {
            if (empty($General['player'])) {
                $General['player'] = '';
            }
            switch ($General['player']) {
                case 'audio-player':
                    $PlayerSettings = powerpress_get_settings('powerpress_audio-player');
                    if ($PlayerSettings == "") {
                        $PlayerSettings = array('width' => '290', 'transparentpagebg' => 'yes', 'lefticon' => '#333333', 'leftbg' => '#CCCCCC', 'bg' => '#E5E5E5', 'voltrack' => '#F2F2F2', 'volslider' => '#666666', 'rightbg' => '#B4B4B4', 'rightbghover' => '#999999', 'righticon' => '#333333', 'righticonhover' => '#FFFFFF', 'loader' => '#009900', 'track' => '#FFFFFF', 'tracker' => '#DDDDDD', 'border' => '#CCCCCC', 'skip' => '#666666', 'text' => '#333333', 'pagebg' => '', 'rtl' => 'no', 'initialvolume' => '60', 'animation' => 'yes', 'remaining' => 'no');
                    }
                    if (empty($PlayerSettings['remaining'])) {
                        $PlayerSettings['remaining'] = 'no';
                    }
                    // New default setting
                    if (!isset($PlayerSettings['buffer'])) {
                        $PlayerSettings['buffer'] = '';
                    }
                    // New default setting
                    if (!isset($PlayerSettings['titles'])) {
                        $PlayerSettings['titles'] = '';
                    }
                    ?>
<script type="text/javascript"><!--

function update_audio_player()
{
	var myParams = new Array("lefticon","leftbg", "bg", "voltrack", "rightbg", "rightbghover", "righticon", "righticonhover", "loader", "track", "tracker", "border", "skip", "text", "pagebg", "rtl", "animation", "titles", "initialvolume");
	var myWidth = document.getElementById('player_width').value;
	var myBackground = '';
	if( myWidth < 10 || myWidth > 900 )
		myWidth = 290;
	
	var out = '<object type="application/x-shockwave-flash" data="<?php 
                    echo powerpress_get_root_url();
                    ?>
audio-player.swf" width="'+myWidth+'" height="24">'+"\n";
	out += '    <param name="movie" value="<?php 
                    echo powerpress_get_root_url();
                    ?>
audio-player.swf" />'+"\n";
	out += '    <param name="FlashVars" value="playerID=1&amp;soundFile=<?php 
                    echo $Audio['audio-player'];
                    ?>
';
	
	var x = 0;
	for( x = 0; x < myParams.length; x++ )
	{
		if( myParams[ x ] == 'border' )
			var Element = document.getElementById( 'player_border' );
		else
			var Element = document.getElementById( myParams[ x ] );
		
		if( Element )
		{
			if( Element.value != '' )
			{
				out += '&amp;';
				out += myParams[ x ];
				out += '=';
				out += Element.value.replace(/^#/, '');
				if( myParams[ x ] == 'pagebg' )
				{
					myBackground = '<param name="bgcolor" value="'+ Element.value +'" />';
					out += '&amp;transparentpagebg=no';
				}
			}
			else
			{
				if( myParams[ x ] == 'pagebg' )
				{
					out += '&amp;transparentpagebg=yes';
					myBackground = '<param name="wmode" value="transparent" />';
				}
			}
		}
	}
	
	out += '" />'+"\n";
	out += '<param name="quality" value="high" />';
	out += '<param name="menu" value="false" />';
	out += myBackground;
	out += '</object>';
	
	var player = document.getElementById("player_preview");
	player.innerHTML = out;
}

function audio_player_defaults()
{
 	if( confirm('<?php 
                    echo __("Set defaults, are you sure?\\n\\nAll of the current settings will be overwritten!", 'powerpress');
                    ?>
') )
	{
		jQuery('#player_width').val('290');
		UpdatePlayerPreview('player_width',jQuery('#player_width').val() );
		
		jQuery('#transparentpagebg').val( 'yes');
		UpdatePlayerPreview('transparentpagebg',jQuery('#transparentpagebg').val() );
		
		jQuery('#lefticon').val( '#333333');
		UpdatePlayerPreview('lefticon',jQuery('#lefticon').val() );
		jQuery('#lefticon_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#leftbg').val( '#CCCCCC');
		UpdatePlayerPreview('leftbg',jQuery('#leftbg').val() );
		jQuery('#leftbg_prev'  ).css( { 'background-color' : '#CCCCCC' } );
		
		jQuery('#bg').val( '#E5E5E5');
		UpdatePlayerPreview('bg',jQuery('#bg').val() );
		jQuery('#bg_prev'  ).css( { 'background-color' : '#E5E5E5' } );
		
		jQuery('#voltrack').val( '#F2F2F2');
		UpdatePlayerPreview('voltrack',jQuery('#voltrack').val() );
		jQuery('#voltrack_prev'  ).css( { 'background-color' : '#F2F2F2' } );
		
		jQuery('#volslider').val( '#666666');
		UpdatePlayerPreview('volslider',jQuery('#volslider').val() );
		jQuery('#volslider_prev'  ).css( { 'background-color' : '#666666' } );
		
		jQuery('#rightbg').val( '#B4B4B4');
		UpdatePlayerPreview('rightbg',jQuery('#rightbg').val() );
		jQuery('#rightbg_prev'  ).css( { 'background-color' : '#B4B4B4' } );
		
		jQuery('#rightbghover').val( '#999999');
		UpdatePlayerPreview('rightbghover',jQuery('#rightbghover').val() );
		jQuery('#rightbghover_prev'  ).css( { 'background-color' : '#999999' } );
		
		jQuery('#righticon').val( '#333333');
		UpdatePlayerPreview('righticon',jQuery('#righticon').val() );
		jQuery('#righticon_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#righticonhover').val( '#FFFFFF');
		UpdatePlayerPreview('righticonhover',jQuery('#righticonhover').val() );
		jQuery('#righticonhover_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#loader').val( '#009900');
		UpdatePlayerPreview('loader',jQuery('#loader').val() );
		jQuery('#loader_prev'  ).css( { 'background-color' : '#009900' } );
		
		jQuery('#track').val( '#FFFFFF');
		UpdatePlayerPreview('track',jQuery('#track').val() );
		jQuery('#track_prev'  ).css( { 'background-color' : '#FFFFFF' } );
		
		jQuery('#tracker').val( '#DDDDDD');
		UpdatePlayerPreview('tracker',jQuery('#tracker').val() );
		jQuery('#tracker_prev'  ).css( { 'background-color' : '#DDDDDD' } );
		
		jQuery('#player_border').val( '#CCCCCC');
		UpdatePlayerPreview('player_border',jQuery('#player_border').val() );
		jQuery('#player_border_prev'  ).css( { 'background-color' : '#CCCCCC' } );
		
		jQuery('#skip').val( '#666666');
		UpdatePlayerPreview('skip',jQuery('#skip').val() );
		jQuery('#skip_prev'  ).css( { 'background-color' : '#666666' } );
		
		jQuery('#text').val( '#333333');
		UpdatePlayerPreview('text',jQuery('#text').val() );
		jQuery('#text_prev'  ).css( { 'background-color' : '#333333' } );
		
		jQuery('#pagebg').val( '');
		UpdatePlayerPreview('pagebg',jQuery('#pagebg').val() );
		
		jQuery('#animation').val( 'yes');
		UpdatePlayerPreview('animation',jQuery('#animation').val() );
		
		jQuery('#remaining').val( 'no');
		UpdatePlayerPreview('remaining',jQuery('#remaining').val() );
		
		jQuery('#buffer').val( '');
		UpdatePlayerPreview('buffer',jQuery('#buffer').val() );
		
		jQuery('#rtl' ).val( 'no' );
		UpdatePlayerPreview('rtl',jQuery('#rtl').val() );
		
		jQuery('#initialvolume').val('60');
		UpdatePlayerPreview('initialvolume',jQuery('#initialvolume').val() );
		
		update_audio_player();
	}
}
//-->
</script>
	<input type="hidden" name="action" value="powerpress-audio-player" />
	<div class="updated fade powerpress-notice inline">
		<?php 
                    echo __('NOTICE: Flash based players are no longer recommended. We highly recommend picking an HTM5 based player.', 'powerpress');
                    ?>
	</div>
	<?php 
                    echo __('Configure the 1 pixel out Audio Player', 'powerpress');
                    ?>
	
	
<table class="form-table">
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
		</th>
		<td><div id="player_preview">
		<?php 
                    echo powerpressplayer_build_1pxoutplayer($Audio['audio-player'], array('nodiv' => true));
                    ?>
			</div>
		</td>
	</tr>
</table>

<div id="powerpress_settings_page" class="powerpress_tabbed_content" style="position: relative;">
	<div style="position: absolute; top: 6px; right:0px;">
		<a href="#" onclick="audio_player_defaults();return false;"><?php 
                    echo __('Set Defaults', 'powerpress');
                    ?>
</a>
	</div>
  <ul class="powerpress_settings_tabs"> 
		<li><a href="#tab_general"><span><?php 
                    echo __('Basic Settings', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_progress"><span><?php 
                    echo __('Progress Bar', 'powerpress');
                    ?>
</span></a></li> 
		<li><a href="#tab_volume"><span><?php 
                    echo __('Volume Button', 'powerpress');
                    ?>
</span></a></li>
		<li><a href="#tab_play"><span><?php 
                    echo __('Play / Pause Button', 'powerpress');
                    ?>
</span></a></li>
  </ul>
	
 <div id="tab_general" class="powerpress_tab">
 <h3><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h3>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Page Background Color', 'powerpress');
                    ?>
                        
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="pagebg" name="Player[pagebg]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['pagebg']);
                    ?>
" maxlength="20" />
				<img id="pagebg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['pagebg'];
                    ?>
;" class="color_preview" />
			</div>
			<small>(<?php 
                    echo __('leave blank for transparent', 'powerpress');
                    ?>
)</small>
		</td>
	</tr>	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Player Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="bg" name="Player[bg]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['bg']);
                    ?>
" maxlength="20" />
				<img id="bg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['bg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Width (in pixels)', 'powerpress');
                    ?>
		</th>
		<td>
          <input type="text" style="width: 50px;" id="player_width" name="Player[width]" class="other_field" value="<?php 
                    echo esc_attr($PlayerSettings['width']);
                    ?>
" maxlength="20" />
				<?php 
                    echo __('width of the player. e.g. 290 (290 pixels) or 100%', 'powerpress');
                    ?>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Right-to-Left', 'powerpress');
                    ?>
		</th>
		<td>
			<select style="width: 102px;" id="rtl" name="Player[rtl]" class="other_field"> 
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['rtl']);
                    ?>
          </select>			<?php 
                    echo __('switches the layout to animate from the right to the left', 'powerpress');
                    ?>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Loading Bar Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="loader" name="Player[loader]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['loader']);
                    ?>
" maxlength="20" />
				<img id="loader_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['loader'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Text Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                <input type="text" style="width: 100px;" id="text" name="Player[text]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['text']);
                    ?>
" maxlength="20" />
						<img id="text_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['text'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Text In Player', 'powerpress');
                    ?>
 
		</th>
		<td>
          <div><input type="text" style="width: 60%;" id="titles" name="Player[titles]" class="other_field" value="<?php 
                    echo esc_attr($PlayerSettings['titles']);
                    ?>
" maxlength="100" /></div>
				<small><?php 
                    echo sprintf(__('Enter \'%s\' to display track name from mp3. Only works if media is hosted on same server as blog.', 'powerpress'), __('TRACK', 'powerpress'));
                    ?>
</small>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play Animation', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
<select style="width: 102px;" id="animation" name="Player[animation]" class="other_field"> 
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['animation']);
                    ?>
                                </select>			<?php 
                    echo __('if no, player is always open', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Display Remaining Time', 'powerpress');
                    ?>
 
		</th>
		<td>
			<div class="color_control">
<select style="width: 102px;" id="remaining" name="Player[remaining]" class="other_field">
<?php 
                    $options = array('yes' => __('Yes', 'powerpress'), 'no' => __('No', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['remaining']);
                    ?>
                                </select>			<?php 
                    echo __('if yes, shows remaining track time rather than elapsed time (default: no)', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Buffering Time', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
<select style="width: 200px;" id="buffer" name="Player[buffer]" class="other_field"> 
<?php 
                    $options = array('0' => __('No buffering', 'powerpress'), '' => __('Default (5 seconds)', 'powerpress'), '10' => __('10 seconds', 'powerpress'), '15' => __('15 seconds', 'powerpress'), '20' => __('20 seconds', 'powerpress'), '30' => __('30 seconds', 'powerpress'), '60' => __('60 seconds', 'powerpress'));
                    powerpress_print_options($options, $PlayerSettings['buffer']);
                    ?>
                                </select>		<?php 
                    echo __('buffering time in seconds', 'powerpress');
                    ?>
</div>
		</td>
	</tr>
	
	
</table>
</div>

 <div id="tab_progress" class="powerpress_tab">
	<h3><?php 
                    echo __('Progress Bar', 'powerpress');
                    ?>
</h3>
<table class="form-table">
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Background', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
										<input type="text" style="width: 100px;" id="track" name="Player[track]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['track']);
                    ?>
" maxlength="20" />
										<img id="track_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['track'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                            <input type="text" style="width: 100px;" id="tracker" name="Player[tracker]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['tracker']);
                    ?>
" maxlength="20" />
											<img id="tracker_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['tracker'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Progress Bar Border', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
                            <input type="text" style="width: 100px;" id="player_border" name="Player[border]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['border']);
                    ?>
" maxlength="20" />
											<img id="player_border_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['border'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>       
	</table>
	</div>
	
	
<div id="tab_volume" class="powerpress_tab">
	<h3><?php 
                    echo __('Volume Button Settings', 'powerpress');
                    ?>
</h3>
	<table class="form-table">	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Initial Volume', 'powerpress');
                    ?>
 
		</th>
		<td>
			<select style="width: 100px;" id="initialvolume" name="Player[initialvolume]" class="other_field">
<?php 
                    for ($x = 0; $x <= 100; $x += 5) {
                        echo '<option value="' . $x . '"' . ($PlayerSettings['initialvolume'] == $x ? ' selected' : '') . '>' . $x . '%</option>';
                    }
                    ?>
			</select> <?php 
                    echo __('initial volume level (default: 60)', 'powerpress');
                    ?>
		</td>
	</tr>
				
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volumn Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="leftbg" name="Player[leftbg]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['leftbg']);
                    ?>
" maxlength="20" />
				<img id="leftbg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['leftbg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Speaker Icon Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="lefticon" name="Player[lefticon]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['lefticon']);
                    ?>
" maxlength="20" />
				<img id="lefticon_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['lefticon'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Icon Background', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="voltrack" name="Player[voltrack]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['voltrack']);
                    ?>
" maxlength="20" />
				<img id="voltrack_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['voltrack'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Volume Slider Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="volslider" name="Player[volslider]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['volslider']);
                    ?>
" maxlength="20" />
				<img id="volslider_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['volslider'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
</table>
</div>

<div id="tab_play" class="powerpress_tab">
	<h3><?php 
                    echo __('Play / Pause Button Settings', 'powerpress');
                    ?>
</h3>
	<table class="form-table">	
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Background Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="rightbg" name="Player[rightbg]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['rightbg']);
                    ?>
" maxlength="20" />
				<img id="rightbg_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['rightbg'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Hover Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="rightbghover" name="Player[rightbghover]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['rightbghover']);
                    ?>
" maxlength="20" />
				<img id="rightbghover_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['rightbghover'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Icon Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="righticon" name="Player[righticon]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['righticon']);
                    ?>
" maxlength="20" />
				<img id="righticon_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['righticon'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Play/Pause Icon Hover Color', 'powerpress');
                    ?>
		</th>
		<td>
			<div class="color_control">
				<input type="text" style="width: 100px;" id="righticonhover" name="Player[righticonhover]" class="color_field" value="<?php 
                    echo esc_attr($PlayerSettings['righticonhover']);
                    ?>
" maxlength="20" />
				<img id="righticonhover_prev" src="<?php 
                    echo powerpress_get_root_url();
                    ?>
images/color_preview.gif" width="14" height="14" style="background-color: <?php 
                    echo $PlayerSettings['righticonhover'];
                    ?>
;" class="color_preview" />
			</div>
		</td>
	</tr>

</table>
</div> <!-- end tab -->
</div> <!-- end tab wrapper -->

<?php 
                    break;
                case 'html5audio':
                    $SupportUploads = powerpressadmin_support_uploads();
                    ?>
<p><?php 
                    echo __('Configure HTML5 Audio Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
 
		</th>
		<td>
			<p>
<?php 
                    echo powerpressplayer_build_html5audio($Audio['html5audio']);
                    ?>
			</p>
		</td>
	</tr>

	
	<tr>
	<th scope="row">
	<?php 
                    echo __('Play Icon', 'powerpress');
                    ?>
</th>
	<td>

	<input type="text" id="audio_custom_play_button" name="General[audio_custom_play_button]" style="width: 60%;" value="<?php 
                    echo esc_attr($General['audio_custom_play_button']);
                    ?>
" maxlength="255" />
	<a href="#" onclick="javascript: window.open( document.getElementById('audio_custom_play_button').value ); return false;"><?php 
                    echo __('preview', 'powerpress');
                    ?>
</a>

	<p><?php 
                    echo __('Place the URL to the play icon above.', 'powerpress');
                    ?>
 <?php 
                    echo __('Example', 'powerpress');
                    ?>
: http://example.com/images/audio_play_icon.jpg<br /><br />
	<?php 
                    echo __('Leave blank to use default play icon image.', 'powerpress');
                    ?>
</p>

	<?php 
                    if ($SupportUploads) {
                        ?>
	<p><input name="audio_custom_play_button_checkbox" type="checkbox" onchange="powerpress_show_field('audio_custom_play_button_upload', this.checked)" value="1" /> <?php 
                        echo __('Upload new image', 'powerpress');
                        ?>
 </p>
	<div style="display:none" id="audio_custom_play_button_upload">
		<label for="audio_custom_play_button_file"><?php 
                        echo __('Choose file', 'powerpress');
                        ?>
:</label><input type="file" name="audio_custom_play_button_file"  />
	</div>
	<?php 
                    }
                    ?>
	</td>
	</tr>
</table>

<?php 
                    break;
                case 'mediaelement-audio':
                    $SupportUploads = powerpressadmin_support_uploads();
                    if (!isset($General['audio_player_max_width'])) {
                        $General['audio_player_max_width'] = '';
                    }
                    ?>
<p><?php 
                    echo __('Configure MediaElement.js Audio Player', 'powerpress');
                    ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Preview of Player', 'powerpress');
                    ?>
		</th>
		<td><p>
		<?php 
                    // TODO
                    echo powerpressplayer_build_mediaelementaudio($Audio['mediaelement-audio']);
                    ?>
			</p>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Max Width', 'powerpress');
                    ?>
   
		</th>
		<td valign="top">
				<input type="text" style="width: 50px;" id="audio_player_max_width" name="General[audio_player_max_width]" class="player-width" value="<?php 
                    echo esc_attr($General['audio_player_max_width']);
                    ?>
" maxlength="4" />
			<?php 
                    echo __('Width of Audio mp3 player (leave blank for max width)', 'powerpress');
                    ?>
			<?php 
                    powerpresspartner_clammr_info();
                    ?>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row">
			&nbsp;
		</th>
		<td>
			<p><?php 
                    echo __('MediaElement.js Player has no additional settings at this time.', 'powerpress');
                    ?>
</p>
		</td>
	</tr>
</table>  

<?php 
                    break;
                    // TODO:
                // TODO:
                default:
                    if (empty($General['player_width_audio'])) {
                        $General['player_width_audio'] = '';
                    }
                    ?>

<h2><?php 
                    echo __('General Settings', 'powerpress');
                    ?>
</h2>
	<table class="form-table">
        <tr valign="top">
		<th scope="row">
			<?php 
                    echo __('Width', 'powerpress');
                    ?>
   
		</th>
		<td valign="top">
				<input type="text" style="width: 50px;" id="player_width" name="General[player_width_audio]" class="player-width" value="<?php 
                    echo esc_attr($General['player_width_audio']);
                    ?>
" maxlength="4" />
			<?php 
                    echo __('Width of Audio mp3 player (leave blank for 320 default)', 'powerpress');
                    ?>
		</td>
	</tr>
</table>
<?php 
                    break;
            }
        } else {
            if ($type == 'video') {
                $player_to_configure = !empty($General['video_player']) ? $General['video_player'] : '';
                switch ($player_to_configure) {
                    case 'html5':
                    case 'html5video':
                        echo '<p>' . __('Configure HTML5 Video Player', 'powerpress') . '</p>';
                        ?>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                        echo __('Preview of Player', 'powerpress');
                        ?>
 
		</th>
		<td>
		<?php 
                        if ($type == 'mobile') {
                            echo '<p>' . __('Audio:', 'powerpress') . ' ';
                            echo powerpressplayer_build_html5audio($Audio['html5audio']);
                            echo '</p>';
                        }
                        ?>
			<p>
<?php 
                        if ($type == 'mobile') {
                            echo __('Video:', 'powerpress') . ' ';
                        }
                        echo powerpressplayer_build_html5video($Video['html5video']);
                        ?>
			</p>
		</td>
	</tr>
</table>

					<?php 
                        break;
                    case 'videojs-html5-video-player-for-wordpress':
                        ?>
					<p><?php 
                        echo __('Configure VideoJS', 'powerpress');
                        ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                        echo __('Preview of Player', 'powerpress');
                        ?>
 
		</th>
		<td>
			<p>
<?php 
                        echo powerpressplayer_build_videojs($Video['videojs-html5-video-player-for-wordpress']);
                        ?>
			</p>
		</td>
	</tr>
</table>
<h3><?php 
                        echo __('VideoJS Settings', 'powerpress');
                        ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
                        echo __('VideoJS CSS Class', 'powerpress');
                        ?>
</th>
<td>
<p>
<input type="text" name="General[videojs_css_class]" style="width: 150px;" value="<?php 
                        echo empty($General['videojs_css_class']) ? '' : esc_attr($General['videojs_css_class']);
                        ?>
" /> 
<?php 
                        echo __('Apply specific CSS styling to your Video JS player.', 'powerpress');
                        ?>
</p>
</td>
</tr>
</table>
					<?php 
                        break;
                    case 'mejs':
                        // $player_to_configure
                    // $player_to_configure
                    case 'mediaelement-video':
                    default:
                        ?>
					<p><?php 
                        echo __('Configure MediaElement.js Player', 'powerpress');
                        ?>
</p>
<table class="form-table">
	<tr valign="top">
		<th scope="row">
			<?php 
                        echo __('Preview of Player', 'powerpress');
                        ?>
 
		</th>
		<td>
			<p>
			<?php 
                        if ($type == 'mobile') {
                            echo '<p>' . __('Audio:', 'powerpress') . ' ';
                            echo powerpressplayer_build_mediaelementaudio($Audio['mediaelement-audio']);
                            echo '</p>';
                        }
                        ?>
			</p>
			<div style="max-width: 70%;">
				<div class="powerpressadmin-mejs-video">
<?php 
                        if ($type == 'mobile') {
                            echo __('Video:', 'powerpress') . ' ';
                        }
                        echo powerpressplayer_build_mediaelementvideo($Video['mediaelement-video']);
                        ?>
				</div>
			</div>
		</td>
	</tr>
</table>

					<?php 
                        break;
                }
                if (!isset($General['poster_play_image'])) {
                    $General['poster_play_image'] = 1;
                }
                if (!isset($General['poster_image_audio'])) {
                    $General['poster_image_audio'] = 0;
                }
                if (!isset($General['player_width'])) {
                    $General['player_width'] = '';
                }
                if (!isset($General['player_height'])) {
                    $General['player_height'] = '';
                }
                if (!isset($General['poster_image'])) {
                    $General['poster_image'] = '';
                }
                if (!isset($General['video_player_max_width'])) {
                    $General['video_player_max_width'] = '';
                }
                if (!isset($General['video_player_max_height'])) {
                    $General['video_player_max_height'] = '';
                }
                if (!isset($General['video_custom_play_button'])) {
                    $General['video_custom_play_button'] = '';
                }
                ?>
<!-- Global Video Player settings (Appy to all video players -->
<input type="hidden" name="action" value="powerpress-save-videocommon" />
<h3><?php 
                echo __('Common Video Settings', 'powerpress');
                ?>
</h3>

<p><?php 
                echo __('The following video settings apply to the video player above as well as to classic video &lt;embed&gt; formats such as Microsoft Windows Media (.wmv), QuickTime (.mov) and RealPlayer.', 'powerpress');
                ?>
</p>
<table class="form-table">
<?php 
                if ($player_to_configure == 'mediaelement-video' || $player_to_configure == 'mejs') {
                    ?>
<tr valign="top">
<th scope="row">
<?php 
                    echo __('Player Width', 'powerpress');
                    ?>
</th>
<td>
<input type="text" name="General[player_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
                    echo esc_attr($General['player_width']);
                    ?>
" maxlength="4" />
<?php 
                    echo __('Width of player (leave blank for default width)', 'powerpress');
                    ?>
</td>
</tr>

<tr valign="top">
<th scope="row">
<?php 
                    echo __('Player Height', 'powerpress');
                    ?>
</th>
<td>
<input type="text" name="General[player_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
                    echo esc_attr($General['player_height']);
                    ?>
" maxlength="4" />
<?php 
                    echo __('Height of player (leave blank for default height)', 'powerpress');
                    ?>
</td>
</tr>
<?php 
                } else {
                    ?>
<tr valign="top">
<th scope="row">
<?php 
                    echo __('Player Width', 'powerpress');
                    ?>
</th>
<td>
<input type="text" name="General[player_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
                    echo esc_attr($General['player_width']);
                    ?>
" maxlength="4" />
<?php 
                    echo __('Width of player (leave blank for 400 default)', 'powerpress');
                    ?>
</td>
</tr>

<tr valign="top">
<th scope="row">
<?php 
                    echo __('Player Height', 'powerpress');
                    ?>
</th>
<td>
<input type="text" name="General[player_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9%]/g, '');" value="<?php 
                    echo esc_attr($General['player_height']);
                    ?>
" maxlength="4" />
<?php 
                    echo __('Height of player (leave blank for 225 default)', 'powerpress');
                    ?>
</td>
</tr>
<?php 
                }
                $SupportUploads = powerpressadmin_support_uploads();
                ?>
<tr>
<th scope="row">
<?php 
                echo __('Default Poster Image', 'powerpress');
                ?>
</th>
<td>

<input type="text" id="poster_image" name="General[poster_image]" style="width: 60%;" value="<?php 
                echo esc_attr($General['poster_image']);
                ?>
" maxlength="255" />
<a href="#" onclick="javascript: window.open( document.getElementById('poster_image').value ); return false;"><?php 
                echo __('preview', 'powerpress');
                ?>
</a>

<p><?php 
                echo __('Place the URL to the poster image above.', 'powerpress');
                ?>
 <?php 
                echo __('Example', 'powerpress');
                ?>
: http://example.com/images/poster.jpg<br /><br />
<?php 
                echo __('Image should be at minimum the same width/height as the player above. Leave blank to use default black background image.', 'powerpress');
                ?>
</p>

<?php 
                if ($SupportUploads) {
                    ?>
<p><input name="poster_image_checkbox" type="checkbox" onchange="powerpress_show_field('poster_image_upload', this.checked)" value="1" /> <?php 
                    echo __('Upload new image', 'powerpress');
                    ?>
 </p>
<div style="display:none" id="poster_image_upload">
	<label for="poster_image_file"><?php 
                    echo __('Choose file', 'powerpress');
                    ?>
:</label><input type="file" name="poster_image_file"  />
</div>
<?php 
                }
                if (in_array($General['video_player'], array('html5video'))) {
                    ?>
<p><input name="General[poster_play_image]" type="checkbox" value="1" <?php 
                    echo $General['poster_play_image'] ? 'checked' : '';
                    ?>
 /> <?php 
                    echo __('Include play icon over poster image when applicable', 'powerpress');
                    ?>
 </p>
	<?php 
                    if ($type == 'video') {
                        ?>
<p><input name="General[poster_image_audio]" type="checkbox" value="1" <?php 
                        echo $General['poster_image_audio'] ? 'checked' : '';
                        ?>
 /> <?php 
                        echo __('Use poster image, player width and height above for audio (Flow Player only)', 'powerpress');
                        ?>
 </p>
	<?php 
                    }
                }
                ?>
</td>
</tr>

<?php 
                // Play icon, only applicable to HTML5/FlowPlayerClassic
                if (in_array($General['video_player'], array('html5video'))) {
                    ?>
<tr>
<th scope="row">
<?php 
                    echo __('Video Play Icon', 'powerpress');
                    ?>
</th>
<td>

<input type="text" id="video_custom_play_button" name="General[video_custom_play_button]" style="width: 60%;" value="<?php 
                    echo esc_attr($General['video_custom_play_button']);
                    ?>
" maxlength="255" />
<a href="#" onclick="javascript: window.open( document.getElementById('video_custom_play_button').value ); return false;"><?php 
                    echo __('preview', 'powerpress');
                    ?>
</a>

<p><?php 
                    echo __('Place the URL to the play icon above.', 'powerpress');
                    ?>
 <?php 
                    echo __('Example', 'powerpress');
                    ?>
: http://example.com/images/video_play_icon.jpg<br /><br />
<?php 
                    echo __('Image should 60 pixels by 60 pixels. Leave blank to use default play icon image.', 'powerpress');
                    ?>
</p>

<?php 
                    if ($SupportUploads) {
                        ?>
<p><input name="video_custom_play_button_checkbox" type="checkbox" onchange="powerpress_show_field('video_custom_play_button_upload', this.checked)" value="1" /> <?php 
                        echo __('Upload new image', 'powerpress');
                        ?>
 </p>
<div style="display:none" id="video_custom_play_button_upload">
	<label for="video_custom_play_button_file"><?php 
                        echo __('Choose file', 'powerpress');
                        ?>
:</label><input type="file" name="video_custom_play_button_file"  />
</div>
<?php 
                    }
                    ?>
</td>
</tr>
<?php 
                }
                ?>
</table>
<?php 
            }
        }
        ?>

<?php 
    }
}
Esempio n. 7
0
function powerpress_admin_mt()
{
    $results = powerpress_get_mt_episodes();
    $Settings = powerpress_get_settings('powerpress_general', false);
    if (!isset($Settings['custom_feeds']['podcast']) && !empty($Settings['custom_feeds'])) {
        $Settings['custom_feeds'] = array_merge(array('podcast' => __('Podcast Feed (default)', 'powerpress')), $Settings['custom_feeds']);
    } else {
        if (empty($Settings['custom_feeds'])) {
            $Settings['custom_feeds'] = array('podcast' => __('Podcast Feed (default)', 'powerpress'));
        }
    }
    if ($results) {
        if ($results['feeds_required'] > count($Settings['custom_feeds'])) {
            powerpress_page_message_add_error(sprintf(__('We found blog posts that have as many as %d media files. You may need to create %d more Custom Feeds in order to import all of the media.', 'powerpress'), $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds'])));
            powerpress_page_message_print();
        }
    }
    powerpressadmin_mt_import_print_log();
    ?>
<style type="text/css">
.column-exclude {
	width: 80px;
}
.column-post-date {
	width: 80px;
}
.error-mt {
	background-color: #ffebe8;
	border-color: #c00;
	border-width: 1px;
	border-style: solid;
	padding: 0 0.6em;
	margin: 5px 15px 2px;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}
label {
	float: left;
	width: 160px;
}
</style>
<script language="javascript"><!--

function check_radio_selection(obj, PostID, FileIndex)
{
	if( obj.value == '' ) // Users can select the no feed option as much as they want
		return true;
	
	var Field = obj.id;
	while( Field.charAt( Field.length-1 ) >= "0" &&  Field.charAt( Field.length-1 ) <= "9" ) // ( chr < "0" ) || ( chr > "9" )
	{
		Field = Field.substring(0, Field.length-1);
	}
	
	var Pos = 0;
	var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
	while( CheckObj )
	{
		if( CheckObj.length == 0 )
			break;
			
		if( Pos != FileIndex )
		{
			for (var i = 0; i < CheckObj.length; i++)
			{
				if (CheckObj[i].type == 'radio' && CheckObj[i].checked && CheckObj[i].value == obj.value )
				{
					alert("<?php 
    echo __('Sorry, you may only select one media file per post per feed.', 'powerpress');
    ?>
");
					return false;
				}
			}
		}
		Pos++;
		var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
	}
	
	return true;
}

function no_import_all()
{
	if( !confirm('<?php 
    echo __('Select "No Import" option for all media files?', 'powerpress');
    ?>
') )
		return;
		
	var Inputs = document.getElementsByTagName('input');
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == '' )
			Elem.checked = true;
	}
}

function select_all(index,value)
{
	var NoImport = [];
	var Inputs = document.getElementsByTagName('input');
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == value )
		{
			ElemIndex = Elem.id.substring( Elem.id.lastIndexOf('_')+1);
			if( ElemIndex == index )
				Elem.checked = true;
			else if( Elem.checked && Elem.value != '' )
				NoImport.push( Elem.id );
		}
	}
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == '' )
		{
			for (var j = 0; j < NoImport.length; j++)
			{
				if( NoImport[j] == Elem.id )
					Elem.checked = true;
			}
		}
	}
}
//-->
</script>
<h2><?php 
    echo __('Import Episodes', 'powerpress');
    ?>
</h2>
<?php 
    if (count($results) == 0 || count($results) == 1) {
        ?>
	
	<p><?php 
        echo __('No episodes found to import.', 'powerpress');
        ?>
</p>
<?php 
    } else {
        ?>
<input type="hidden" name="action" value="powerpress-importmt" />
<p><?php 
        echo __('Select the media file under each feed for each episode you wish to import.', 'powerpress');
        ?>
</p>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
        print_column_headers('powerpressadmin_importmt');
        ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
        print_column_headers('powerpressadmin_importmt', false);
        ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
        $StrandedEpisodes = 0;
        $ImportableEpisodes = 0;
        $MaxFileIndex = 1;
        $count = 0;
        while (list($post_id, $import_data) = each($results)) {
            $edit_link = get_edit_post_link($post_id);
            if ($post_id == 'feeds_required') {
                continue;
            }
            $columns = powerpressadmin_importmt_columns();
            $CurrentEnclosures = array();
            if (is_array($Settings['custom_feeds'])) {
                while (list($feed_slug, $value) = each($Settings['custom_feeds'])) {
                    if ($feed_slug == 'podcast') {
                        $enclosure_data = get_post_meta($post_id, 'enclosure', true);
                    } else {
                        $enclosure_data = get_post_meta($post_id, '_' . $feed_slug . ':enclosure', true);
                    }
                    if (!$enclosure_data) {
                        continue;
                    }
                    @(list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = @explode("\n", $enclosure_data));
                    if ($EnclosureURL) {
                        $CurrentEnclosures[$feed_slug] = array();
                        $CurrentEnclosures[$feed_slug]['url'] = trim($EnclosureURL);
                        $CurrentEnclosures[$feed_slug]['imported'] = false;
                    }
                    $found = false;
                    while (list($episode_index, $episode_data) = each($import_data['enclosures'])) {
                        if ($episode_data['url'] == $CurrentEnclosures[$feed_slug]['url']) {
                            $import_data['enclosures'][$episode_index]['imported'] = true;
                            $CurrentEnclosures[$feed_slug]['imported'] = true;
                            $found = true;
                            break;
                        }
                    }
                    reset($import_data['enclosures']);
                    if ($found == false) {
                        // Add it to the media file list, prepend it...
                        $is_enclosure_data = array();
                        $is_enclosure_data['url'] = $CurrentEnclosures[$feed_slug]['url'];
                        $is_enclosure_data['imported'] = true;
                        array_push($import_data['enclosures'], $is_enclosure_data);
                        $CurrentEnclosures[$feed_slug]['imported'] = true;
                        $CurrentEnclosures[$feed_slug]['present'] = true;
                    }
                }
                reset($Settings['custom_feeds']);
            }
            $feed_title = '';
            if ($feed_slug == 'podcast') {
                $feed_title = __('Podcast Feed (default)', 'powerpress');
            }
            $feed_title = esc_html($feed_title);
            if ($count % 2 == 0) {
                echo '<tr valign="middle" class="alternate">';
            } else {
                echo '<tr valign="middle">';
            }
            $CheckedEpisodes = array();
            // key = file_index, value = feed-slug
            $feed_index = 0;
            foreach ($columns as $column_name => $column_display_name) {
                $class = "class=\"column-{$column_name}\"";
                switch ($column_name) {
                    case 'post-title':
                        echo '<td ' . $class . '><strong>';
                        if (current_user_can('edit_post', $post_id)) {
                            ?>
<a class="row-title" href="<?php 
                            echo $edit_link;
                            ?>
" title="<?php 
                            echo esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $import_data['post_title']));
                            ?>
"><?php 
                            echo esc_attr($import_data['post_title']);
                            ?>
</a><?php 
                        } else {
                            echo $import_data['post_title'];
                        }
                        echo '</strong><br />';
                        echo '<div style="margin-left: 10px;">';
                        $index = 1;
                        while (list($episode_index, $episode_data) = each($import_data['enclosures'])) {
                            if ($index > $MaxFileIndex) {
                                $MaxFileIndex = $index;
                            }
                            $Parts = parse_url($episode_data['url']);
                            $filename = substr($Parts['path'], strrpos($Parts['path'], '/') + 1);
                            if ($filename == '') {
                                $filename = $episode_data['url'];
                            }
                            echo "File&nbsp;{$index}:&nbsp;";
                            echo '<input type="hidden" name="Media[' . $post_id . '][' . $episode_index . ']" value="' . htmlspecialchars($episode_data['url']) . '" />';
                            if (empty($episode_data['imported'])) {
                                echo '<span style="color: #CC0000; font-weight: bold; cursor:pointer;" onclick="alert(\'File: ' . $filename . '\\nURL: ' . $episode_data['url'] . '\')">';
                                $StrandedEpisodes++;
                            } else {
                                echo '<span style="color: green; font-weight: bold; cursor:pointer;" onclick="alert(\'File: ' . $filename . '\\nURL: ' . $episode_data['url'] . '\')">';
                            }
                            if (empty($episode_data['imported'])) {
                                echo '*';
                            }
                            echo $filename;
                            echo '</span>';
                            echo '<br/>';
                            $index++;
                        }
                        if ($index > 1) {
                            // Do we need the post title?
                            echo '<input type="hidden" name="Titles[' . $post_id . ']" value="' . htmlspecialchars($import_data['post_title']) . '" />';
                        }
                        reset($import_data['enclosures']);
                        echo '</div>';
                        echo '</td>';
                        break;
                    case 'post-date':
                        echo "<td {$class}>";
                        $timestamp = strtotime($import_data['post_date']);
                        echo date('Y/m/d', $timestamp);
                        echo "</td>";
                        break;
                    case 'feed-slug':
                        echo "<td {$class}>{$feed_slug}";
                        echo "</td>";
                        break;
                    default:
                        echo "<td {$class}>";
                        $feed_slug = substr($column_name, 5);
                        if ($column_name == 'exclude') {
                            $feed_slug = '';
                        }
                        $enclosure_data = false;
                        $EnclosureURL = '';
                        echo '<div class="">&nbsp;<br />';
                        if (isset($CurrentEnclosures[$feed_slug]) && $CurrentEnclosures[$feed_slug]['imported']) {
                            $index = 1;
                            while (list($episode_index, $episode_data) = each($import_data['enclosures'])) {
                                echo "File {$index}: ";
                                if ($CurrentEnclosures[$feed_slug]['url'] == $episode_data['url']) {
                                    if (!empty($CurrentEnclosures[$feed_slug]['present'])) {
                                        echo '<strong style="color: green;">' . __('present', 'powerpress') . '</strong>';
                                    } else {
                                        echo '<strong style="color: green;">' . __('imported', 'powerpress') . '</strong>';
                                    }
                                } else {
                                    echo 'X';
                                }
                                echo "<br/>\n";
                                $index++;
                            }
                            reset($import_data['enclosures']);
                        } else {
                            $index = 1;
                            while (list($episode_index, $episode_data) = each($import_data['enclosures'])) {
                                echo "File&nbsp;{$index}:&nbsp;";
                                if (!empty($episode_data['imported'])) {
                                    echo '&nbsp;X';
                                } else {
                                    $checked = '';
                                    if (!isset($CheckedEpisodes[$episode_index]) && !in_array($feed_slug, $CheckedEpisodes)) {
                                        $checked = 'checked';
                                        $CheckedEpisodes[$episode_index] = $feed_slug;
                                    }
                                    if (!isset($CheckedEpisodes[$episode_index]) && $feed_slug == '') {
                                        $checked = 'checked';
                                    }
                                    echo '<input type="radio" id="import_' . $post_id . '_' . $episode_index . '" name="Import[' . $post_id . '][' . $episode_index . ']" value="' . $feed_slug . '" ' . $checked . ' onclick="return check_radio_selection(this, ' . $post_id . ', ' . $episode_index . ')" />';
                                }
                                echo '<br/>';
                                $index++;
                            }
                            reset($import_data['enclosures']);
                        }
                        echo '</div>';
                        echo "</td>";
                        $feed_index++;
                        break;
                }
            }
            echo "\n    </tr>\n";
            $count++;
        }
        ?>
	</tbody>
</table>

<p><?php 
        echo sprintf(__('Importable episodes highlighted in %s with asterisks *.', 'powerpress'), '<span style="color: #CC0000; font-weight: bold;">' . __('red', 'powerpress') . '</span>');
        ?>
</p>
<p style="margin-bottom: 0; padding-bottom: 0;"><?php 
        echo __('Select Only:', 'powerpress');
        ?>
</p>
<?php 
        if ($results['feeds_required'] < 1) {
            $results['feeds_required'] = 1;
        }
        for ($number = 0; $number < $MaxFileIndex; $number++) {
            ?>
<p style="margin: 0 0 0 40px; padding: 0;">
 <?php 
            echo __('File', 'powerpress');
            ?>
 <?php 
            echo $number + 1;
            ?>
:
<?php 
            while (list($feed_slug, $feed_title) = each($Settings['custom_feeds'])) {
                echo '<a href="javascript:void()" onclick="select_all(' . $number . ',\'' . $feed_slug . '\');return false;">' . htmlspecialchars($feed_title) . '</a> | ';
            }
            reset($Settings['custom_feeds']);
            ?>
<a href="javascript:void()" onclick="select_all(<?php 
            echo $number;
            ?>
,'');return false;"><?php 
            echo __('No Import', 'powerpress');
            ?>
</a>
</p>
<?php 
        }
        ?>
<p><?php 
        echo __('Types of media found:', 'powerpress');
        ?>
 
<?php 
        $comma = false;
        global $g_import_mt_extensions;
        while (list($ext, $null) = each($g_import_mt_extensions)) {
            if ($comma) {
                echo ', ';
            }
            $comma = true;
            echo $ext;
        }
        ?>
</p>



<?php 
    }
    if ($StrandedEpisodes) {
        reset($results);
        ?>
<p><?php 
        echo sprintf(__('There are %d media files that can be imported with a total of %d blog post podcast episodes.', 'powerpress'), $StrandedEpisodes, count($results) - 1);
        ?>
</p>
<?php 
    }
    ?>
<p class="submit">
<input type="submit" name="Submit" id="powerpress_import_button" class="button-primary" value="Import Episodes" onclick="return confirm('Import selected episodes, are you sure?');" />
 &nbsp; <input type="checkbox" name="DetectDuration" value="1" /> <?php 
    echo __('Detect duration for mp3 media. (expect script to take a while with this option)', 'powerpress');
    ?>
</p>
</p>
</form>
<hr />
<form enctype="enctype" method="get" action="<?php 
    echo admin_url('admin.php');
    ?>
">
<input type="hidden" name="page" value="powerpress/powerpressadmin_tools.php" />
<input type="hidden" name="action" value="powerpress-mt-epiosdes" />
<h2><?php 
    echo __('Filter Results', 'powerpress');
    ?>
</h2>
<p><label><?php 
    echo __('Include Only', 'powerpress');
    ?>
</label><input type="text" name="include_only_ext" value="<?php 
    if (!empty($_GET['include_only_ext'])) {
        echo htmlspecialchars($_GET['include_only_ext']);
    }
    ?>
" style="width: 240px;" />
(<?php 
    echo __('leave blank for all media', 'powerpress');
    ?>
) <br />
<label>&nbsp;</label><?php 
    echo __('Specify the file extensions to include separated by commas (e.g. mp3, m4v).', 'powerpress');
    ?>
</p>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php 
    echo __('Filter Episodes', 'powerpress');
    ?>
" />
</p>
	<!-- start footer -->
<?php 
}
Esempio n. 8
0
function powerpress_admin_init()
{
    global $wp_rewrite;
    add_thickbox();
    // we use the thckbox for some settings
    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
    // Now including the library at Google
    wp_enqueue_script('jquery-ui-tabs');
    // Powerpress page
    if (isset($_GET['page']) && strstr($_GET['page'], 'powerpress') !== false) {
        //wp_enqueue_script('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js');
    }
    if (function_exists('powerpress_admin_jquery_init')) {
        powerpress_admin_jquery_init();
    }
    if (!current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS)) {
        powerpress_page_message_add_error(__('You do not have sufficient permission to manage options.', 'powerpress'));
        return;
    }
    // Check for other podcasting plugin
    if (defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION')) {
        powerpress_page_message_add_error(__('Another podcasting plugin has been detected, PowerPress is currently disabled.', 'powerpress'));
    }
    global $wp_version;
    $VersionDiff = version_compare($wp_version, 2.8);
    if ($VersionDiff < 0) {
        powerpress_page_message_add_error(__('Blubrry PowerPress requires Wordpress version 3.0 or greater.', 'powerpress'));
    }
    // Check for incompatible plugins:
    if (isset($GLOBALS['objWPOSFLV']) && is_object($GLOBALS['objWPOSFLV'])) {
        powerpress_page_message_add_error(__('The WP OS FLV plugin is not compatible with Blubrry PowerPress.', 'powerpress'));
    }
    // Save settings here
    if (isset($_POST['Feed']) || isset($_POST['General'])) {
        check_admin_referer('powerpress-edit');
        $upload_path = false;
        $upload_url = false;
        $UploadArray = wp_upload_dir();
        if (false === $UploadArray['error']) {
            $upload_path = $UploadArray['basedir'] . '/powerpress/';
            $upload_url = $UploadArray['baseurl'] . '/powerpress/';
        }
        // Save the posted value in the database
        $Feed = isset($_POST['Feed']) ? $_POST['Feed'] : false;
        $General = isset($_POST['General']) ? $_POST['General'] : false;
        $FeedSlug = isset($_POST['feed_slug']) ? $_POST['feed_slug'] : false;
        $Category = isset($_POST['cat']) ? $_POST['cat'] : false;
        $term_taxonomy_id = isset($_POST['ttid']) ? $_POST['ttid'] : false;
        $podcast_post_type = isset($_POST['podcast_post_type']) ? $_POST['podcast_post_type'] : false;
        // New iTunes image
        if (!empty($_POST['itunes_image_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['itunes_image_file']['name']));
            $temp = $_FILES['itunes_image_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                if (!empty($filenameParts['extension'])) {
                    do {
                        $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                        $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                    } while (file_exists($upload_path . $filename));
                }
            }
            // Check the image...
            if (file_exists($temp)) {
                $ImageData = @getimagesize($temp);
                if (empty($ImageData['channels'])) {
                    $ImageData['channels'] = 3;
                }
                // Assume it's ok if we cannot detect it.
                if ($ImageData) {
                    if (($ImageData[2] == IMAGETYPE_JPEG || $ImageData[2] == IMAGETYPE_PNG) && $ImageData[0] == $ImageData[1] && $ImageData[0] >= 300 && $ImageData['channels'] == 3) {
                        if (!move_uploaded_file($temp, $upload_path . $filename)) {
                            powerpress_page_message_add_error(__('Error saving iTunes image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the iTunes image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                        } else {
                            $Feed['itunes_image'] = $upload_url . $filename;
                            if (!empty($_POST['itunes_image_checkbox_as_rss'])) {
                                $Feed['rss2_image'] = $upload_url . $filename;
                            }
                            if ($ImageData[0] < 1400 || $ImageData[1] < 1400) {
                                powerpress_page_message_add_error(__('iTunes image warning', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . __(' is', 'powerpress') . ' ' . $ImageData[0] . ' x ' . $ImageData[0] . ' - ' . __('Image must be square 1400 x 1400 pixels or larger.', 'powerprss'));
                            }
                        }
                    } else {
                        if ($ImageData['channels'] != 3) {
                            powerpress_page_message_add_error(__('Invalid iTunes image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('Image must be in RGB color space (CMYK is not supported).', 'powerprss'));
                        } else {
                            if ($ImageData[0] != $ImageData[1] || $ImageData[0] < 1400) {
                                powerpress_page_message_add_error(__('Invalid iTunes image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('Image must be square 1400 x 1400 pixels or larger.', 'powerprss'));
                            } else {
                                powerpress_page_message_add_error(__('Invalid iTunes image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']));
                            }
                        }
                    }
                } else {
                    powerpress_page_message_add_error(__('Invalid iTunes image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']));
                }
            }
        }
        // New RSS2 image
        if (!empty($_POST['rss2_image_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['rss2_image_file']['name']));
            $temp = $_FILES['rss2_image_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                if (!empty($filenameParts['basename']) && !empty($filenameParts['extension'])) {
                    do {
                        $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                        $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                    } while (file_exists($upload_path . $filename));
                }
            }
            if (@getimagesize($temp)) {
                if (!move_uploaded_file($temp, $upload_path . $filename)) {
                    powerpress_page_message_add_error(__('Error saving RSS image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the RSS image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                } else {
                    $Feed['rss2_image'] = $upload_url . $filename;
                }
            } else {
                powerpress_page_message_add_error(__('Invalid RSS image', 'powerpress') . ': ' . htmlspecialchars($_FILES['rss2_image_file']['name']));
            }
        }
        // New mp3 coverart image
        if (!empty($_POST['coverart_image_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['coverart_image_file']['name']));
            $temp = $_FILES['coverart_image_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                do {
                    $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                    $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                } while (file_exists($upload_path . $filename));
            }
            if (@getimagesize($temp)) {
                if (!move_uploaded_file($temp, $upload_path . $filename)) {
                    powerpress_page_message_add_error(__('Error saving Coverart image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the coverart image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                } else {
                    $_POST['TagValues']['tag_coverart'] = $upload_url . $filename;
                    $General['tag_coverart'] = $upload_url . $filename;
                }
            } else {
                powerpress_page_message_add_error(__('Invalid Coverat image', 'powerpress') . ': ' . htmlspecialchars($_FILES['coverart_image_file']['name']));
            }
        }
        // New poster image
        if (!empty($_POST['poster_image_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['poster_image_file']['name']));
            $temp = $_FILES['poster_image_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                do {
                    $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                    $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                } while (file_exists($upload_path . $filename));
            }
            if (@getimagesize($temp)) {
                if (!move_uploaded_file($temp, $upload_path . $filename)) {
                    powerpress_page_message_add_error(__('Error saving Poster image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the poster image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                } else {
                    $General['poster_image'] = $upload_url . $filename;
                }
            } else {
                powerpress_page_message_add_error(__('Invalid poster image', 'powerpress') . ': ' . htmlspecialchars($_FILES['poster_image_file']['name']));
            }
        }
        // New audio play icon image
        if (!empty($_POST['audio_custom_play_button_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['audio_custom_play_button_file']['name']));
            $temp = $_FILES['audio_custom_play_button_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                do {
                    $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                    $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                } while (file_exists($upload_path . $filename));
            }
            if (@getimagesize($temp)) {
                if (!move_uploaded_file($temp, $upload_path . $filename)) {
                    powerpress_page_message_add_error(__('Error saving Play image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the play image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                } else {
                    $General['audio_custom_play_button'] = $upload_url . $filename;
                }
            } else {
                powerpress_page_message_add_error(__('Invalid play icon image', 'powerpress') . ': ' . htmlspecialchars($_FILES['audio_custom_play_button_file']['name']));
            }
        }
        // New video play icon image
        if (!empty($_POST['video_custom_play_button_checkbox'])) {
            $filename = str_replace(" ", "_", basename($_FILES['video_custom_play_button_file']['name']));
            $temp = $_FILES['video_custom_play_button_file']['tmp_name'];
            if (file_exists($upload_path . $filename)) {
                $filenameParts = pathinfo($filename);
                do {
                    $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension']) + 1) * -1);
                    $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension']);
                } while (file_exists($upload_path . $filename));
            }
            $imageInfo = @getimagesize($temp);
            if ($imageInfo && $imageInfo[0] == $imageInfo[1] && $imageInfo[0] == 60) {
                if (!move_uploaded_file($temp, $upload_path . $filename)) {
                    powerpress_page_message_add_error(__('Error saving Video Play icon image', 'powerpress') . ':	' . htmlspecialchars($_FILES['itunes_image_file']['name']) . ' - ' . __('An error occurred saving the Video Play icon image on the server.', 'powerprss') . ' ' . sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename));
                } else {
                    $General['video_custom_play_button'] = $upload_url . $filename;
                }
            } else {
                if ($imageInfo) {
                    powerpress_page_message_add_error(__('Invalid play icon image size', 'powerpress') . ': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']));
                } else {
                    powerpress_page_message_add_error(__('Invalid play icon image', 'powerpress') . ': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']));
                }
            }
        }
        if (isset($_POST['UpdateDisablePlayer'])) {
            $player_feed_slug = $_POST['UpdateDisablePlayer'];
            $General['disable_player'] = array();
            $GeneralPrev = get_option('powerpress_general');
            if (isset($GeneralPrev['disable_player'])) {
                $General['disable_player'] = $GeneralPrev['disable_player'];
            }
            if (isset($_POST['DisablePlayerFor'])) {
                $General['disable_player'][$player_feed_slug] = 1;
            } else {
                unset($General['disable_player'][$player_feed_slug]);
            }
        }
        if (isset($_POST['PlayerScaleCustom']) && isset($General['player_scale']) && $General['player_scale'] != 'tofit' && $General['player_scale'] != 'aspect') {
            $General['player_scale'] = $_POST['PlayerScaleCustom'];
        }
        // Check to see if we need to update the feed title
        if ($FeedSlug && !$podcast_post_type) {
            $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
            if (!isset($GeneralSettingsTemp['custom_feeds'][$FeedSlug]) || $GeneralSettingsTemp['custom_feeds'][$FeedSlug] != $Feed['title']) {
                if (!$General) {
                    $General = array();
                }
                if (!empty($GeneralSettingsTemp['custom_feeds'])) {
                    $General['custom_feeds'] = $GeneralSettingsTemp['custom_feeds'];
                } else {
                    $General['custom_feeds'] = array();
                }
                $General['custom_feeds'][$FeedSlug] = $Feed['title'];
            }
        }
        // Update the settings in the database:
        if ($General) {
            if (!empty($_POST['action']) && $_POST['action'] == 'powerpress-save-settings') {
                if (!isset($General['display_player_excerpt'])) {
                    // If we are modifying appearance settings but this option was not checked...
                    $General['display_player_excerpt'] = 0;
                }
                // Set it to zero.
                //if( !isset($General['display_player_disable_mobile']) )
                //	$General['display_player_disable_mobile'] = 0;
                $General['disable_dashboard_stats'] = 0;
                if (!empty($_POST['DisableStatsInDashboard'])) {
                    $General['disable_dashboard_stats'] = 1;
                }
                if (!isset($General['disable_dashboard_news'])) {
                    $General['disable_dashboard_news'] = 0;
                }
                if (!isset($General['episode_box_mode'])) {
                    // Default not set, 1 = no duration/file size, 2 = yes duration/file size (default if not set)
                    $General['episode_box_mode'] = 1;
                }
                // 1 = no duration/file size (unchecked)
                if (!isset($General['episode_box_embed'])) {
                    $General['episode_box_embed'] = 0;
                }
                if (!isset($General['embed_replace_player'])) {
                    $General['embed_replace_player'] = 0;
                }
                if (!isset($General['episode_box_no_player'])) {
                    $General['episode_box_no_player'] = 0;
                }
                if (!isset($General['episode_box_no_links'])) {
                    $General['episode_box_no_links'] = 0;
                }
                if (!isset($General['episode_box_no_player_and_links'])) {
                    $General['episode_box_no_player_and_links'] = 0;
                }
                if (!isset($General['episode_box_cover_image'])) {
                    $General['episode_box_cover_image'] = 0;
                }
                if (!isset($General['episode_box_player_size'])) {
                    $General['episode_box_player_size'] = 0;
                }
                if (!isset($General['episode_box_keywords'])) {
                    $General['episode_box_keywords'] = 0;
                }
                if (!isset($General['episode_box_subtitle'])) {
                    $General['episode_box_subtitle'] = 0;
                }
                if (!isset($General['episode_box_summary'])) {
                    $General['episode_box_summary'] = 0;
                }
                if (!isset($General['episode_box_author'])) {
                    $General['episode_box_author'] = 0;
                }
                if (!isset($General['episode_box_explicit'])) {
                    $General['episode_box_explicit'] = 0;
                }
                if (!isset($General['episode_box_closed_captioned'])) {
                    $General['episode_box_closed_captioned'] = 0;
                }
                if (!isset($General['episode_box_itunes_image'])) {
                    $General['episode_box_itunes_image'] = 0;
                }
                if (!isset($General['episode_box_order'])) {
                    $General['episode_box_order'] = 0;
                }
                if (!isset($General['episode_box_feature_in_itunes'])) {
                    $General['episode_box_feature_in_itunes'] = 0;
                } else {
                    $General['episode_box_order'] = 0;
                }
                if (!isset($General['allow_feed_comments'])) {
                    $General['allow_feed_comments'] = 0;
                }
                if (!isset($General['feed_links'])) {
                    $General['feed_links'] = 0;
                }
                // Advanced Features
                if (!isset($General['player_options'])) {
                    $General['player_options'] = 0;
                }
                if (!isset($General['cat_casting'])) {
                    $General['cat_casting'] = 0;
                }
                if (!isset($General['channels'])) {
                    $General['channels'] = 0;
                }
                if (!isset($General['taxonomy_podcasting'])) {
                    $General['taxonomy_podcasting'] = 0;
                }
                if (!isset($General['posttype_podcasting'])) {
                    $General['posttype_podcasting'] = 0;
                }
                if (!isset($General['metamarks'])) {
                    $General['metamarks'] = 0;
                }
                // Media Presentation Settings
                $PlayerSettings = array();
                if (!empty($_POST['PlayerSettings'])) {
                    $PlayerSettings = $_POST['PlayerSettings'];
                }
                if (empty($PlayerSettings['display_pinw'])) {
                    $PlayerSettings['display_pinw'] = 0;
                }
                if (empty($PlayerSettings['display_media_player'])) {
                    $PlayerSettings['display_media_player'] = 0;
                }
                if (empty($PlayerSettings['display_pinw'])) {
                    $PlayerSettings['display_pinw'] = 0;
                }
                if (empty($PlayerSettings['display_media_player'])) {
                    $PlayerSettings['display_media_player'] = 0;
                }
                $General['player_function'] = abs($PlayerSettings['display_pinw'] - $PlayerSettings['display_media_player']);
                $General['podcast_link'] = 0;
                if (!empty($PlayerSettings['display_download'])) {
                    $General['podcast_link'] = 1;
                    if (!empty($PlayerSettings['display_download_size'])) {
                        $General['podcast_link'] = 2;
                        if (!empty($PlayerSettings['display_download_duration'])) {
                            $General['podcast_link'] = 3;
                        }
                    }
                }
                if (!isset($General['podcast_embed'])) {
                    $General['podcast_embed'] = 0;
                }
                if (!isset($General['podcast_embed_in_feed'])) {
                    $General['podcast_embed_in_feed'] = 0;
                }
                if (!isset($General['m4a'])) {
                    $General['m4a'] = '';
                }
                if (!isset($General['new_window_nofactor'])) {
                    $General['new_window_nofactor'] = '';
                }
            } else {
                if (!empty($_POST['action']) && $_POST['action'] == 'powerpress-save-defaults') {
                    if (!isset($General['display_player_excerpt'])) {
                        // If we are modifying appearance settings but this option was not checked...
                        $General['display_player_excerpt'] = 0;
                    }
                    // Set it to zero.
                    $General['disable_dashboard_stats'] = 0;
                    if (!empty($_POST['DisableStatsInDashboard'])) {
                        $General['disable_dashboard_stats'] = 1;
                    }
                    // Advanced Mode options
                    if (!isset($General['cat_casting'])) {
                        $General['cat_casting'] = 0;
                    }
                    if (!isset($General['channels'])) {
                        $General['channels'] = 0;
                    }
                    if (!isset($General['taxonomy_podcasting'])) {
                        $General['taxonomy_podcasting'] = 0;
                    }
                    if (!isset($General['posttype_podcasting'])) {
                        $General['posttype_podcasting'] = 0;
                    }
                    if (!isset($General['metamarks'])) {
                        $General['metamarks'] = 0;
                    }
                }
            }
            if (!empty($_POST['action']) && $_POST['action'] == 'powerpress-save-tags') {
                if (!isset($General['write_tags'])) {
                    // If we are modifying appearance settings but this option was not checked...
                    $General['write_tags'] = 0;
                }
                // Set it to zero.
                $TagValues = $_POST['TagValues'];
                $GeneralPosted = $_POST['General'];
                if (!empty($_POST['PowerPressTrackNumber'])) {
                    update_option('powerpress_track_number', $_POST['PowerPressTrackNumber']);
                }
                // Set all the tag values...
                while (list($key, $value) = each($GeneralPosted)) {
                    if (substr($key, 0, 4) == 'tag_') {
                        // Special case, we are uploading new coverart image
                        if (!empty($_POST['coverart_image_checkbox']) && $key == 'tag_coverart') {
                            continue;
                        }
                        // Specail case, the track is saved in a separate column in the database.
                        if ($key == 'tag_track') {
                            continue;
                        }
                        if (!empty($value)) {
                            $General[$key] = $TagValues[$key];
                        } else {
                            $General[$key] = '';
                        }
                    }
                }
                if (!empty($General['tag_coverart'])) {
                    $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
                    if (!empty($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] !== 'false') {
                        $json_data = false;
                        $api_url_array = powerpress_get_api_array();
                        while (list($index, $api_url) = each($api_url_array)) {
                            $req_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim($api_url, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']));
                            $req_url .= defined('POWERPRESS_BLUBRRY_API_QSA') ? '&' . POWERPRESS_BLUBRRY_API_QSA : '';
                            $json_data = powerpress_remote_fopen($req_url, $GeneralSettingsTemp['blubrry_auth']);
                            if ($json_data != false) {
                                break;
                            }
                        }
                        // Lets try to cache the image onto Blubrry's Server...
                        $results = powerpress_json_decode($json_data);
                        if (is_array($results) && !isset($results['error'])) {
                            // Good!
                            powerpress_page_message_add_notice(__('Coverart image updated successfully.', 'powerpress'));
                        } else {
                            if (isset($results['error'])) {
                                $error = __('Blubrry Hosting Error (updating coverart)', 'powerpress') . ': ' . $results['error'];
                                powerpress_page_message_add_error($error);
                            } else {
                                $error = __('An error occurred updating the coverart with your Blubrry Services Account.', 'powerpress');
                                powerpress_page_message_add_error($error);
                            }
                        }
                    } else {
                        powerpress_page_message_add_error(__('Coverart Image was not uploaded to your Blubrry Services Account. It will NOT be added to your mp3s.', 'powerpress'));
                    }
                }
            }
            if (!empty($_POST['action']) && $_POST['action'] == 'powerpress-save-videocommon') {
                if (!isset($General['poster_play_image'])) {
                    $General['poster_play_image'] = 0;
                }
                if (!isset($General['poster_image_audio'])) {
                    $General['poster_image_audio'] = 0;
                }
            }
            // Wordpress adds slashes to everything, but since we're storing everything serialized, lets remove them...
            $General = powerpress_stripslashes($General);
            powerpress_save_settings($General);
        }
        if ($Feed) {
            if (!isset($_POST['ProtectContent']) && isset($Feed['premium'])) {
                $Feed['premium'] = false;
            }
            if (!isset($Feed['enhance_itunes_summary'])) {
                $Feed['enhance_itunes_summary'] = false;
            }
            if (!isset($Feed['itunes_author_post'])) {
                $Feed['itunes_author_post'] = false;
            }
            if (!isset($Feed['itunes_block'])) {
                $Feed['itunes_block'] = false;
            }
            if (!isset($Feed['itunes_complete'])) {
                $Feed['itunes_complete'] = false;
            }
            if (!isset($Feed['maximize_feed'])) {
                $Feed['maximize_feed'] = false;
            }
            if (!isset($Feed['episode_itunes_image'])) {
                $Feed['episode_itunes_image'] = false;
            }
            $Feed = powerpress_stripslashes($Feed);
            if ($Category) {
                powerpress_save_settings($Feed, 'powerpress_cat_feed_' . $Category);
            } else {
                if ($term_taxonomy_id) {
                    powerpress_save_settings($Feed, 'powerpress_taxonomy_' . $term_taxonomy_id);
                } else {
                    if ($podcast_post_type) {
                        $PostTypeSettings = array();
                        $PostTypeSettings[$FeedSlug] = $Feed;
                        powerpress_save_settings($PostTypeSettings, 'powerpress_posttype_' . $podcast_post_type);
                        powerpress_rebuild_posttype_podcasting();
                    } else {
                        if ($FeedSlug == false && get_option('powerpress_feed_podcast')) {
                            // If the settings were moved to the podcast channels feature...
                            powerpress_save_settings($Feed, 'powerpress_feed_podcast');
                        }
                        // save a copy here if that is the case.
                        powerpress_save_settings($Feed, 'powerpress_feed' . ($FeedSlug ? '_' . $FeedSlug : ''));
                    }
                }
            }
        }
        if (isset($_POST['EpisodeBoxBGColor'])) {
            $GeneralSettingsTemp = get_option('powerpress_general');
            $SaveEpisdoeBoxBGColor['episode_box_background_color'] = array();
            if (isset($GeneralSettingsTemp['episode_box_background_color'])) {
                $SaveEpisdoeBoxBGColor['episode_box_background_color'] = $GeneralSettingsTemp['episode_box_background_color'];
            }
            //  copy previous settings
            list($feed_slug_temp, $background_color) = each($_POST['EpisodeBoxBGColor']);
            $SaveEpisdoeBoxBGColor['episode_box_background_color'][$feed_slug_temp] = $background_color;
            powerpress_save_settings($SaveEpisdoeBoxBGColor);
        }
        // Anytime settings are saved lets flush the rewrite rules
        $wp_rewrite->flush_rules();
        // Settings saved successfully
        if (!empty($_POST['action'])) {
            switch ($_POST['action']) {
                case 'powerpress-save-settings':
                case 'powerpress-save-defaults':
                    powerpress_page_message_add_notice(__('Blubrry PowerPress settings saved.', 'powerpress'));
                    break;
                case 'powerpress-save-channel':
                    powerpress_page_message_add_notice(__('Blubrry PowerPress Channel settings saved.', 'powerpress'));
                    break;
                case 'powerpress-save-category':
                    powerpress_page_message_add_notice(__('Blubrry PowerPress Category Podcasting  settings saved.', 'powerpress'));
                    break;
                case 'powerpress-save-ttid':
                    powerpress_page_message_add_notice(__('Blubrry PowerPress Taxonomy Podcasting settings saved.', 'powerpress'));
                    break;
                case 'powerpress-save-post_type':
                    powerpress_page_message_add_notice(__('Blubrry PowerPress Post Type Podcasting settings saved.', 'powerpress'));
                    break;
                case 'powerpress-save-tags':
                    $General = get_option('powerpress_general');
                    if (empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false') {
                        powerpress_page_message_add_notice(__('ATTENTION: You must configure your Blubrry Services in the Blubrry PowerPress &gt; Basic Settings page in order to utilize this feature.', 'powerpress'));
                    } else {
                        powerpress_page_message_add_notice(__('Blubrry PowerPress MP3 Tag settings saved.', 'powerpress'));
                    }
                    break;
                default:
                    powerpress_page_message_add_notice(__('Blubrry PowerPress settings saved.', 'powerpress'));
                    break;
            }
        }
    }
    // Handle POST actions...
    if (isset($_POST['action'])) {
        switch ($_POST['action']) {
            case 'powerpress-addfeed':
                check_admin_referer('powerpress-add-feed');
                $Settings = get_option('powerpress_general');
                $key = sanitize_title($_POST['feed_slug']);
                $value = $_POST['feed_name'];
                $value = powerpress_stripslashes($value);
                /*
                				if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
                				{
                					powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
                				} else */
                if ($key == '') {
                    powerpress_page_message_add_error(sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), $_POST['feed_slug']));
                } else {
                    if (in_array($key, $wp_rewrite->feeds) && !isset($Settings['custom_feeds'][$key])) {
                        powerpress_page_message_add_error(sprintf(__('Feed slug "%s" is not available.', 'powerpress'), $key));
                    } else {
                        $Settings['custom_feeds'][$key] = $value;
                        powerpress_save_settings($Settings);
                        add_feed($key, 'powerpress_do_podcast_feed');
                        // Before we flush the rewrite rules we need to add the new custom feed...
                        $wp_rewrite->flush_rules();
                        powerpress_page_message_add_notice(sprintf(__('Podcast Feed "%s" added, please configure your new feed now.', 'powerpress'), $value));
                        $_GET['action'] = 'powerpress-editfeed';
                        $_GET['feed_slug'] = $key;
                    }
                }
                break;
            case 'powerpress-addtaxonomyfeed':
                if (!empty($_POST['cancel'])) {
                    unset($_POST['taxonomy']);
                }
                if (empty($_POST['add_podcasting'])) {
                    break;
                }
                // We do not handle this situation
            case 'powerpress-addcategoryfeed':
                check_admin_referer('powerpress-add-taxonomy-feed');
                $taxonomy_type = isset($_POST['taxonomy']) ? $_POST['taxonomy'] : $_GET['taxonomy'];
                $term_ID = isset($_POST['term']) ? $_POST['term'] : $_GET['term'];
                $term_object = get_term($term_ID, $taxonomy_type, OBJECT, 'edit');
                if (empty($term_ID)) {
                    if ($taxonomy_type == 'category') {
                        powerpress_page_message_add_error(__('You must select a category to continue.', 'powerpress'));
                    } else {
                        powerpress_page_message_add_error(__('You must select a term to continue.', 'powerpress'));
                    }
                } else {
                    if ($term_object == false) {
                        powerpress_page_message_add_error(__('Error obtaining term information.', 'powerpress'));
                    } else {
                        if ($taxonomy_type == 'category') {
                            $Settings = get_option('powerpress_general');
                            if (empty($Settings['custom_cat_feeds'])) {
                                $Settings['custom_cat_feeds'] = array();
                            }
                            if (!in_array($term_ID, $Settings['custom_cat_feeds'])) {
                                $Settings['custom_cat_feeds'][] = $term_ID;
                                powerpress_save_settings($Settings);
                            }
                            powerpress_page_message_add_notice(__('Please configure your category podcast feed now.', 'powerpress'));
                            $_GET['action'] = 'powerpress-editcategoryfeed';
                            $_GET['cat'] = $term_ID;
                        } else {
                            //$term_info = term_exists($term_ID, $taxonomy_type);
                            $tt_id = $term_object->term_taxonomy_id;
                            if (!$tt_id) {
                            } else {
                                $Settings = get_option('powerpress_taxonomy_podcasting');
                                if (!isset($Settings[$tt_id])) {
                                    $Settings[$tt_id] = true;
                                    powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting');
                                    // add the feed to the taxonomy podcasting list
                                }
                                powerpress_page_message_add_notice(__('Please configure your taxonomy podcast now.', 'powerpress'));
                                $_GET['action'] = 'powerpress-edittaxonomyfeed';
                                $_GET['term'] = $term_ID;
                                $_GET['ttid'] = $tt_id;
                            }
                        }
                    }
                }
                break;
            case 'powerpress-addposttypefeed':
                check_admin_referer('powerpress-add-posttype-feed');
                //die('ok 2');
                $Settings = get_option('powerpress_general');
                $feed_slug = sanitize_title($_POST['feed_slug']);
                $post_type = $_POST['podcast_post_type'];
                $post_type = powerpress_stripslashes($post_type);
                $feed_title = $_POST['feed_title'];
                $feed_title = powerpress_stripslashes($feed_title);
                /*
                				if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
                				{
                					powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
                				} else */
                if (empty($feed_slug)) {
                    powerpress_page_message_add_error(sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), $_POST['feed_slug']));
                } else {
                    if (empty($post_type)) {
                        powerpress_page_message_add_error(sprintf(__('Post Type is invalid.', 'powerpress'), $post_type));
                    } else {
                        $ExistingSettings = powerpress_get_settings('powerpress_posttype_' . $post_type);
                        if (!empty($ExistingSettings[$feed_slug])) {
                            powerpress_page_message_add_error(sprintf(__('Feed slug "%s" already exists.', 'powerpress'), $_POST['feed_slug']));
                        } else {
                            $NewSettings = array();
                            $NewSettings[$feed_slug]['title'] = $feed_title;
                            powerpress_save_settings($NewSettings, 'powerpress_posttype_' . $post_type);
                            add_feed($feed_slug, 'powerpress_do_podcast_feed');
                            // Before we flush the rewrite rules we need to add the new custom feed...
                            $wp_rewrite->flush_rules();
                            powerpress_page_message_add_notice(sprintf(__('Podcast "%s" added, please configure your new podcast.', 'powerpress'), $feed_title));
                            $_GET['action'] = 'powerpress-editposttypefeed';
                            $_GET['feed_slug'] = $feed_slug;
                            $_GET['podcast_post_type'] = $post_type;
                        }
                    }
                }
                break;
            case 'powerpress-ping-sites':
                check_admin_referer('powerpress-ping-sites');
                require_once POWERPRESS_ABSPATH . '/powerpressadmin-ping-sites.php';
                powerpressadmin_ping_sites_process();
                $_GET['action'] = 'powerpress-ping-sites';
                break;
            case 'powerpress-find-replace':
                check_admin_referer('powerpress-find-replace');
                require_once POWERPRESS_ABSPATH . '/powerpressadmin-find-replace.php';
                powerpressadmin_find_replace_process();
                $_GET['action'] = 'powerpress-find-replace';
                break;
            case 'powerpress-importpodpress':
                check_admin_referer('powerpress-import-podpress');
                require_once POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php';
                powerpressadmin_podpress_do_import();
                $_GET['action'] = 'powerpress-podpress-epiosdes';
                break;
            case 'powerpress-importmt':
                check_admin_referer('powerpress-import-mt');
                require_once POWERPRESS_ABSPATH . '/powerpressadmin-mt.php';
                powerpressadmin_mt_do_import();
                $_GET['action'] = 'powerpress-mt-epiosdes';
                break;
            case 'deletepodpressdata':
                check_admin_referer('powerpress-delete-podpress-data');
                require_once POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php';
                powerpressadmin_podpress_delete_data();
                break;
            case 'powerpress-save-mode':
                //if( !isset($_POST['General']['advanced_mode']) )
                //	powerpress_page_message_add_notice( __('You must select a Mode to continue.', 'powerpress') );
                break;
        }
    }
    // Handle GET actions...
    if (isset($_GET['action'])) {
        switch ($_GET['action']) {
            case 'powerpress-enable-categorypodcasting':
                check_admin_referer('powerpress-enable-categorypodcasting');
                $Settings = get_option('powerpress_general');
                $Settings['cat_casting'] = 1;
                powerpress_save_settings($Settings);
                if (version_compare($GLOBALS['wp_version'], '3.0', '<')) {
                    wp_redirect('categories.php?message=3');
                } else {
                    wp_redirect('edit-tags.php?taxonomy=category&message=3');
                }
                exit;
                break;
            case 'powerpress-addcategoryfeed':
                check_admin_referer('powerpress-add-taxonomy-feed');
                $cat_ID = $_GET['cat'];
                $Settings = get_option('powerpress_general');
                $category = get_category($cat_ID);
                if ($category == false) {
                    powerpress_page_message_add_error(__('Error obtaining category information.', 'powerpress'));
                } else {
                    if (empty($Settings['custom_cat_feeds']) || !is_array($Settings['custom_cat_feeds'])) {
                        $Settings['custom_cat_feeds'] = array();
                    }
                    if (!in_array($cat_ID, $Settings['custom_cat_feeds'])) {
                        $Settings['custom_cat_feeds'][] = $cat_ID;
                        powerpress_save_settings($Settings);
                    }
                    powerpress_page_message_add_notice(__('Please configure your category podcast feed now.', 'powerpress'));
                    $_GET['action'] = 'powerpress-editcategoryfeed';
                    $_GET['cat'] = $cat_ID;
                }
                break;
            case 'powerpress-delete-feed':
                $delete_slug = $_GET['feed_slug'];
                $force_deletion = !empty($_GET['force']);
                check_admin_referer('powerpress-delete-feed-' . $delete_slug);
                $Episodes = powerpress_admin_episodes_per_feed($delete_slug);
                if (false && $delete_slug == 'podcast' && $force_deletion == false) {
                    powerpress_page_message_add_error(__('Cannot delete default podcast feed.', 'powerpress'));
                } else {
                    if ($delete_slug != 'podcast' && $Episodes > 0 && $force_deletion == false) {
                        powerpress_page_message_add_error(sprintf(__('Cannot delete feed. Feed contains %d episode(s).', 'powerpress'), $Episodes));
                    } else {
                        $Settings = get_option('powerpress_general');
                        unset($Settings['custom_feeds'][$delete_slug]);
                        powerpress_save_settings($Settings);
                        // Delete the feed from the general settings
                        delete_option('powerpress_feed_' . $delete_slug);
                        // Delete the actual feed settings
                        // Now we need to update the rewrite cso the cached rules are up to date
                        if (in_array($delete_slug, $wp_rewrite->feeds)) {
                            $index = array_search($delete_slug, $wp_rewrite->feeds);
                            if ($index !== false) {
                                unset($wp_rewrite->feeds[$index]);
                            }
                            // Remove the old feed
                        }
                        // Remove feed function hook
                        $hook = 'do_feed_' . $delete_slug;
                        remove_action($hook, $hook, 10, 1);
                        // This may not be necessary
                        $wp_rewrite->flush_rules();
                        // This is definitely necessary
                        powerpress_page_message_add_notice(__('Feed deleted successfully.', 'powerpress'));
                    }
                }
                break;
            case 'powerpress-delete-category-feed':
                $cat_ID = $_GET['cat'];
                check_admin_referer('powerpress-delete-category-feed-' . $cat_ID);
                $Settings = get_option('powerpress_general');
                $key = array_search($cat_ID, $Settings['custom_cat_feeds']);
                if ($key !== false) {
                    unset($Settings['custom_cat_feeds'][$key]);
                    powerpress_save_settings($Settings);
                    // Delete the feed from the general settings
                }
                delete_option('powerpress_cat_feed_' . $cat_ID);
                // Delete the actual feed settings
                powerpress_page_message_add_notice(__('Removed podcast settings for category feed successfully.', 'powerpress'));
                break;
            case 'powerpress-delete-taxonomy-feed':
                $tt_ID = $_GET['ttid'];
                check_admin_referer('powerpress-delete-taxonomy-feed-' . $tt_ID);
                $Settings = get_option('powerpress_taxonomy_podcasting');
                if (!empty($Settings[$tt_ID])) {
                    unset($Settings[$tt_ID]);
                    powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting');
                    // Delete the feed from the general settings
                }
                delete_option('powerpress_taxonomy_' . $tt_ID);
                // Delete the actual feed settings
                powerpress_page_message_add_notice(__('Removed podcast settings for term successfully.', 'powerpress'));
                break;
            case 'powerpress-delete-posttype-feed':
                $feed_slug = $_GET['feed_slug'];
                $post_type = $_GET['podcast_post_type'];
                check_admin_referer('powerpress-delete-posttype-feed-' . $post_type . '_' . $feed_slug);
                $Settings = get_option('powerpress_posttype_' . $post_type);
                if (!empty($Settings[$feed_slug])) {
                    unset($Settings[$feed_slug]);
                    update_option('powerpress_posttype_' . $post_type, $Settings);
                    //powerpress_save_settings($Settings, 'powerpress_posttype_'.$post_type); // Delete the feed from the general settings
                }
                powerpress_page_message_add_notice(__('Removed podcast settings for post type successfully.', 'powerpress'));
                break;
            case 'powerpress-podpress-settings':
                check_admin_referer('powerpress-podpress-settings');
                // Import settings here..
                if (powerpress_admin_import_podpress_settings()) {
                    powerpress_page_message_add_notice(__('Podpress settings imported successfully.', 'powerpress'));
                } else {
                    powerpress_page_message_add_error(__('No Podpress settings found.', 'powerpress'));
                }
                break;
            case 'powerpress-podcasting-settings':
                check_admin_referer('powerpress-podcasting-settings');
                // Import settings here..
                if (powerpress_admin_import_podcasting_settings()) {
                    powerpress_page_message_add_notice(__('Settings imported from the plugin "Podcasting" successfully.', 'powerpress'));
                } else {
                    powerpress_page_message_add_error(__('No settings found for the plugin "Podcasting".', 'powerpress'));
                }
                break;
            case 'powerpress-add-caps':
                check_admin_referer('powerpress-add-caps');
                $users = array('administrator', 'editor', 'author');
                // , 'contributor', 'subscriber');
                while (list($null, $user) = each($users)) {
                    $role = get_role($user);
                    if (!$role->has_cap('edit_podcast')) {
                        $role->add_cap('edit_podcast');
                    }
                    if ($user == 'administrator' && !$role->has_cap('view_podcast_stats')) {
                        $role->add_cap('view_podcast_stats');
                    }
                }
                $General = array('use_caps' => true);
                powerpress_save_settings($General);
                powerpress_page_message_add_notice(__('PowerPress Roles and Capabilities added to WordPress Blog.', 'powerpress'));
                break;
            case 'powerpress-remove-caps':
                check_admin_referer('powerpress-remove-caps');
                $users = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
                while (list($null, $user) = each($users)) {
                    $role = get_role($user);
                    if ($role->has_cap('edit_podcast')) {
                        $role->remove_cap('edit_podcast');
                    }
                    if ($role->has_cap('view_podcast_stats')) {
                        $role->remove_cap('view_podcast_stats');
                    }
                }
                $General = array('use_caps' => false);
                powerpress_save_settings($General);
                powerpress_page_message_add_notice(__('PowerPress Roles and Capabilities removed from WordPress Blog', 'powerpress'));
                break;
            case 'powerpress-add-feed-caps':
                check_admin_referer('powerpress-add-feed-caps');
                $ps_role = get_role('premium_subscriber');
                if (!$ps_role) {
                    add_role('premium_subscriber', __('Premium Subscriber', 'powerpress'));
                    $ps_role = get_role('premium_subscriber');
                    $ps_role->add_cap('read');
                    $ps_role->add_cap('premium_content');
                }
                $users = array('administrator', 'editor', 'author');
                // , 'contributor', 'subscriber');
                while (list($null, $user) = each($users)) {
                    $role = get_role($user);
                    if (!$role->has_cap('premium_content')) {
                        $role->add_cap('premium_content');
                    }
                }
                $General = array('premium_caps' => true);
                powerpress_save_settings($General);
                powerpress_page_message_add_notice(__('Podcast Password Protection Capabilities for Custom Channel Feeds added successfully.', 'powerpress'));
                break;
            case 'powerpress-remove-feed-caps':
                check_admin_referer('powerpress-remove-feed-caps');
                $users = array('administrator', 'editor', 'author', 'contributor', 'subscriber', 'premium_subscriber', 'powerpress');
                while (list($null, $user) = each($users)) {
                    $role = get_role($user);
                    if (!empty($role)) {
                        if ($role->has_cap('premium_content')) {
                            $role->remove_cap('premium_content');
                        }
                    }
                }
                remove_role('premium_subscriber');
                $General = array('premium_caps' => false);
                powerpress_save_settings($General);
                powerpress_page_message_add_notice(__('Podcast Password Protection Capabilities for Custom Channel Feeds removed successfully.', 'powerpress'));
                break;
            case 'powerpress-clear-update_plugins':
                check_admin_referer('powerpress-clear-update_plugins');
                delete_option('update_plugins');
                // OLD method
                delete_option('_site_transient_update_plugins');
                // New method
                powerpress_page_message_add_notice(sprintf(__('Plugins Update Cache cleared successfully. You may now to go the %s page to see the latest plugin versions.', 'powerpress'), '<a href="' . admin_url() . 'plugins.php" title="' . __('Manage Plugins', 'powerpress') . '">' . __('Manage Plugins', 'powerpress') . '</a>'));
                break;
        }
    }
    // Handle edit from category page
    if (isset($_POST['from_categories'])) {
        if (version_compare($GLOBALS['wp_version'], '3.0', '<')) {
            wp_redirect('categories.php?message=3');
        } else {
            wp_redirect('edit-tags.php?taxonomy=category&message=3');
        }
        exit;
    }
    // Hnadle player settings
    require_once POWERPRESS_ABSPATH . '/powerpressadmin-player.php';
    powerpress_admin_players_init();
}
function powerpress_admin_categoryfeeds()
{
    $General = powerpress_get_settings('powerpress_general');
    ?>
<h2><?php 
    echo __('Category Podcasting', 'powerpress');
    ?>
</h2>
<p>
	<?php 
    echo __('Category Podcasting adds custom podcast settings to specific blog category feeds, allowing you to organize episodes by topic.', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo sprintf(__('If you are looking to organize episodes by file or format, please use %s.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') . '" title="' . __('Custom Podcast Channels') . '">' . __('Custom Podcast Channels') . '</a>');
    ?>
</p><style type="text/css">
.column-url {
	width: 40%;
}
.column-name {
	width: 30%;
}
.column-feed-slug {
	width: 15%;
}
.column-episode-count {
	width: 15%;
}
.category-list {
	width: 100%;
}
</style>
<div id="col-container">

<div id="col-right">
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('powerpressadmin_categoryfeeds');
    ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
    print_column_headers('powerpressadmin_categoryfeeds', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $Feeds = array();
    if (isset($General['custom_cat_feeds'])) {
        $Feeds = $General['custom_cat_feeds'];
    }
    $count = 0;
    while (list($null, $cat_ID) = each($Feeds)) {
        if (empty($cat_ID)) {
            continue;
        }
        $category = get_category_to_edit($cat_ID);
        if (is_wp_error($category)) {
            // $cat_ID does not existing
            continue;
        }
        //var_dump($category);
        $columns = powerpress_admin_customfeeds_columns();
        $hidden = array();
        if ($count % 2 == 0) {
            echo '<tr valign="middle" class="alternate">';
        } else {
            echo '<tr valign="middle">';
        }
        $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;action=powerpress-editcategoryfeed&amp;cat=') . $cat_ID;
        $feed_title = $category->name;
        $url = get_category_feed_link($cat_ID);
        $short_url = str_replace('http://', '', $url);
        $short_url = str_replace('www.', '', $short_url);
        if (strlen($short_url) > 35) {
            $short_url = substr($short_url, 0, 32) . '...';
        }
        foreach ($columns as $column_name => $column_display_name) {
            $class = "class=\"column-{$column_name}\"";
            //$short_url = '';
            switch ($column_name) {
                case 'feed-slug':
                    echo "<td {$class}>{$category->slug}";
                    echo "</td>";
                    break;
                case 'name':
                    echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . esc_html($feed_title) . '</a></strong><br />';
                    $actions = array();
                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>';
                    $actions['remove'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;action=powerpress-delete-category-feed&amp;cat={$cat_ID}", 'powerpress-delete-category-feed-' . $cat_ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for category feed '%s'\n  'Cancel' to stop, 'OK' to delete.", 'powerpress'), esc_html($feed_title))) . "') ) { return true;}return false;\">" . __('Remove', 'powerpress') . "</a>";
                    $action_count = count($actions);
                    $i = 0;
                    echo '<div class="row-actions">';
                    foreach ($actions as $action => $linkaction) {
                        ++$i;
                        $i == $action_count ? $sep = '' : ($sep = ' | ');
                        echo '<span class="' . $action . '">' . $linkaction . $sep . '</span>';
                    }
                    echo '</div>';
                    echo '</td>';
                    break;
                case 'url':
                    echo "<td {$class}><a href='{$url}' title='" . esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title)) . "' target=\"_blank\">{$short_url}</a>";
                    echo '<div class="row-actions">';
                    if (defined('POWERPRESS_FEEDVALIDATOR_URL')) {
                        echo '<span class="' . $action . '"><a href="' . POWERPRESS_FEEDVALIDATOR_URL . urlencode(str_replace('&amp;', '&', $url)) . '" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
                    }
                    echo '</div>';
                    echo "</td>";
                    break;
                case 'episode-count':
                    echo "<td {$class}>{$episode_total}";
                    echo "</td>";
                    break;
                default:
                    break;
            }
        }
        echo "\n    </tr>\n";
        $count++;
    }
    ?>
	</tbody>
</table>
</div> <!-- col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
    echo __('Add Podcast Settings to existing Category Feed', 'powerpress');
    ?>
</h3>
<input type="hidden" name="action" value="powerpress-addcategoryfeed" />
<input type="hidden" name="taxonomy" value="category" />
<?php 
    //wp_original_referer_field(true, 'previous');
    wp_nonce_field('powerpress-add-taxonomy-feed');
    ?>

<div class="form-field form-required">
	<label for="feed_name"><?php 
    echo __('Category', 'powerpress');
    ?>
</label>
<?php 
    wp_dropdown_categories(array('class' => 'category-list', 'show_option_none' => __('Select Category', 'powerpress'), 'orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 1, 'name' => 'term', 'id' => 'term_id'));
    ?>
	
    
</div>

<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
    echo __('Add Podcast Settings to Category Feed', 'powerpress');
    ?>
" /></p>

</div>
</div>

</div> <!-- col-left -->

</div> <!-- col-container -->

<h3><?php 
    echo __('Example Usage', 'powerpress');
    ?>
</h3>
<p>
	<?php 
    echo __('Example 1: You have a podcast that covers two topics that sometimes share same posts and sometimes do not. Use your main podcast feed as a combined feed of both topics 	and use category feeds to distribute topic specific episodes.', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo __('Example 2: You want to use categories to keep episodes separate from each other. Each category can be used to distribute separate podcasts with the main podcast feed combining all categories to provide a network feed.', 'powerpress');
    ?>
</p>

<?php 
}
function powerpress_admin_defaults()
{
    $FeedAttribs = array('type' => 'general', 'feed_slug' => '', 'category_id' => 0, 'term_taxonomy_id' => 0, 'term_id' => 0, 'taxonomy_type' => '', 'post_type' => '');
    $General = powerpress_get_settings('powerpress_general');
    $General = powerpress_default_settings($General, 'basic');
    $FeedSettings = powerpress_get_settings('powerpress_feed');
    $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
    // Make sure variables are set
    if (empty($FeedSettings['title'])) {
        $FeedSettings['title'] = '';
    }
    $Step = 0;
    if (!empty($FeedSettings['itunes_cat_1']) && !empty($FeedSettings['email']) && !empty($FeedSettings['itunes_image'])) {
        $Step = 1;
    }
    $episode_total = 0;
    if ($Step == 1) {
        $episode_total = powerpress_admin_episodes_per_feed('podcast');
        if ($episode_total > 0) {
            $Step = 2;
        }
    }
    if ($Step == 2 && !empty($FeedSettings['itunes_url'])) {
        $Step = 3;
    }
    $MultiSiteServiceSettings = false;
    if (is_multisite()) {
        $MultiSiteSettings = get_site_option('powerpress_multisite');
        if (!empty($MultiSiteSettings['services_multisite_only'])) {
            $MultiSiteServiceSettings = true;
        }
    }
    ?>
<script type="text/javascript"><!--


jQuery(document).ready(function($) {
	jQuery('#powerpress_advanced_mode_button').click( function(event) {
		event.preventDefault();
		jQuery('#powerpress_advanced_mode').val('1');
		jQuery(this).closest("form").submit();
	} );
} );
//-->
</script>
<input type="hidden" name="action" value="powerpress-save-defaults" />
<input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="0" />

<div id="powerpress_admin_header">
<h2><?php 
    echo __('Blubrry PowerPress Settings', 'powerpress');
    ?>
</h2> 
<span class="powerpress-mode"><?php 
    echo __('Simple Mode', 'powerpress');
    ?>
	&nbsp; <a href="<?php 
    echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php&amp;mode=advanced");
    ?>
" id="powerpress_advanced_mode_button" class="button-primary"><?php 
    echo __('Switch to Advanced Mode', 'powerpress');
    ?>
</a>
</span>
</div>

<?php 
    powerpressadmin_default_steps($FeedSettings, $General, $Step);
    if ($MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION')) {
        PowerPressMultiSitePlugin::edit_blubrry_services($General);
    } else {
        powerpressadmin_edit_blubrry_services($General);
    }
    ?>
<h3><?php 
    echo __('Podcast Settings', 'powerpress');
    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
    echo __('Program Title', 'powerpress');
    ?>
</th>
<td>
<input type="text" name="Feed[title]" style="width: 60%;"  value="<?php 
    echo esc_attr($FeedSettings['title']);
    ?>
" maxlength="255" />
(<?php 
    echo __('leave blank to use blog title', 'powerpress');
    ?>
)
<p><?php 
    echo __('Blog title:', 'powerpress') . ' ' . get_bloginfo_rss('name');
    ?>
</p>
</td>
</tr>
</table>
<?php 
    if ($Step > 1) {
        // Only display if we have episdoes in the feed!
        powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    }
    // iTunes settings (in simple mode of course)
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_artwork($FeedSettings, $General);
    powerpressadmin_appearance($General, $FeedSettings);
    powerpressadmin_advanced_options($General);
}
function powerpress_admin_taxonomyfeeds()
{
    $General = powerpress_get_settings('powerpress_general');
    ?>
<h2><?php 
    echo __('Taxonomy Podcasting', 'powerpress');
    ?>
</h2>
<p>
	<?php 
    echo __('Taxonomy Podcasting adds custom podcast settings to specific taxonomy feeds.', 'powerpress');
    ?>
</p>
<style type="text/css">
.column-url {
	width: 40%;
}
.column-name {
	width: 30%;
}
.column-feed-slug {
	width: 15%;
}
.column-episode-count {
	width: 15%;
}
.category-list {
	width: 100%;
}
.form-field select {
	width: 95%;
}
</style>
<div id="col-container">

<div id="col-right">
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('powerpressadmin_taxonomyfeeds');
    ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
    print_column_headers('powerpressadmin_taxonomyfeeds', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
    if (empty($PowerPressTaxonomies)) {
        $PowerPressTaxonomies = array();
    }
    $count = 0;
    while (list($tt_id, $null) = each($PowerPressTaxonomies)) {
        $taxonomy_type = '';
        $term_ID = '';
        global $wpdb;
        $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM {$wpdb->term_taxonomy} WHERE term_taxonomy_id = {$tt_id}", ARRAY_A);
        if (!empty($term_info[0]['term_id'])) {
            $term_ID = $term_info[0]['term_id'];
            $taxonomy_type = $term_info[0]['taxonomy'];
        } else {
            continue;
            // we didn't find this taxonomy relationship
        }
        //	var_dump($term_info);
        //$category = get_category_to_edit($cat_ID);
        $term_object = get_term($term_ID, $taxonomy_type, OBJECT, 'edit');
        $columns = powerpress_admin_taxonomyfeeds_columns();
        $hidden = array();
        if ($count % 2 == 0) {
            echo '<tr valign="middle" class="alternate">';
        } else {
            echo '<tr valign="middle">';
        }
        $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_taxonomyfeeds.php&amp;action=powerpress-edittaxonomyfeed&amp;term=' . $term_ID . '&taxonomy=' . $taxonomy_type . '&amp;ttid=' . $tt_id);
        $feed_title = $term_object->name;
        $url = get_term_feed_link($term_ID, $taxonomy_type, 'rss2');
        $short_url = str_replace('http://', '', $url);
        $short_url = str_replace('www.', '', $short_url);
        if (strlen($short_url) > 35) {
            $short_url = substr($short_url, 0, 32) . '...';
        }
        foreach ($columns as $column_name => $column_display_name) {
            $class = "class=\"column-{$column_name}\"";
            //$short_url = '';
            switch ($column_name) {
                case 'feed-slug':
                    echo "<td {$class}>{$term_object->slug}";
                    echo "</td>";
                    break;
                case 'name':
                    echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . esc_attr($feed_title) . '</a></strong><br />';
                    $actions = array();
                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>';
                    $actions['remove'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_taxonomyfeeds.php&amp;action=powerpress-delete-taxonomy-feed&amp;ttid={$tt_id}", 'powerpress-delete-taxonomy-feed-' . $tt_id) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for taxonomy '%s'\n  'Cancel' to stop, 'OK' to delete.", 'powerpress'), esc_attr($feed_title))) . "') ) { return true;}return false;\">" . __('Remove', 'powerpress') . "</a>";
                    $action_count = count($actions);
                    $i = 0;
                    echo '<div class="row-actions">';
                    foreach ($actions as $action => $linkaction) {
                        ++$i;
                        $i == $action_count ? $sep = '' : ($sep = ' | ');
                        echo '<span class="' . $action . '">' . $linkaction . $sep . '</span>';
                    }
                    echo '</div>';
                    echo '</td>';
                    break;
                case 'url':
                    echo "<td {$class}><a href='{$url}' title='" . esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title)) . "' target=\"_blank\">{$short_url}</a>";
                    echo '<div class="row-actions">';
                    if (defined('POWERPRESS_FEEDVALIDATOR_URL')) {
                        echo '<span class="' . $action . '"><a href="' . POWERPRESS_FEEDVALIDATOR_URL . urlencode(str_replace('&amp;', '&', $url)) . '" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
                    }
                    echo '</div>';
                    echo "</td>";
                    break;
                case 'episode-count':
                    echo "<td {$class}>{$episode_total}";
                    echo "</td>";
                    break;
                case 'taxonomy':
                    echo "<td {$class}>{$taxonomy_type}";
                    echo "</td>";
                    break;
                default:
                    break;
            }
        }
        echo "\n    </tr>\n";
        $count++;
    }
    ?>
	</tbody>
</table>
</div> <!-- col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
    echo __('Add Podcasting to Existing Taxonomy Term', 'powerpress');
    ?>
</h3>
<?php 
    $current_taxonomy = isset($_GET['taxonomy']) ? $_GET['taxonomy'] : (isset($_POST['taxonomy']) ? $_POST['taxonomy'] : '');
    if (empty($current_taxonomy)) {
        ?>
<div class="form-field form-required">
<label><?php 
        echo __('Step 1 - Select Taxonomy', 'powerpress');
        ?>
</label>
<select id="powerpress_taxonomy_select" name="taxonomy" style="width: 95%;">
	<option value=""><?php 
        echo __('Select Taxonomy', '');
        ?>
</option>
<?php 
        $taxonomies = get_taxonomies('', 'names');
        while (list($null, $taxonomy) = each($taxonomies)) {
            if ($taxonomy == 'category') {
                continue;
            }
            $taxonomy = htmlspecialchars($taxonomy);
            echo "\t<option value=\"{$taxonomy}\"" . ($current_taxonomy == $taxonomy ? ' selected' : '') . ">{$taxonomy}</option>\n";
        }
        ?>

<?php 
        ?>
</select>
</div>
<p class="submit"><input type="submit" class="button" name="select_taxonomy" value="<?php 
        echo __('Select Taxonomy Term', 'powerpress');
        ?>
" /></p>

<?php 
    }
    if (!empty($current_taxonomy)) {
        ?>
<input type="hidden" name="action" value="powerpress-addtaxonomyfeed" />
<input type="hidden" name="taxonomy" value="<?php 
        echo esc_attr($current_taxonomy);
        ?>
" />
<?php 
        //wp_original_referer_field(true, 'previous');
        wp_nonce_field('powerpress-add-taxonomy-feed');
        ?>
<div class="form-field form-required">
	<label for="term"><?php 
        echo __('Step 2 - Select Taxonomy Term', 'powerpress');
        ?>
</label>
<?php 
        wp_dropdown_categories(array('class' => '', 'show_option_none' => __('Select Term', 'powerpress'), 'orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 1, 'name' => 'term', 'id' => 'term_id', 'taxonomy' => $current_taxonomy));
        ?>
</div>

<p class="submit">
	<input type="submit" class="button" name="add_podcasting" value="<?php 
        echo __('Add Podcast Settings to Term', 'powerpress');
        ?>
" /> &nbsp; 
	<input type="submit" class="button" name="cancel" value="<?php 
        echo __('Cancel', 'powerpress');
        ?>
" />
</p>
<?php 
    }
    ?>

</div>
</div>

</div> <!-- col-left -->

</div> <!-- col-container -->

<?php 
}
function powerpress_admin_search()
{
    $General = powerpress_get_settings('powerpress_general');
    if (empty($General['seo_feed_title'])) {
        $General['seo_feed_title'] = '';
    }
    ?>
<script language="javascript"><!--

jQuery(document).ready(function() {
	
<?php 
    if (empty($General['seo_append_show_title'])) {
        echo "\tjQuery('#powerpress_example_show_title').hide();\n";
    }
    if (!empty($General['seo_feed_title']) && $General['seo_feed_title'] == 1) {
        echo "\tjQuery('#powerpress_example_post_title').hide();\n";
    }
    ?>
	jQuery('#seo_feed_title').change( function() {
		if( this.checked )
			jQuery('#powerpress_seo_feed_title_1').prop('checked', true);
		else
			jQuery('.powerpress_seo_feed_title').prop('checked', false);
	});
	jQuery('#seo_append_show_title').change( function() {
		if( jQuery(this).prop('checked') )
			jQuery('#powerpress_example_show_title').show();
		else
			jQuery('#powerpress_example_show_title').hide();
	});
	jQuery('.powerpress_seo_feed_title').change( function() {
		
		jQuery('#seo_feed_title').prop('checked', true);
		switch( this.value )
		{
			case '1':
			case 1: {
				jQuery('#powerpress_example_post_title').hide();
			}; break;
			case '2':
			case 2: {
				jQuery('#powerpress_example_post_title').show();
				
				var p_title_html = jQuery('#powerpress_example_post_title')[0].outerHTML;
				var e_title_html = jQuery('#powerpress_example_episode_title')[0].outerHTML;
				jQuery('#powerpress_example_post_episode_title').html( e_title_html + p_title_html);
			}; break;
			case '3':
			case 3: {
				jQuery('#powerpress_example_post_title').show();
				
				var p_title_html = jQuery('#powerpress_example_post_title')[0].outerHTML;
				var e_title_html = jQuery('#powerpress_example_episode_title')[0].outerHTML;
				jQuery('#powerpress_example_post_episode_title').html( p_title_html + e_title_html);
			}; break;
			default: {
				
			}
		}
	});
});
//-->
</script>
<input type="hidden" name="action" value="powerpress-save-search" />
<h2><?php 
    echo __('Podcasting SEO', 'powerpress');
    ?>
</h2>

<p><?php 
    echo __('Enable features to help with podcasting search engine optimization (SEO). The following options can assist your web and podcasting SEO strategies.', 'powerpress');
    ?>
</p>
<p>
	<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/podcasting-seo-settings/"  target="_blank"><?php 
    echo __('Learn More', 'powerpress');
    ?>
</a>
</p>


<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
    echo __('Episode Titles', 'powerpress');
    ?>
</th> 
<td>
	<p>
		<label for="seo_feed_title">
		<input name="PowerPressSearchToggle[seo_feed_title]" type="hidden" value="0" />
		<input id="seo_feed_title" name="PowerPressSearchToggle[seo_feed_title]" type="checkbox" value="1" <?php 
    if (!empty($General['seo_feed_title'])) {
        echo 'checked ';
    }
    ?>
 /> 
		<?php 
    echo __('Specify custom episode titles for podcast feeds.', 'powerpress');
    ?>
</label>
	</p>
	<div style="margin-left: 40px;">
		<p><label style="display: block;"><input type="radio" class="powerpress_seo_feed_title" id="powerpress_seo_feed_title_1" name="General[seo_feed_title]" value="1" <?php 
    if ($General['seo_feed_title'] == 1) {
        echo 'checked';
    }
    ?>
 />
			<?php 
    echo __('Feed episode title replaces post title (default)', 'powerpress');
    ?>
</label></p>
		<p><label style="display: block;"><input type="radio" class="powerpress_seo_feed_title" id="powerpress_seo_feed_title_2" name="General[seo_feed_title]" value="2" <?php 
    if ($General['seo_feed_title'] == 2) {
        echo 'checked';
    }
    ?>
 /> 
			<?php 
    echo __('Feed episode title prefixes post title', 'powerpress');
    ?>
</label></p>
		<p><label style="display: block;"><input type="radio" class="powerpress_seo_feed_title" id="powerpress_seo_feed_title_3" name="General[seo_feed_title]" value="3" <?php 
    if ($General['seo_feed_title'] == 3) {
        echo 'checked';
    }
    ?>
 /> 
			<?php 
    echo __('Feed episode title appended to post title', 'powerpress');
    ?>
</label></p>
	</div>
	<p>
		<label for="seo_append_show_title">
		<input name="General[seo_append_show_title]" type="hidden" value="0" />
		<input id="seo_append_show_title" name="General[seo_append_show_title]" type="checkbox" value="1" <?php 
    if (!empty($General['seo_append_show_title'])) {
        echo 'checked ';
    }
    ?>
 /> 
		<?php 
    echo __('Append show title to episode titles.', 'powerpress');
    ?>
</label>
	</p>
	<p style="margin: 10px 0 0 40px;">
		<strong><?php 
    echo __('Example based on options selected above:', 'powerpress');
    ?>
</strong><br /><i>
		<span id="powerpress_example_post_episode_title">
			<span id="powerpress_example_post_title" style="margin: 0 5px;"> <?php 
    echo __('Blog Post Title', 'powerpress');
    ?>
 </span>
			<span id="powerpress_example_episode_title" style="margin: 0 5px;"> <?php 
    echo __('Custom Episode Title', 'powerpress');
    ?>
 </span>
		</span>
		<span id="powerpress_example_show_title"> - <span style="margin: 0 5px;"><?php 
    echo __('Show Title', 'powerpress');
    ?>
</span></span>
		</i>
	</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php 
    echo __('AudioObjects', 'powerpress');
    ?>
</th> 
<td>
	<p>
		<input name="General[seo_audio_objects]" type="hidden" value="0" />
		<input name="General[seo_audio_objects]" type="checkbox" value="1" <?php 
    if (!empty($General['seo_audio_objects'])) {
        echo 'checked ';
    }
    ?>
 /> 
		<?php 
    echo __('Schema.org audio objects in microdata format.', 'powerpress');
    ?>
	</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php 
    echo __('VideoObjects', 'powerpress');
    ?>
</th> 
<td>
	<p>
		<input name="General[seo_video_objects]" type="hidden" value="0" />
		<input name="General[seo_video_objects]" type="checkbox" value="1" <?php 
    if (!empty($General['seo_video_objects'])) {
        echo 'checked ';
    }
    ?>
 /> 
		<?php 
    echo __('Schema.org video objects in microdata format.', 'powerpress');
    ?>
	</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php 
    echo __('Podcast Directory SEO Guidance', 'powerpress');
    ?>
</th> 
<td>
	<p>
		<input name="General[seo_itunes]" type="hidden" value="0" />
		<input name="General[seo_itunes]" type="checkbox" value="1" <?php 
    if (!empty($General['seo_itunes'])) {
        echo 'checked ';
    }
    ?>
 /> 
		<?php 
    echo __('Enable and highlight features that help with Podcast Directory Search Engine Optimization.', 'powerpress');
    ?>
	</p>
	<p>
	<ul>
			<li>
		<ul>
			<li>
				<?php 
    echo __('Highlight fields for Podcasting SEO', 'powerpress');
    ?>
			</li>
			<li>
				<?php 
    echo __('Enables iTunes Subtitle field', 'powerpress');
    ?>
			</li>
			<li>
				<?php 
    echo __('Enables Google Play Music Description field', 'powerpress');
    ?>
			</li>
			<li>
				<?php 
    echo __('Enables iTunes Author field', 'powerpress');
    ?>
			</li>
			<li>
				<?php 
    echo __('Enables Enhanced iTunes Summary feature', 'powerpress');
    ?>
			</li>
		</ul>
			</li>
		</ul>
	</p>
</td>
</tr>
</table>

<?php 
    ?>

<?php 
}
Esempio n. 13
0
function powerpress_edit_post($post_ID, $post)
{
    if (!current_user_can('edit_post', $post_ID)) {
        return $post_ID;
    }
    $GeneralSettings = get_option('powerpress_general');
    if (isset($GeneralSettings['auto_enclose']) && $GeneralSettings['auto_enclose']) {
        powerpress_do_enclose($post->post_content, $post_ID, $GeneralSettings['auto_enclose'] == 2);
    }
    $Episodes = isset($_POST['Powerpress']) ? $_POST['Powerpress'] : false;
    if ($Episodes) {
        while (list($feed_slug, $Powerpress) = each($Episodes)) {
            $field = 'enclosure';
            if ($feed_slug != 'podcast') {
                $field = '_' . $feed_slug . ':enclosure';
            }
            if (!empty($Powerpress['remove_podcast'])) {
                delete_post_meta($post_ID, $field);
                if ($feed_slug == 'podcast') {
                    // Clean up the old data
                    delete_post_meta($post_ID, 'itunes:duration');
                }
            } else {
                if (!empty($Powerpress['change_podcast']) || !empty($Powerpress['new_podcast'])) {
                    // No URL specified, then it's not really a podcast to save
                    if ($Powerpress['url'] == '') {
                        continue;
                    }
                    // go to the next media file
                    // Initialize the important variables:
                    $MediaURL = $Powerpress['url'];
                    if (!empty($GeneralSettings['default_url']) && strpos($MediaURL, 'http://') !== 0 && strpos($MediaURL, 'https://') !== 0 && empty($Powerpress['hosting'])) {
                        $MediaURL = rtrim($GeneralSettings['default_url'], '/') . '/' . ltrim($MediaURL, '/');
                    }
                    $FileSize = '';
                    $ContentType = '';
                    $Duration = false;
                    if ($Powerpress['set_duration'] == 0) {
                        $Duration = '';
                    }
                    // allow the duration to be detected
                    // Get the content type based on the file extension, first we have to remove query string if it exists
                    $UrlParts = parse_url($Powerpress['url']);
                    if ($UrlParts['path']) {
                        // using functions that already exist in WordPress when possible:
                        $ContentType = powerpress_get_contenttype($UrlParts['path']);
                    }
                    if (!$ContentType) {
                        $error = __('Error', 'powerpress') . " [{$Powerpress['url']}]: " . __('Unable to determine content type of media (e.g. audio/mpeg). Verify file extension is correct and try again.', 'powerpress');
                        powerpress_add_error($error);
                        continue;
                    }
                    //Set the duration specified by the user
                    if ($Powerpress['set_duration'] == 1 || $Powerpress['set_duration'] == 0) {
                        $Duration = sprintf('%02d:%02d:%02d', $Powerpress['duration_hh'], $Powerpress['duration_mm'], $Powerpress['duration_ss']);
                    }
                    //Set the file size specified by the user
                    if ($Powerpress['set_size'] == 1) {
                        $FileSize = $Powerpress['size'];
                    }
                    if ($Powerpress['set_size'] == 0 || $Powerpress['set_duration'] == 0) {
                        if (!empty($Powerpress['hosting'])) {
                            if ($Powerpress['set_size'] == 0 || $Powerpress['set_duration'] == 0) {
                                $MediaInfo = powerpress_get_media_info($Powerpress['url']);
                                if (!isset($MediaInfo['error'])) {
                                    if ($Powerpress['set_size'] == 0) {
                                        $FileSize = $MediaInfo['length'];
                                    }
                                    if ($Powerpress['set_duration'] == 0 && !empty($MediaInfo['duration'])) {
                                        $Duration = powerpress_readable_duration($MediaInfo['duration'], true);
                                    }
                                } else {
                                    $error = __('Error', 'powerpress') . " ({$Powerpress['url']}): {$MediaInfo['error']}";
                                    powerpress_add_error($error);
                                    continue;
                                }
                            }
                        } else {
                            if (empty($Powerpress['set_duration'])) {
                                $MediaInfo = powerpress_get_media_info_local($MediaURL, $ContentType, 0, '');
                            } else {
                                $MediaInfo = powerpress_get_media_info_local($MediaURL, $ContentType, 0, $Duration);
                            }
                            if (isset($MediaInfo['error'])) {
                                $error = __('Error', 'powerpress') . " (<a href=\"{$MediaURL}\" target=\"_blank\">{$MediaURL}</a>): {$MediaInfo['error']}";
                                powerpress_add_error($error);
                                //continue;
                            } else {
                                if (empty($MediaInfo['length'])) {
                                    $error = __('Error', 'powerpress') . " (<a href=\"{$MediaURL}\" target=\"_blank\">{$MediaURL}</a>): " . __('Unable to obtain size of media.', 'powerpress');
                                    powerpress_add_error($error);
                                    //continue;
                                } else {
                                    // Detect the duration
                                    if (empty($Powerpress['set_duration']) && !empty($MediaInfo['duration'])) {
                                        $Duration = powerpress_readable_duration($MediaInfo['duration'], true);
                                    }
                                    // Fix so it looks better when viewed for editing
                                    // Detect the file size
                                    if (empty($Powerpress['set_size']) && $MediaInfo['length'] > 0) {
                                        $FileSize = $MediaInfo['length'];
                                    }
                                }
                            }
                        }
                    }
                    // If we made if this far, we have the content type and file size...
                    $EnclosureData = $MediaURL . "\n" . $FileSize . "\n" . $ContentType;
                    $ToSerialize = array();
                    if (!empty($Powerpress['hosting'])) {
                        $ToSerialize['hosting'] = 1;
                    }
                    // iTunes duration
                    if ($Duration && ltrim($Duration, '0:') != '') {
                        // If all the zeroz and : are trimmed from the front and you're left with an empty value then don't save it.
                        $ToSerialize['duration'] = $Duration;
                    }
                    // regular expression '/^(\d{1,2}\:)?\d{1,2}\:\d\d$/i' (examples: 1:23, 12:34, 1:23:45, 12:34:56)
                    // iTunes Subtitle
                    if (isset($Powerpress['subtitle']) && trim($Powerpress['subtitle']) != '') {
                        $ToSerialize['subtitle'] = stripslashes($Powerpress['subtitle']);
                    }
                    // iTunes Summary
                    if (isset($Powerpress['summary']) && trim($Powerpress['summary']) != '') {
                        $ToSerialize['summary'] = stripslashes($Powerpress['summary']);
                    }
                    // iTunes keywords (Deprecated by Apple)
                    if (isset($Powerpress['keywords']) && trim($Powerpress['keywords']) != '') {
                        $ToSerialize['keywords'] = stripslashes($Powerpress['keywords']);
                    }
                    // iTunes Author
                    if (isset($Powerpress['author']) && trim($Powerpress['author']) != '') {
                        $ToSerialize['author'] = stripslashes($Powerpress['author']);
                    }
                    // iTunes Explicit
                    if (isset($Powerpress['explicit']) && trim($Powerpress['explicit']) != '') {
                        $ToSerialize['explicit'] = $Powerpress['explicit'];
                    }
                    // iTunes CC
                    if (isset($Powerpress['cc']) && trim($Powerpress['cc']) != '') {
                        $ToSerialize['cc'] = $Powerpress['cc'];
                    }
                    // iTunes Episode image
                    if (isset($Powerpress['itunes_image']) && trim($Powerpress['itunes_image']) != '') {
                        $ToSerialize['itunes_image'] = $Powerpress['itunes_image'];
                    }
                    // order
                    if (isset($Powerpress['order']) && trim($Powerpress['order']) != '') {
                        $ToSerialize['order'] = $Powerpress['order'];
                    }
                    // always
                    if (isset($Powerpress['always']) && trim($Powerpress['always']) != '') {
                        $ToSerialize['always'] = $Powerpress['always'];
                    }
                    // iTunes Block (FUTURE USE)
                    if (isset($Powerpress['block']) && $Powerpress['block'] == '1') {
                        $ToSerialize['block'] = 1;
                    }
                    // Player Embed
                    if (isset($Powerpress['embed']) && trim($Powerpress['embed']) != '') {
                        $ToSerialize['embed'] = stripslashes($Powerpress['embed']);
                    }
                    // we have to strip slahes if they are present befure we serialize the data
                    if (isset($Powerpress['image']) && trim($Powerpress['image']) != '') {
                        $ToSerialize['image'] = stripslashes($Powerpress['image']);
                    }
                    if (isset($Powerpress['no_player']) && $Powerpress['no_player']) {
                        $ToSerialize['no_player'] = 1;
                    }
                    if (isset($Powerpress['no_links']) && $Powerpress['no_links']) {
                        $ToSerialize['no_links'] = 1;
                    }
                    if (isset($Powerpress['ishd']) && $Powerpress['ishd']) {
                        $ToSerialize['ishd'] = 1;
                    }
                    if (isset($Powerpress['width']) && trim($Powerpress['width'])) {
                        $ToSerialize['width'] = stripslashes(trim($Powerpress['width']));
                    }
                    if (isset($Powerpress['height']) && trim($Powerpress['height'])) {
                        $ToSerialize['height'] = stripslashes(trim($Powerpress['height']));
                    }
                    if (!empty($Powerpress['feed_title']) && trim($Powerpress['feed_title'])) {
                        $ToSerialize['feed_title'] = stripslashes(trim($Powerpress['feed_title']));
                    }
                    if (isset($Powerpress['no_player_and_links']) && $Powerpress['no_player_and_links']) {
                        $ToSerialize['no_player'] = 1;
                        $ToSerialize['no_links'] = 1;
                    }
                    // WebM Support:
                    if (!empty($Powerpress['webm_src'])) {
                        $WebMSrc = $Powerpress['webm_src'];
                        if (!empty($GeneralSettings['default_url']) && strpos($WebMSrc, 'http://') !== 0) {
                            $WebMSrc = rtrim($GeneralSettings['default_url'], '/') . '/' . ltrim($WebMSrc, '/');
                        }
                        $ToSerialize['webm_src'] = $WebMSrc;
                        $MediaInfo = powerpress_get_media_info_local($WebMSrc, 'video/webm', 0, '');
                        if (isset($MediaInfo['error'])) {
                            $error = __('Error', 'powerpress') . " ({$WebMSrc}): {$MediaInfo['error']}";
                            powerpress_add_error($error);
                        } else {
                            if (empty($MediaInfo['length'])) {
                                $error = __('Error', 'powerpress') . " ({$WebMSrc}): " . __('Unable to obtain size of media.', 'powerpress');
                                powerpress_add_error($error);
                            } else {
                                $ToSerialize['webm_length'] = $MediaInfo['length'];
                            }
                        }
                    }
                    if ($Powerpress['set_duration'] == -1) {
                        unset($ToSerialize['duration']);
                    }
                    if (count($ToSerialize) > 0) {
                        // Lets add the serialized data
                        $EnclosureData .= "\n" . serialize($ToSerialize);
                    }
                    if (!empty($Powerpress['new_podcast'])) {
                        add_post_meta($post_ID, $field, $EnclosureData, true);
                    } else {
                        update_post_meta($post_ID, $field, $EnclosureData);
                        if ($feed_slug == 'podcast') {
                            delete_post_meta($post_ID, 'itunes:duration');
                        }
                        // Simple cleanup, we're storing the duration in the enclosure as serialized value
                    }
                }
            }
        }
        // Loop through posted episodes...
        // Check for PowerpressFeature for each channel...
        if (isset($_POST['PowerpressFeature'])) {
            $FeatureEpisodes = powerpress_get_settings('powerpress_itunes_featured');
            if (empty($FeatureEpisodes) && !is_array($FeatureEpisodes)) {
                $FeatureEpisodes = array();
            }
            $PowerpressFeature = $_POST['PowerpressFeature'];
            while (list($feed_slug, $set_featured) = each($PowerpressFeature)) {
                if (!empty($set_featured)) {
                    $FeatureEpisodes[$feed_slug] = $post_ID;
                } else {
                    unset($FeatureEpisodes[$feed_slug]);
                }
            }
            powerpress_save_settings($FeatureEpisodes, 'powerpress_itunes_featured');
        }
        if (!empty($GeneralSettings['metamarks'])) {
            require_once POWERPRESS_ABSPATH . '/powerpressadmin-metamarks.php';
            powerpress_metabox_save($post_ID);
        }
    }
    // Anytime the post is marked published, private or scheduled for the future we need to make sure we're making the media available for hosting
    if ($post->post_status == 'publish' || $post->post_status == 'private' || $post->post_status == 'future') {
        if (!empty($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting'] !== 'false') {
            powerpress_process_hosting($post_ID, $post->post_title);
        }
        // Call anytime blog post is in the published state
    }
    // And we're done!
    return $post_ID;
}
Esempio n. 14
0
function powerpressadmin_appearance($General = false)
{
    if ($General === false) {
        $General = powerpress_get_settings('powerpress_general');
    }
    $General = powerpress_default_settings($General, 'appearance');
    if (!isset($General['player_function'])) {
        $General['player_function'] = 1;
    }
    if (!isset($General['player_aggressive'])) {
        $General['player_aggressive'] = 0;
    }
    if (!isset($General['new_window_width'])) {
        $General['new_window_width'] = '';
    }
    if (!isset($General['new_window_height'])) {
        $General['new_window_height'] = '';
    }
    if (!isset($General['player_width'])) {
        $General['player_width'] = '';
    }
    if (!isset($General['player_height'])) {
        $General['player_height'] = '';
    }
    if (!isset($General['player_width_audio'])) {
        $General['player_width_audio'] = '';
    }
    if (!isset($General['disable_appearance'])) {
        $General['disable_appearance'] = false;
    }
    $Players = array('podcast' => __('Default Podcast (podcast)', 'powerpress'));
    if (isset($General['custom_feeds'])) {
        while (list($podcast_slug, $podcast_title) = each($General['custom_feeds'])) {
            if ($podcast_slug == 'podcast') {
                continue;
            }
            $Players[$podcast_slug] = sprintf('%s (%s)', $podcast_title, $podcast_slug);
        }
    }
    ?>

<!-- start advanced features -->
<?php 
    if (!empty($General['advanced_mode_2'])) {
        ?>
<h3><?php 
        echo __('Media Appearance Settings', 'powerpress');
        ?>
</h3>
<div id="enable_presentation_settings">
<table class="form-table">
<tr valign="top">
<th scope="row">&nbsp;	</th> 
<td>
	<ul>
		<li><p><label><input type="radio" name="General[disable_appearance]" value="0" <?php 
        if ($General['disable_appearance'] == 0) {
            echo 'checked';
        }
        ?>
 onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'block':'none') );" /> <?php 
        echo __('Enable PowerPress Media Players and Links', 'powerpress');
        ?>
</label> (<?php 
        echo __('default', 'powerpress');
        ?>
)</p>
			<ul><li>
				<p class="description"><?php 
        echo __('PowerPress will add media players and links to your site.', 'powerpress');
        ?>
</p>
			</li></ul>
		</li>
		
		<li><p><label><input type="radio" name="General[disable_appearance]" value="1" <?php 
        if ($General['disable_appearance'] == 1) {
            echo 'checked';
        }
        ?>
 onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'none':'block') );" /> <?php 
        echo __('Disable PowerPress Media Players and Links', 'powerpress');
        ?>
</label></p>
			<ul><li>
				<p class="description"><?php 
        echo __('PowerPress will <u>not</u> add any media players or media links to your site. PowerPress will only be used to add podcasting support to your feeds.', 'powerpress');
        ?>
</p>
			</li></ul>
		</li>
	</ul>
</td>
</tr>
</table>
</div>
<div id="presentation_settings"<?php 
        if ($General['disable_appearance']) {
            echo ' style="display: none;"';
        }
        ?>
>
<!-- start presentation settings -->
<!-- end advanced features -->
<?php 
    }
    ?>

<h3><?php 
    echo __('Blog Posts and Pages', 'powerpress');
    ?>
</h3>


<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
    echo htmlspecialchars(__('Display Media & Links', 'powerpress'));
    ?>
</th> 
<td>
	<ul>
		<li><p><label><input type="radio" name="General[display_player]" value="1" <?php 
    if ($General['display_player'] == 1) {
        echo 'checked';
    }
    ?>
 /> <?php 
    echo __('Below page content', 'powerpress');
    ?>
</label> (<?php 
    echo __('default', 'powerpress');
    ?>
)</p>
				<ul><li>
					<p class="description"><?php 
    echo __('Player and media links will appear <u>below</u> your post and page content.', 'powerpress');
    ?>
<p>
				</li></ul>
		</li>
		<li><p><label><input type="radio" name="General[display_player]" value="2" <?php 
    if ($General['display_player'] == 2) {
        echo 'checked';
    }
    ?>
 /> <?php 
    echo __('Above page content', 'powerpress');
    ?>
</label></p>
			<ul><li>
				<p class="description"><?php 
    echo __('Player and media links will appear <u>above</u> your post and page content.', 'powerpress');
    ?>
</p>
			</li></ul>
		</li>
		<li>
			<p><label><input type="radio" name="General[display_player]" value="0" <?php 
    if ($General['display_player'] == 0) {
        echo 'checked';
    }
    ?>
 /> <?php 
    echo __('Disable', 'powerpress');
    ?>
</label></p>
			<ul><li>
				<p class="description"><?php 
    echo __('Player and media links will <u>NOT</u> appear in your post and page content. Media player and links can be added manually by using the <i>shortcode</i> below.', 'powerpress');
    ?>
</p>
			</li></ul>
		</li>
	</ul>
	<p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php 
    if (!empty($General['display_player_excerpt'])) {
        echo 'checked ';
    }
    ?>
/> <?php 
    echo __('Display media / links in:', 'powerpress');
    ?>
 <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="<?php 
    echo __('WordPress Excerpts', 'powerpress');
    ?>
" target="_blank"><?php 
    echo __('WordPress Excerpts', 'powerpress');
    ?>
</a>  (<?php 
    echo __('e.g. search results', 'powerpress');
    ?>
)</p>
</td>
</tr>
</table>

<?php 
    if (!empty($General['advanced_mode_2'])) {
        ?>
<!-- start advanced features -->
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
        echo __('PowerPress Shortcode', 'powerpress');
        ?>
</th>
<td>
<p>
<?php 
        echo sprintf(__('The %s shortcode is used to position your media presentation (player and download links) exactly where you want within your post or page content.', 'powerpress'), '<code>[powerpress]</code>');
        ?>
 
<?php 
        echo __('Simply insert the following code on a new line in your content.', 'powerpress');
        ?>
</p>
<div style="margin-left: 30px;">
	<code>[powerpress]</code>
</div>
<p>
<?php 
        echo sprintf(__('Please visit the %s page for additional options.', 'powerpress'), '<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/shortcode/" target="_blank">' . __('PowerPress Shortcode', 'powerpress') . '</a>');
        ?>
</p>
<p class="description">
<?php 
        echo __('Note: When specifying a URL to media in the powerpress shortcode, only the player is included. The Media Links will <u>NOT</u> be included since there is not enough meta information to display them.', 'powerpress');
        ?>
</p>
</td>
</tr>

<tr valign="top">
<th scope="row">
<?php 
        echo __('Media Player', 'powerpress');
        ?>
</th>
<td>

<p><label><input type="checkbox" name="PlayerSettings[display_media_player]" value="2" <?php 
        if ($General['player_function'] == 1 || $General['player_function'] == 2) {
            echo 'checked ';
        }
        ?>
/> <?php 
        echo __('Display Player', 'powerpress');
        ?>
</label></p>
<?php 
        /* ?>
        <p style="margin-left: 35px;"><input type="checkbox" name="General[display_player_disable_mobile]" value="1" <?php if( !empty($General['display_player_disable_mobile']) ) echo 'checked '; ?>/> <?php echo __('Disable Media Player for known mobile devices.', 'powerpress'); ?></p>
        <?php */
        ?>
<p><?php 
        echo __('Detected mobile and tablet devices use an HTML5 player with a fallback link to download the media.', 'powerpress');
        ?>
</p>
</td>
</tr>
</table>




<table class="form-table">

<tr valign="top">
<th scope="row">

<?php 
        echo __('Media Links', 'powerpress');
        ?>
</th> 
<td>
	<p><label><input type="checkbox" name="PlayerSettings[display_pinw]" value="3" <?php 
        if ($General['player_function'] == 3 || $General['player_function'] == 1) {
            echo 'checked ';
        }
        ?>
/> <?php 
        echo __('Display Play in new Window Link', 'powerpress');
        ?>
</label></p>
	
	<p><label><input type="checkbox" name="PlayerSettings[display_download]" value="1" <?php 
        if ($General['podcast_link'] != 0) {
            echo 'checked ';
        }
        ?>
/> <?php 
        echo __('Display Download Link', 'powerpress');
        ?>
</label></p>
	
	<p style="margin-left: 35px;"><input type="checkbox" id="display_download_size" name="PlayerSettings[display_download_size]" value="1" <?php 
        if ($General['podcast_link'] == 2 || $General['podcast_link'] == 3) {
            echo 'checked';
        }
        ?>
 onclick="if( !this.checked ) { jQuery('#display_download_duration').removeAttr('checked'); }" /> <?php 
        echo __('Include file size', 'powerpress');
        ?>
	<input type="checkbox" style="margin-left: 30px;" id="display_download_duration" name="PlayerSettings[display_download_duration]" value="1" <?php 
        if ($General['podcast_link'] == 3) {
            echo 'checked';
        }
        ?>
 onclick="if( this.checked ) { jQuery('#display_download_size').attr('checked','checked'); }" /> <?php 
        echo __('Include file size and duration', 'powerpress');
        ?>
</p>
	
	<p><label><input type="checkbox" name="General[podcast_embed]" value="1" <?php 
        if (!empty($General['podcast_embed'])) {
            echo 'checked ';
        }
        ?>
/> <?php 
        echo __('Display Player Embed Link', 'powerpress');
        ?>
 </label></p>
	<p style="margin-left: 35px;">
		<input type="checkbox" name="General[podcast_embed_in_feed]" value="1" <?php 
        if (!empty($General['podcast_embed_in_feed'])) {
            echo 'checked';
        }
        ?>
  /> <?php 
        echo __('Include embed in feeds', 'powerpress');
        ?>
	</p>
	<p><?php 
        echo __('Embed option works with the MediaElement.js Media Player for audio and video, Flow Player Classic for audio and HTML5 Video player for video.', 'powerpress');
        ?>
</p>
</td>
</tr>
</table>
<!-- end advanced features -->
<?php 
    }
    ?>


<table class="form-table">
<tr valign="top">
<th scope="row" style="background-image: url(../wp-includes/images/smilies/icon_exclaim.gif); background-position: 10px 10px; background-repeat: no-repeat; ">

<div style="margin-left: 24px;"><?php 
    echo __('Having Issues?', 'powerpress');
    ?>
</div></th>
<td>
	<select name="General[player_aggressive]" class="bpp_input_med">
<?php 
    $linkoptions = array(0 => __('No, everything is working', 'powerpress'), 1 => __('Yes, please try to fix', 'powerpress'));
    while (list($value, $desc) = each($linkoptions)) {
        echo "\t<option value=\"{$value}\"" . ($General['player_aggressive'] == $value ? ' selected' : '') . ">{$desc}</option>\n";
    }
    ?>
</select>
<p style="margin-top: 5px;">
	<?php 
    echo __('Use this option if you are having problems with the players not appearing on some or all of your pages.', 'powerpress');
    ?>
</p>
<?php 
    if (!empty($General['advanced_mode_2'])) {
        ?>
<p style="margin-top: 20px; margin-bottom:0;">
	<?php 
        echo __('If the above option fixes the player issues, then you most likely have a conflicting theme or plugin activated. You can verify your theme is not causing the problem by testing your site using the default WordPress twentyelevent or twentytwelve theme. For plugins, disable them one by one until the player re-appears, which indicates the last plugin deactivated caused the conflict.', 'powerpress');
        ?>
</p>
<?php 
    }
    ?>
</td>
</tr>
</table>

<?php 
    if (!empty($General['advanced_mode_2'])) {
        ?>
<!-- start advanced features -->
<div id="new_window_settings" style="display: <?php 
        echo $General['player_function'] == 1 || $General['player_function'] == 3 ? 'block' : 'none';
        ?>
">
<h3><?php 
        echo __('Play in New Window Settings', 'powerpress');
        ?>
</h3>
<table class="form-table">

<tr valign="top">
<th scope="row">
<?php 
        echo __('New Window Width', 'powerpress');
        ?>
</th>
<td>
<input type="text" name="General[new_window_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php 
        echo $General['new_window_width'];
        ?>
" maxlength="4" />
<?php 
        echo __('Width of new window (leave blank for 420 default)', 'powerpress');
        ?>
</td>
</tr>

<tr valign="top">
<th scope="row">
<?php 
        echo __('New Window Height', 'powerpress');
        ?>
</th>
<td>
<input type="text" name="General[new_window_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php 
        echo $General['new_window_height'];
        ?>
" maxlength="4" />
<?php 
        echo __('Height of new window (leave blank for 240 default)', 'powerpress');
        ?>
</td>
</tr>

<tr valign="top">
<th scope="row">
&nbsp;
</th>
<td>

	<p style="margin: 8px 0 0 0;">
		<label><input type="checkbox" name="General[new_window_nofactor]" value="1" <?php 
        if (!empty($General['new_window_nofactor'])) {
            echo 'checked';
        }
        ?>
  /> <?php 
        echo __('Do not factor in scroll bars', 'powerpress');
        ?>
</label>
	</p>
	<div style="margin: 0 0 0 20px;"><?php 
        echo __('By default, PowerPress adds to the width and height above to compensate for possible vertical and horizontal scroll bars. Check this option if you do not want PowerPress to compensate for browser scroll bars.', 'powerpress');
        ?>
</div>
</td>

</table>
</div>


<h3><?php 
        echo __('Media Format Settings', 'powerpress');
        ?>
</h3>
<table class="form-table">

<tr valign="top">
<th scope="row">
<?php 
        echo __('AAC Audio (.m4a)', 'powerpress');
        ?>
</th>
<td>

	<p style="margin: 8px 0 0 0;">
		<label><input type="checkbox" name="General[m4a]" value="use_players" <?php 
        if (!empty($General['m4a']) && $General['m4a'] == 'use_players') {
            echo 'checked';
        }
        ?>
  /> <?php 
        echo __('Use Flow Player Classic / HTML5 Audio player', 'powerpress');
        ?>
</label>
	</p>
	<div style="margin-left: 20px;"><?php 
        echo __('Leave this option unchecked if you want m4a chapter markers, images and information displayed.', 'powerpress');
        ?>
</div>
	<div style="margin: 10px 0 0 20px;"><?php 
        echo __('When unchecked, m4a will be played with the quicktime video embed. Video player width/height settings apply.', 'powerpress');
        ?>
</div>

</td>
</tr>
</table>
</div>
<!-- end presentation settings -->
<!-- end advanced features -->
<?php 
    }
}
function powerpress_admin_customfeeds()
{
    $General = powerpress_get_settings('powerpress_general');
    ?>
<h2><?php 
    echo __('Custom Podcast Channels', 'powerpress');
    ?>
</h2>
<p>
	<?php 
    echo __('Custom podcast Channels allow you to associate multiple media files and/or formats to one blog post.', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo sprintf(__('If you are looking to organize episodes by topic, please use %s.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php') . '" title="' . __('Category Podcast Feeds', 'powerpress') . '">' . __('Category Podcast Feeds', 'powerpress') . '</a>');
    ?>
</p>

<style type="text/css">

.column-url {
	width: 40%;
}
.column-name {
	width: 30%;
}
.column-feed-slug {
	width: 15%;
}
.column-episode-count {
	width: 15%;
}
</style>
<div id="col-container">

<div id="col-right">
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('powerpressadmin_customfeeds');
    ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
    print_column_headers('powerpressadmin_customfeeds', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $Feeds = array('podcast' => __('Podcast', 'powerpress'));
    if (isset($General['custom_feeds']['podcast'])) {
        $Feeds = $General['custom_feeds'];
    } else {
        if (is_array($General['custom_feeds'])) {
            $Feeds += $General['custom_feeds'];
        }
    }
    asort($Feeds, SORT_STRING);
    // Sort feeds
    $count = 0;
    while (list($feed_slug, $feed_title) = each($Feeds)) {
        $feed_slug = esc_attr($feed_slug);
        // Precaution
        $episode_total = powerpress_admin_episodes_per_feed($feed_slug);
        $columns = powerpress_admin_customfeeds_columns();
        $hidden = array();
        if ($feed_slug == 'podcast') {
            $feed_title = __('Podcast', 'powerpress');
        }
        if ($count % 2 == 0) {
            echo '<tr valign="middle" class="alternate">';
        } else {
            echo '<tr valign="middle">';
        }
        foreach ($columns as $column_name => $column_display_name) {
            $class = "class=\"column-{$column_name}\"";
            $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
            $url = get_feed_link($feed_slug);
            $short_url = str_replace('http://', '', $url);
            $short_url = str_replace('www.', '', $short_url);
            //if ('/' == substr($short_url, -1))
            //	$short_url = substr($short_url, 0, -1);
            if (strlen($short_url) > 35) {
                $short_url = substr($short_url, 0, 32) . '...';
            }
            //$short_url = '';
            switch ($column_name) {
                case 'feed-slug':
                    echo "<td {$class}>{$feed_slug}";
                    echo "</td>";
                    break;
                case 'name':
                    echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . esc_html($feed_title) . '</a></strong>' . ($feed_slug == 'podcast' ? ' (' . __('default channel', 'powerpress') . ')' : '') . '<br />';
                    $actions = array();
                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>';
                    $actions['delete'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-delete-feed&amp;feed_slug={$feed_slug}", 'powerpress-delete-feed-' . $feed_slug) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to delete feed '%s'\n  'Cancel' to stop, 'OK' to delete.", 'powerpress'), esc_attr($feed_title))) . "') ) { return true;}return false;\">" . __('Delete', 'powerpress') . "</a>";
                    if (!isset($General['custom_feeds'][$feed_slug])) {
                        unset($actions['delete']);
                    }
                    $action_count = count($actions);
                    $i = 0;
                    echo '<div class="row-actions">';
                    foreach ($actions as $action => $linkaction) {
                        ++$i;
                        $i == $action_count ? $sep = '' : ($sep = ' | ');
                        echo '<span class="' . $action . '">' . $linkaction . $sep . '</span>';
                    }
                    echo '</div>';
                    echo '</td>';
                    break;
                case 'url':
                    echo "<td {$class}><a href='{$url}' title='" . esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title)) . "' target=\"_blank\">" . esc_html($short_url) . "</a>";
                    echo '<div class="row-actions">';
                    if (defined('POWERPRESS_FEEDVALIDATOR_URL')) {
                        echo '<span class="' . $action . '"><a href="' . POWERPRESS_FEEDVALIDATOR_URL . urlencode($url) . '" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
                    }
                    echo '</div>';
                    echo "</td>";
                    break;
                case 'episode-count':
                    echo "<td {$class}>{$episode_total}";
                    echo "</td>";
                    break;
                default:
                    break;
            }
        }
        echo "\n    </tr>\n";
        $count++;
    }
    ?>
	</tbody>
</table>
<?php 
    if (!isset($General['custom_feeds'][$feed_slug])) {
        ?>
<p><?php 
        echo sprintf(__('Note: The default channel "Podcast" is currently using global PowerPress settings. Click %s to customize the default "Podcast" channel.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=podcast') . '">' . __('Edit', 'powerpress') . '</a>');
        ?>
</p>
<?php 
    }
    ?>
</div> <!-- col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
    echo __('Add Podcast Channel', 'powerpress');
    ?>
</h3>
<div id="ajax-response"></div>
<input type="hidden" name="action" value="powerpress-addfeed" />
<?php 
    //wp_original_referer_field(true, 'previous');
    //wp_nonce_field('powerpress-add-feed');
    ?>

<div class="form-field form-required">
	<label for="feed_name"><?php 
    echo __('Feed Name', 'powerpress');
    ?>
</label>
	<input name="feed_name" id="feed_name" type="text" value="" size="40" />
    <p><?php 
    echo __('The name is used for use within the administration area only.', 'powerpress');
    ?>
</p>
</div>

<div class="form-field">
	<label for="feed_slug"><?php 
    echo __('Feed Slug', 'powerpress');
    ?>
</label>
	<input name="feed_slug" id="feed_slug" type="text" value="" size="40" />
    <p><?php 
    echo __('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'powerpress');
    ?>
</p>
</div>

<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
    echo __('Add Podcast Channel', 'powerpress');
    ?>
" /></p>

</div>
</div>

</div> <!-- col-left -->

</div> <!-- col-container -->

<h3><?php 
    echo __('Example Usage', 'powerpress');
    ?>
</h3>
<p>
	<?php 
    echo __('Example 1: You want to distribute both an mp3 and an ogg version of your podcast. Use the default podcast channel for your mp3 media and create a custom channel for your ogg media.', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo __('Example 2: You have a video podcast with multiple file formats. Use the default podcast channel for the main media that you want to appear on your blog (e.g. m4v). Create additional channels for the remaining formats (e.g. wmv, mov, mpeg).', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo __('Example 3: You create two versions of your podcast, a 20 minute summary and a full 2 hour episode. Use the default channel for your 20 minute summary episodes and create a new custom channel for your full length episodes.', 'powerpress');
    ?>
</p>

<?php 
}
function powerpress_admin_appearance_common($Feed, $FeedAttribs = array())
{
    $GeneralSettings = powerpress_get_settings('powerpress_general');
    if ($Feed === false) {
        $Feed = powerpress_get_settings('powerpress_feed');
    }
    if (empty($Feed)) {
        $Feed = array();
    }
    // Defaults
    if (!isset($Feed['subscribe_page_link_href'])) {
        $Feed['subscribe_page_link_href'] = '';
    }
    if (!isset($Feed['subscribe_page_link_id'])) {
        $Feed['subscribe_page_link_id'] = '';
    }
    if (!isset($Feed['subscribe_page_link_text'])) {
        $Feed['subscribe_page_link_text'] = '';
    }
    $feed_slug = 'podcast';
    if (!empty($FeedAttribs['feed_slug'])) {
        $feed_slug = $FeedAttribs['feed_slug'];
    }
    if ($FeedAttribs['type'] == 'ttid') {
        //echo "<br /><br />";
        return;
    }
    ?>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
    echo __('Subscribe Page', 'powerpress');
    ?>
 <?php 
    echo powerpressadmin_new();
    ?>
</th> 
<td>
	<p><?php 
    echo __('Add a link to a page to explain to your audience how to subscribe to your podcast.', 'powerpress');
    ?>
</p>
	<p><?php 
    echo __('The following link will be added to the Subscribe on iTunes and Subscribe via RSS links below the player.', 'powerpress');
    ?>
</p>
	<ul>
	<li>
	<label for="subscribe_page_link_id"><?php 
    echo __('Subscribe Page ID:', 'powerpress');
    ?>
 <input type="text" id="subscribe_page_link_id" value="<?php 
    echo esc_attr($Feed['subscribe_page_link_id']);
    ?>
" name="Feed[subscribe_page_link_id]" placeholder="" style="width: 50px;" /></label>
	<?php 
    $url_temp = empty($Feed['subscribe_page_link_id']) || !is_numeric($Feed['subscribe_page_link_id']) ? '' : get_page_link($Feed['subscribe_page_link_id']);
    ?>
	<a id="subscribe_page_link_id_url" href="<?php 
    echo $url_temp;
    ?>
" target="_blank"><?php 
    echo $url_temp;
    ?>
</a>
	<div id="subscribe_page_link_or" style="<?php 
    echo !empty($Feed['subscribe_page_link_id']) ? 'display:none;' : '';
    ?>
">
	<div><?php 
    echo __(' - or - ', 'powerpress');
    ?>
</div>
	<label for="subscribe_page_link_href"><?php 
    echo __('Subscribe Page URL:', 'powerpress');
    ?>
 <input type="text" id="subscribe_page_link_href" value="<?php 
    echo esc_attr($Feed['subscribe_page_link_href']);
    ?>
" name="Feed[subscribe_page_link_href]" placeholder="" style="width:60%;"<?php 
    echo empty($Feed['subscribe_page_link_id']) ? '' : ' disabled';
    ?>
 /></label>
	<p><?php 
    echo __('(If subscribe page is not hosted on this site)', 'powerpress');
    ?>
</p> 
	</div>
	
<?php 
    if (empty($FeedAttribs) && empty($Feed['subscribe_page_link_href']) && empty($Feed['subscribe_page_link_id'])) {
        ?>
	<h3><a href="#" id="powerpress_create_subscribe_page"><?php 
        echo __('Create a subscribe page from Template', 'powerpress');
        ?>
</a></h3> 
	<p><?php 
        echo __('Creates a page from a template with the [powerpress_subscribe] shortcode. We encourage you to edit this page in your own words. Depending on your SEO stratigy, you may want to configure the meta robots content to noindex.', 'powerpress');
        ?>
	</p>
<?php 
    }
    ?>
	<p><a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/subscribe-page/" target="_blank"><?php 
    echo __('Learn more about the PowerPress Subscribe Page', 'powerpress');
    ?>
</a></p>
	<?php 
    // TODO: use the $FeedAttribs to create a recommended shortcode for this particular channel, may be simple [powerpress_subscribe] or it may specify the category, taxonomy, and/or feed_slug/post tpe podcasting
    ?>
	</li>
	<li><label for="subscribe_page_link_text"><?php 
    echo __('Subscribe Page Link Label:', 'powerpress');
    ?>
<br /><input type="text" id="subscribe_page_link_text" value="<?php 
    echo esc_attr($Feed['subscribe_page_link_text']);
    ?>
" name="Feed[subscribe_page_link_text]" placeholder="" style="width:60%;" /></label>
	<?php 
    echo __('(leave blank for default)', 'powerpress');
    ?>
	<p><?php 
    echo __('Default: More Subscribe Options', 'powerpress');
    ?>
</p>
	</li>
	</ul>
</td>
</tr>
<?php 
    $shortcode['powerpress'] = '[powerpress]';
    $shortcode['powerpress_playlist'] = '[powerpress_playlist]';
    $shortcode['powerpress_subscribe'] = '[powerpress_subscribe]';
    if ($feed_slug != 'podcast') {
        $shortcode['powerpress'] = '[powerpress channel="' . $feed_slug . '"]';
        $shortcode['powerpress_playlist'] = '[powerpress_playlist channel="' . $feed_slug . '"]';
        $shortcode['powerpress_subscribe'] = '[powerpress_subscribe channel="' . $feed_slug . '"]';
    }
    if (!empty($FeedAttribs['post_type'])) {
        $shortcode['powerpress_playlist'] = '[powerpress_playlist channel="' . $feed_slug . '" post_type="' . $FeedAttribs['post_type'] . '"]';
        $shortcode['powerpress_subscribe'] = '[powerpress_subscribe channel="' . $feed_slug . '" post_type="' . $FeedAttribs['post_type'] . '"]';
    }
    if (!empty($FeedAttribs['category_id'])) {
        $shortcode['powerpress_playlist'] = '[powerpress_playlist category="' . $FeedAttribs['category_id'] . '"]';
        $shortcode['powerpress_subscribe'] = '[powerpress_subscribe category="' . $FeedAttribs['category_id'] . '"]';
    }
    if (!empty($FeedAttribs['term_taxonomy_id'])) {
        $shortcode['powerpress_playlist'] = '[powerpress_playlist term_taxonomy_id="' . $FeedAttribs['term_taxonomy_id'] . '"]';
        $shortcode['powerpress_subscribe'] = '[powerpress_subscribe term_taxonomy_id="' . $FeedAttribs['term_taxonomy_id'] . '"]';
    }
    ?>
<tr valign="top">
<th scope="row">
<?php 
    echo __('PowerPress Shortcodes', 'powerpress');
    ?>
</th>
<td>
<h3><?php 
    echo __('PowerPress Player Shortcode', 'powerpress');
    ?>
</h3>
<p>
<?php 
    echo '<code>' . $shortcode['powerpress'] . '</code>';
    ?>
 
</p>
<p>
<?php 
    echo __('The Player shortcode is used to position your media presentation (player and download links) exactly where you want within your post or page content.', 'powerpress');
    ?>
 
</p>
<p>
<?php 
    echo sprintf(__('Please visit the %s page for additional options.', 'powerpress'), '<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/shortcode/" target="_blank">' . __('PowerPress Player Shortcode', 'powerpress') . '</a>');
    ?>
</p>
<p class="description">
<?php 
    echo __('Note: When specifying a URL to media in the powerpress shortcode, only the player is included. The Media Links will <u>NOT</u> be included since there is not enough meta information to display them.', 'powerpress');
    ?>
</p>
<h3><?php 
    echo __('PowerPress Playlist Shortcode', 'powerpress');
    ?>
 <?php 
    echo powerpressadmin_new();
    ?>
</h3>
<?php 
    if (empty($GeneralSettings['playlist_player'])) {
        // Either not set or set on
        ?>
<p style="margin-bottom: 20px; margin-left: 40px;">
	<input type="checkbox" name="General[playlist_player]" value="1" /> 
	<strong><?php 
        echo __('Enable PowerPress Playlist Player', 'powerpress');
        ?>
</strong>
</p>
<?php 
    }
    ?>
<p>
<?php 
    echo '<code>' . $shortcode['powerpress_playlist'] . '</code>';
    ?>
 
</p>
<p>
<?php 
    echo __('The Playlist shortcode is used to display a player with a playlist of your podcast episodes. It utilizes the default playlist built into WordPress.', 'powerpress');
    ?>
 
</p>
<p>
<?php 
    echo sprintf(__('Please visit the %s page for additional options.', 'powerpress'), '<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-playlist-shortcode/" target="_blank">' . __('PowerPress Playlist Shortcode', 'powerpress') . '</a>');
    ?>
</p>

<h3><?php 
    echo __('PowerPress Subscribe Shortcode', 'powerpress');
    ?>
 <?php 
    echo powerpressadmin_new();
    ?>
</h3>
<p>
<?php 
    echo '<code>' . $shortcode['powerpress_subscribe'] . '</code>';
    ?>
 
</p>
<p>
<?php 
    echo __('The Subscribe shortcode is used to display a subscribe to podcast widget for your podcast. It is intended for use on a custom subscribe page. See the Subscribe Page section below for more details.', 'powerpress');
    ?>
 
</p>
<p>
<?php 
    echo sprintf(__('Please visit the %s page for additional options.', 'powerpress'), '<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-subscribe-shortcode/" target="_blank">' . __('PowerPress Subscribe Shortcode', 'powerpress') . '</a>');
    ?>
</p>

</td>
</tr>

</table>
<?php 
}
Esempio n. 17
0
function powerpress_admin_tags()
{
    $General = powerpress_get_settings('powerpress_general');
    $TagSettings = powerpress_default_settings($General, 'tags');
    ?>
<script language="javascript"><!--
function ToggleID3Tags(Obj)
{
	document.getElementById('edit_id3_tags').style.display=(Obj.checked?'block':'none');
}
//-->
</script>
<input type="hidden" name="action" value="powerpress-save-tags" />
<h2><?php 
    echo __('MP3 Tags', 'powerpress');
    ?>
</h2>

<p><?php 
    echo __('Blubrry Hosting users can configure how to have the service write their MP3 ID3 Tags before publishing episodes.', 'powerpress');
    ?>
</p>

<p style="margin-bottomd: 0;">
<?php 
    echo __('ID3 tags contain useful information (title, artist, album, year, etc...) about your podcast as well as an image for display during playback in most media players.', 'powerpress');
    echo ' ';
    echo sprintf(__('Please visit the %s section of the %s to learn more about MP3 ID3 tags.', 'powerpress'), '<a href="http://create.blubrry.com/manual/creating-podcast-media/audio/id3-tags-media-meta-data/" target="_blank">' . __('ID3 Tags and media meta data', 'powerpress') . '</a>', '<a href="http://create.blubrry.com/manual/" target="_blank">' . __('Podcasting Manual', 'powerpress') . '</a>');
    ?>
</p>
<?php 
    if (empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false') {
        ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
        echo __('Write Tags', 'powerpress');
        ?>
</th> 
<td>
	<p>
		<input name="NotAvailable" type="checkbox" value="1" onchange="alert('<?php 
        echo __('You must configure your Blubrry Services Account in the Blubrry PowerPress > Basic Settings page in order to utilize this feature.', 'powerpress');
        ?>
'); this.checked=false; return false;" /> 
		<?php 
        echo __('Use Blubrry Hosting services to write MP3 ID3 tags to your media.', 'powerpress');
        ?>
	</p>
</td>
</tr>
</table>

<?php 
    } else {
        ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
        echo __('Write Tags', 'powerpress');
        ?>
</th> 
<td>
	<p>
		<input name="General[write_tags]" type="checkbox" value="1" <?php 
        if (!empty($General['write_tags'])) {
            echo 'checked ';
        }
        ?>
 onchange="ToggleID3Tags(this);" /> 
		<?php 
        echo __('Use Blubrry Hosting services to write MP3 ID3 tags to your media.', 'powerpress');
        ?>
	</p>
</td>
</tr>
</table>
<?php 
    }
    ?>
<table class="form-table" id="edit_id3_tags" style="display:<?php 
    echo !empty($General['blubrry_hosting']) && $General['blubrry_hosting'] !== 'false' ? !empty($General['write_tags']) ? 'block' : 'none' : 'block';
    ?>
;">

<?php 
    if (empty($General['tag_title'])) {
        $General['tag_title'] = '';
    }
    if (empty($General['tag_artist'])) {
        $General['tag_artist'] = '';
    }
    if (empty($General['tag_album'])) {
        $General['tag_album'] = '';
    }
    if (empty($General['tag_genre'])) {
        $General['tag_genre'] = '';
    }
    if (empty($General['tag_year'])) {
        $General['tag_year'] = '';
    }
    if (empty($General['tag_track'])) {
        $General['tag_track'] = '';
    }
    if (empty($General['tag_composer'])) {
        $General['tag_composer'] = '';
    }
    if (empty($General['tag_copyright'])) {
        $General['tag_copyright'] = '';
    }
    if (empty($General['tag_url'])) {
        $General['tag_url'] = '';
    }
    if (empty($General['tag_coverart'])) {
        $General['tag_coverart'] = '';
    }
    powerpressadmin_tag_option('tag_title', $General['tag_title'], __('Title Tag', 'powerpress'), __('Use blog post title', 'powerpress'));
    powerpressadmin_tag_option('tag_artist', $General['tag_artist'], __('Artist Tag', 'powerpress'), __('Use Feed Talent Name', 'powerpress'));
    powerpressadmin_tag_option('tag_album', $General['tag_album'], __('Album Tag', 'powerpress'), __('Use blog title', 'powerpress') . ': ' . get_bloginfo('name') . '');
    powerpressadmin_tag_option('tag_genre', $General['tag_genre'], __('Genre Tag', 'powerpress'), __('Use genre \'Podcast\'', 'powerpress'));
    powerpressadmin_tag_option('tag_year', $General['tag_year'], __('Year Tag', 'powerpress'), __('Use current year', 'powerpress'));
    powerpressadmin_tag_option('tag_track', $General['tag_track'], __('Track Tag', 'powerpress'), __('Do not specify track number', 'powerpress'));
    powerpressadmin_tag_option('tag_composer', $General['tag_composer'], __('Composer Tag', 'powerpress'), __('Use Feed Talent Name', 'powerpress'));
    powerpressadmin_tag_option('tag_copyright', $General['tag_copyright'], __('Copyright Tag', 'powerpress'), __('Use &copy; Talent Name', 'powerpress'));
    powerpressadmin_tag_option('tag_url', $General['tag_url'], __('URL Tag', 'powerpress'), __('Use main blog URL', 'powerpress') . ': ' . get_bloginfo('url') . '');
    powerpressadmin_tag_option('tag_coverart', $General['tag_coverart'], __('Coverart Tag', 'powerpress'), '');
    ?>

</table>
<?php 
}
Esempio n. 18
0
function powerpress_admin_podpress()
{
    $results = powerpress_get_podpress_episodes(false);
    $Settings = powerpress_get_settings('powerpress_general', false);
    if (!isset($Settings['custom_feeds']['podcast'])) {
        $Settings['custom_feeds']['podcast'] = __('Podcast Feed (default)', 'powerpress');
    }
    $AllowImport = false;
    $AllowCleanup = true;
    if ($results) {
        if ($results['feeds_required'] > count($Settings['custom_feeds'])) {
            powerpress_page_message_add_error(sprintf(__('We found blog posts that have %d media files. You will need to create %d more Custom Feed%s in order to continue.', 'powerpress'), $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds']), $results['feeds_required'] - count($Settings['custom_feeds']) > 1 ? 's' : ''));
        } else {
            $AllowImport = true;
        }
    }
    powerpress_page_message_print();
    powerpressadmin_podpress_import_print_log();
    ?>
<style type="text/css">
.column-exclude {
	width: 80px;
}
.column-post-date {
	width: 80px;
}
label {
	float: left;
	width: 160px;
}
</style>
<script language="javascript"><!--

function check_radio_selection(obj, PostID, FileIndex)
{
	if( obj.value == '' ) // Users can select the no feed option as much as they want
		return true;
	
	var Field = obj.id;
	while( Field.charAt( Field.length-1 ) >= "0" &&  Field.charAt( Field.length-1 ) <= "9" ) // ( chr < "0" ) || ( chr > "9" )
	{
		Field = Field.substring(0, Field.length-1);
	}
	
	var Pos = 0;
	var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
	while( CheckObj )
	{
		if( CheckObj.length == 0 )
			break;
			
		if( Pos != FileIndex )
		{
			for (var i = 0; i < CheckObj.length; i++)
			{
				if (CheckObj[i].type == 'radio' && CheckObj[i].checked && CheckObj[i].value == obj.value )
				{
					alert("<?php 
    echo __('Sorry, you may only select one media file per post per feed.', 'powerpress');
    ?>
");
					return false;
				}
			}
		}
		Pos++;
		var CheckObj = document.getElementsByName( "Import["+PostID+"]["+Pos+"]" );
	}
	
	return true;
}

function no_import_all()
{
	if( !confirm('<?php 
    echo __('Select "No Import" option for all media files?', 'powerpress');
    ?>
') )
		return;
		
	var Inputs = document.getElementsByTagName('input');
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == '' )
			Elem.checked = true;
	}
}

function select_all(index,value)
{
	var NoImport = [];
	var Inputs = document.getElementsByTagName('input');
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == value )
		{
			ElemIndex = Elem.id.substring( Elem.id.lastIndexOf('_')+1);
			if( ElemIndex == index )
				Elem.checked = true;
			else if( Elem.checked && Elem.value != '' )
				NoImport.push( Elem.id );
		}
	}
	for (var i = 0; i < Inputs.length; i++)
	{
		var Elem = Inputs[i];
		if( Elem.type == 'radio' && Elem.value == '' )
		{
			for (var j = 0; j < NoImport.length; j++)
			{
				if( NoImport[j] == Elem.id )
					Elem.checked = true;
			}
		}
	}
}
//-->
</script>
<h2><?php 
    echo __('Import PodPress Episodes', 'powerpress');
    ?>
</h2>
<?php 
    //echo "<pre id=\"podpress_debug_info\" style=\"display: none;\">";
    //print_r($results);
    //echo "</pre>";
    //echo '<p><a href="#" onclick="javascript:document.getElementById(\'podpress_debug_info\').style.display=\'block\';this.style.display=\'none\';return false;">Show Debug Info</a></p>';
    if (count($results) == 0 || count($results) == 1) {
        ?>
	
	<p><?php 
        echo __('No PodPress episodes found to import.', 'powerpress');
        ?>
</p>
<?php 
    } else {
        ?>
<input type="hidden" name="action" value="powerpress-importpodpress" />
<p><?php 
        echo __('Select the media file under each feed for each episode you wish to import.', 'powerpress');
        ?>
</p>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
        print_column_headers('powerpressadmin_importpodpress');
        ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
        print_column_headers('powerpressadmin_importpodpress', false);
        ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
        $StrandedEpisodes = 0;
        $ImportableEpisodes = 0;
        $count = 0;
        while (list($post_id, $import_data) = each($results)) {
            $edit_link = get_edit_post_link($post_id);
            if ($post_id == 'feeds_required') {
                continue;
            }
            $columns = powerpressadmin_importpodpress_columns();
            $CurrentEnclosures = array();
            if (is_array($Settings['custom_feeds'])) {
                while (list($feed_slug, $value) = each($Settings['custom_feeds'])) {
                    if ($feed_slug == 'podcast') {
                        $enclosure_data = get_post_meta($post_id, 'enclosure', true);
                    } else {
                        $enclosure_data = get_post_meta($post_id, '_' . $feed_slug . ':enclosure', true);
                    }
                    if (!$enclosure_data) {
                        continue;
                    }
                    @(list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = @explode("\n", $enclosure_data));
                    if ($EnclosureURL) {
                        $CurrentEnclosures[$feed_slug] = array();
                        $CurrentEnclosures[$feed_slug]['url'] = trim($EnclosureURL);
                        $CurrentEnclosures[$feed_slug]['imported'] = false;
                    }
                    $found = false;
                    while (list($episode_index, $episode_data) = each($import_data['podpress_data'])) {
                        if ($episode_data['url'] == $CurrentEnclosures[$feed_slug]['url']) {
                            $import_data['podpress_data'][$episode_index]['imported'] = true;
                            $CurrentEnclosures[$feed_slug]['imported'] = true;
                            $found = true;
                            break;
                        }
                    }
                    reset($import_data['podpress_data']);
                    if ($found == false) {
                        // Add it to the media file list, prepend it...
                        $not_podpress_data = array();
                        $not_podpress_data['url'] = $CurrentEnclosures[$feed_slug]['url'];
                        $not_podpress_data['imported'] = true;
                        $not_podpress_data['not_podpress'] = true;
                        array_push($import_data['podpress_data'], $not_podpress_data);
                        $CurrentEnclosures[$feed_slug]['imported'] = true;
                        $CurrentEnclosures[$feed_slug]['present'] = true;
                    }
                }
                reset($Settings['custom_feeds']);
            }
            if ($count % 2 == 0) {
                echo '<tr valign="middle" class="alternate">';
            } else {
                echo '<tr valign="middle">';
            }
            $CheckedEpisodes = array();
            // key = file_index, value = feed-slug
            $feed_index = 0;
            foreach ($columns as $column_name => $column_display_name) {
                $class = "class=\"column-{$column_name}\"";
                switch ($column_name) {
                    case 'post-title':
                        echo '<td ' . $class . '><strong>';
                        if (current_user_can('edit_post', $post_id)) {
                            ?>
<a class="row-title" href="<?php 
                            echo $edit_link;
                            ?>
" title="<?php 
                            echo esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $import_data['post_title']));
                            ?>
"><?php 
                            echo $import_data['post_title'];
                            ?>
</a><?php 
                        } else {
                            echo $import_data['post_title'];
                        }
                        echo '</strong><br />';
                        echo '<div style="margin-left: 10px;">';
                        $index = 1;
                        while (list($episode_index, $episode_data) = each($import_data['podpress_data'])) {
                            $Parts = parse_url($episode_data['url']);
                            $filename = substr($Parts['path'], strrpos($Parts['path'], '/') + 1);
                            echo "File&nbsp;{$index}:&nbsp;";
                            if (empty($episode_data['not_podpress']) && empty($episode_data['imported'])) {
                                echo '<span style="color: #CC0000; font-weight: bold; cursor:pointer;" onclick="alert(\'' . __('File', 'powerpress') . ': ' . $filename . '\\n' . __('URL', 'powerpress') . ': ' . $episode_data['url'] . '\')">';
                                $AllowCleanup = false;
                                $StrandedEpisodes++;
                            } else {
                                if (empty($episode_data['not_podpress']) && $episode_data['imported']) {
                                    echo '<span style="color: green; font-weight: bold; cursor:pointer;" onclick="alert(\'' . __('File', 'powerpress') . ' ' . $filename . '\\n' . __('URL', 'powerpress') . ': ' . $episode_data['url'] . '\')">';
                                }
                            }
                            if (empty($episode_data['not_podpress']) && empty($episode_data['imported'])) {
                                echo '*';
                            }
                            echo $filename;
                            if (empty($episode_data['not_podpress'])) {
                                echo '</span>';
                            }
                            echo '<br/>';
                            $index++;
                        }
                        reset($import_data['podpress_data']);
                        echo '</div>';
                        echo '</td>';
                        break;
                    case 'post-date':
                        echo "<td {$class}>";
                        $timestamp = strtotime($import_data['post_date']);
                        echo date('Y/m/d', $timestamp);
                        echo "</td>";
                        break;
                    case 'feed-slug':
                        echo "<td {$class}>{$feed_slug}";
                        echo "</td>";
                        break;
                    default:
                        echo "<td {$class}>";
                        $feed_slug = substr($column_name, 5);
                        if ($column_name == 'exclude') {
                            $feed_slug = '';
                        }
                        $enclosure_data = false;
                        $EnclosureURL = '';
                        echo '<div class="">&nbsp;<br />';
                        if (isset($CurrentEnclosures[$feed_slug]) && $CurrentEnclosures[$feed_slug]['imported']) {
                            $index = 1;
                            while (list($episode_index, $episode_data) = each($import_data['podpress_data'])) {
                                echo "File {$index}: ";
                                if ($CurrentEnclosures[$feed_slug]['url'] == $episode_data['url']) {
                                    if (!empty($CurrentEnclosures[$feed_slug]['present'])) {
                                        echo '<strong style="color: green;">' . __('present', 'powerpress') . '</strong>';
                                    } else {
                                        echo '<strong style="color: green;">' . __('imported', 'powerpress') . '</strong>';
                                    }
                                } else {
                                    echo 'X';
                                }
                                echo "<br/>\n";
                                $index++;
                            }
                            reset($import_data['podpress_data']);
                        } else {
                            $index = 1;
                            while (list($episode_index, $episode_data) = each($import_data['podpress_data'])) {
                                echo __('File', 'powerpress') . "&nbsp;{$index}:&nbsp;";
                                if (!empty($episode_data['imported'])) {
                                    echo '&nbsp;X';
                                } else {
                                    $checked = '';
                                    if (!isset($CheckedEpisodes[$episode_index]) && !in_array($feed_slug, $CheckedEpisodes)) {
                                        $checked = 'checked';
                                        $CheckedEpisodes[$episode_index] = $feed_slug;
                                    }
                                    if (!isset($CheckedEpisodes[$episode_index]) && $feed_slug == '') {
                                        $checked = 'checked';
                                    }
                                    echo '<input type="radio" id="import_' . $post_id . '_' . $episode_index . '" name="Import[' . $post_id . '][' . $episode_index . ']" value="' . $feed_slug . '" ' . $checked . ' onclick="return check_radio_selection(this, ' . $post_id . ', ' . $episode_index . ')" />';
                                }
                                echo '<br/>';
                                $index++;
                            }
                            reset($import_data['podpress_data']);
                        }
                        echo '</div>';
                        echo "</td>";
                        $feed_index++;
                        break;
                }
            }
            echo "\n    </tr>\n";
            $count++;
        }
        ?>
	</tbody>
</table>
<p><?php 
        echo sprintf(__('Importable episodes highlighted in %s with asterisks *.', 'powerpress'), '<span style="color: #CC0000; font-weight: bold;">' . __('red', 'powerpress') . '</span>');
        ?>
</p>
<p style="margin-bottom: 0; padding-bottom: 0;"><?php 
        echo __('Select Only', 'powerpress');
        ?>
:</p>
<?php 
        if ($results['feeds_required'] < 1) {
            $results['feeds_required'] = 1;
        }
        for ($number = 0; $number < $results['feeds_required']; $number++) {
            ?>
<p style="margin: 0 0 0 40px; padding: 0;">
 File <?php 
            echo $number + 1;
            ?>
:
<?php 
            while (list($feed_slug, $feed_title) = each($Settings['custom_feeds'])) {
                echo '<a href="javascript:void()" onclick="select_all(' . $number . ',\'' . $feed_slug . '\');return false;">' . htmlspecialchars($feed_title) . '</a> | ';
            }
            ?>
<a href="javascript:void()" onclick="select_all(<?php 
            echo $number;
            ?>
,'');return false;"><?php 
            echo __('No Import', 'powerpress');
            ?>
</a>
</p>
<?php 
            break;
        }
    }
    if (!empty($StrandedEpisodes)) {
        ?>
<p><?php 
        echo sprintf(__('There are %d PodPress media files that can be imported.', 'powerpress'), $StrandedEpisodes);
        ?>
</p>
<?php 
    }
    if ($AllowImport) {
        if (count($results) > 1 && $StrandedEpisodes > 0) {
            ?>
<p class="submit">
<input type="submit" name="Submit" id="powerpress_import_button" class="button-primary" value="<?php 
            echo __('Import Episodes', 'powerpress');
            ?>
" />
</p>
<?php 
        } else {
            ?>
<p class="submit">
<input type="button" name="Submit" id="powerpress_import_button" class="button-primary" value="<?php 
            echo __('Import Episodes', 'powerpress');
            ?>
" onclick="alert('<?php 
            echo __('There are no PodPress episodes found to import.', 'powerpress');
            ?>
');" />
</p>
<?php 
        }
        /*
        if( $AllowCleanup )
        {
        ?>
        </form>
        <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_tools.php') ?>">
        <?php wp_nonce_field('powerpress-delete-podpress-data'); ?>
        <input type="hidden" name="action" value="deletepodpressdata" />
        <p class="submit">
        <input type="submit" name="Submit" id="powerpress_delete_button" class="button-primary" value="Delete PodPress Data from Database" onclick="return confirm('Delete old PodPress data from database, are you sure?\n\nAll PodPress episode data will be permanently deleted.');" />
        <br />  There is no need to delete PodPress data, but if you prefer to clean up your database then please feel free to use this option.
        </p>
        <?php
        }
        else
        {
        ?>
        
        <p class="submit">
        <input type="button" name="Submit" id="powerpress_delete_button" class="button-primary" value="Delete PodPress Data from Database" onclick="alert('This option will be enabled once all PodPress episodes have been imported.');" />
        </p>
        <?php
        }
        */
    } else {
        ?>
<div class="error powerpress-error">
<?php 
        echo sprintf(__('We found blog posts that have %d media files.', 'powerpress'), $results['feeds_required']);
        echo sprintf(__('You will need to create %d Podcast Channels to continue.', 'powerpress'), $results['feeds_required'] - count($Settings['custom_feeds']));
        ?>
</div>
<p>
<?php 
        echo __('Blubrry PowerPress does not allow you to include multiple media files for one feed item (blog post).', 'powerpress');
        echo __('This is because each podcatcher handles multiple enclosures in feeds differently. iTunes will download the first enclosure that it sees in the feed ignoring the rest.', 'powerpress');
        echo __('Other podcatchers and podcasting directories either pick up the first enclosure or the last in each post item.', 'powerpress');
        echo sprintf(__('This inconsistency combined with the fact that Dave Winer does not recommend multiple enclosures (%s) and FeedValidator.org (%s) recommendation against it is why Blubrry PowerPress does not support them.', 'powerpress'), '<a href="http://www.reallysimplesyndication.com/2004/12/21" target="_blank">' . __('Link', 'powerpress') . '</a>', '<a href="http://www.feedvalidator.org/docs/warning/DuplicateEnclosure.html" target="_blank">' . __('Link', 'powerpress') . '</a>');
        ?>
</p>
<p><?php 
        echo sprintf(__('As a alternative, PowerPress allows you to create additional %s to associate additional media files in a blog post to specific feed channels.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') . '">' . __('Custom Podcast Channels', 'powerpress') . '</a>');
        ?>


</p>
<p class="submit">
<input type="button" name="Submit" id="powerpress_import_button" class="button-primary" value="<?php 
        echo __('Import Episodes', 'powerpress');
        ?>
" onclick="alert('<?php 
        echo __('We found blog posts that have %d media files.', 'powerpress');
        echo '\\n\\n';
        echo sprintf(__('You will need to create %d additional Podcast Channels in order to continue.', 'powerpress') . $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds']));
        ?>
');" />
</p>

<?php 
    }
    ?>
</form>
<hr />
<form enctype="enctype" method="get" action="<?php 
    echo admin_url('admin.php');
    ?>
">
<input type="hidden" name="page" value="powerpress/powerpressadmin_tools.php" />
<input type="hidden" name="action" value="powerpress-podpress-epiosdes" />
<h2><?php 
    echo __('Filter Results', 'powerpress');
    ?>
</h2>
<p><label><?php 
    echo __('Include Only', 'powerpress');
    ?>
</label><input type="text" name="include_only_ext" value="<?php 
    if (!empty($_GET['include_only_ext'])) {
        echo htmlspecialchars($_GET['include_only_ext']);
    }
    ?>
" style="width: 240px;" /> <?php 
    echo __('(leave blank for all media)', 'powerpress');
    ?>
<br />
<label>&nbsp;</label><?php 
    echo __('specify the file extensions to include separated by commas (e.g. mp3, m4v).', 'powerpress');
    ?>
</p>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Filter Episodes" />
</p>
<!-- start footer -->
<?php 
}