<?php

require_once(POWERPRESS_ABSPATH . '/views/components/sidenav.php');

function powerpress_admin_basic()
{
    // ASSETS
    powerpress_enqueue_assets([
        // styles
        'powerpress-variables' => ['path' => 'css/variables'],
        'powerpress_settings_style' => ['path' => 'css/settings'],
        'powerpress-admin-css' => ['path' => 'css/admin'],
        'powerpress-program-card-css' => ['path' => 'css/components/program-card'],
        'powerpress-stats-widget' => ['path' => 'css/components/stats-widget'],
        'powerpress-news-widget' => ['path' => 'css/components/news-widget'],
        'powerpress-sidenav' => ['path' => 'css/components/sidenav'],

        // scripts
        'chartjs' => ['type' => 'script', 'path' => '3rdparty/chart.min', 'no_suffix' => true, 'version' => '4.4.1'],
        'powerpress-admin' => ['type' => 'script', 'path' => 'js/admin'],
        'powerpress-program-card' => ['type' => 'script', 'path' => 'js/program-card', 'deps' => ['chartjs'], 'module' => true],
    ]);

    $FeedAttribs = array('type'=>'general', 'feed_slug'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
	// feed_slug = channel

	$General = powerpress_get_settings('powerpress_general');
	$General = powerpress_default_settings($General, 'basic');

	$FeedSettings = powerpress_get_settings('powerpress_feed');
	$FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');

	$CustomFeed = get_option('powerpress_feed_'.'podcast', array()); // Get the custom podcast feed settings saved in the database
	if( !empty($CustomFeed) ) // If they enabled custom podast channels...
	{
		$FeedSettings = powerpress_merge_empty_feed_settings($CustomFeed, $FeedSettings);
		$FeedAttribs['channel_podcast'] = true;
	}

	$MultiSiteServiceSettings = false;
	if( is_multisite() )
	{
		$MultiSiteSettings = get_site_option('powerpress_multisite');
		if( !empty($MultiSiteSettings['services_multisite_only']) )
		{
			$MultiSiteServiceSettings = true;
		}
	}

    powerpress_enqueue_assets([
        'powerpress-admin' => [
            'type' => 'script',
            'path' => 'js/admin',
        ],
        'powerpress-post' => [
            'type' => 'script',
            'path' => 'js/post',
            'module' => true,
        ],
    ]);

?>
<script type="text/javascript">

jQuery(document).ready(function($) {

	
	jQuery('#episode_box_player_links_options').change(function () {
		
		var objectChecked = jQuery('#episode_box_player_links_options').attr('checked');
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery('#episode_box_player_links_options').prop('checked');
		}
		
		if( objectChecked == true ) {
			jQuery('#episode_box_player_links_options_div').css("display", 'block' );
		}
		else {
			jQuery('#episode_box_player_links_options_div').css("display", 'none' );
			jQuery('.episode_box_no_player_or_links').attr("checked", false );
			jQuery('#episode_box_no_player_and_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('.episode_box_no_player_or_links').prop("checked", false );
				jQuery('#episode_box_no_player_and_links').prop("checked", false );
			}
		}
	} );
	
	jQuery('#episode_box_no_player_and_links').change(function () {
		
		var objectChecked = jQuery(this).attr("checked");
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery(this).prop("checked");
		}
		
		if( objectChecked == true ) {
			jQuery('.episode_box_no_player_or_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('.episode_box_no_player_or_links').prop("checked", false );
			}
		}
	} );

	jQuery('.episode_box_no_player_or_links').change(function () {
		var objectChecked = jQuery(this).attr("checked");
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery(this).prop("checked");
		}
		
		if( objectChecked == true) {
			jQuery('#episode_box_no_player_and_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('#episode_box_no_player_and_links').prop("checked", false );
			}
		}
	} );
	
	jQuery('#episode_box_feature_in_itunes').change( function() {
		var objectChecked = jQuery('#episode_box_feature_in_itunes').attr('checked');
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery('#episode_box_feature_in_itunes').prop('checked');
		}
		if( objectChecked ) {
			jQuery("#episode_box_order").attr("disabled", true);
		} else {
			jQuery("#episode_box_order").removeAttr("disabled");
		}
	});

} );
//-->
</script>
<input type="hidden" name="action" value="powerpress-save-settings" />
<input type="hidden" name="General[pp-gen-settings-tabs]" value="1" />
<input type="hidden" name="PlayerSettings[pp-gen-settings-tabs]" value="1" />

<input type="hidden" id="save_tab_pos" name="tab" value="<?php echo (empty($_POST['tab']) ? "settings-welcome" : esc_attr($_POST['tab'])); ?>" />
<input type="hidden" id="save_sidenav_pos" name="sidenav-tab" value="<?php echo (empty($_POST['sidenav-tab']) ? "" : esc_attr($_POST['sidenav-tab'])); ?>" />

<div id="powerpress_admin_header">
<h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2> 

</div>

<div id="powerpress_settings_page" class="powerpress_tabbed_content">
    <div class="pp-tab">
        <button type="button" id="welcome-tab" class="tablinks active" onclick="powerpress_openTab(event, 'settings-welcome')"><?php echo htmlspecialchars(__('Welcome', 'powerpress')); ?></button>
        <!-- #tab1 deprecated. was episodes tab -->
        <button type="button" id="feeds-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-feeds')"><?php echo htmlspecialchars(__('Feeds', 'powerpress')); ?></button>
        <button type="button" id="website-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-website')"><?php echo htmlspecialchars(__('Website', 'powerpress')); ?></button>
        <button type="button" id="destinations-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-destinations')"><?php echo htmlspecialchars(__('Destinations', 'powerpress')); ?></button>
        <!-- <button type="button" id="analytics-tab" class="tablinks" onclick="openTab(event, 'settings-analytics')"><?php echo htmlspecialchars(__('Analytics', 'powerpress')); ?></button> -->
        <button type="button" id="advanced-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-advanced')"><?php echo htmlspecialchars(__('Advanced', 'powerpress')); ?></button>
        <button type="button" id="make-money-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-make-money')"><?php echo htmlspecialchars(__('Make Money', 'powerpress')); ?></button>
        <?php
        $hasChannels = isset($General['channels']) && $General['channels'] == 1;
        $hasCats = isset($General['cat_casting']) && $General['cat_casting'] == 1;
        $hasTax = isset($General['taxonomy_podcasting']) && $General['taxonomy_podcasting'] == 1;
        $hasPT = isset($General['posttype_podcasting']) && $General['posttype_podcasting'] == 1;
        $slug = $_GET['feed_slug'] ?? '';

        if ((!$hasChannels && !$hasCats && !$hasTax && !$hasPT) || $slug == 'podcast') {
        ?>
        <button type="button" id="live-item-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-live-item')"><?php echo htmlspecialchars(__('Live Item', 'powerpress')); ?></button>
        <?php } ?>
        <button type="button" id="experimental-tab" class="tablinks" onclick="powerpress_openTab(event, 'settings-experimental')"><?php echo htmlspecialchars(__('Experimental', 'powerpress')); ?></button>
    </div>
	
	<div id="settings-welcome" class="pp-tabcontent active">
        <?php powerpress_render_sidenav_container('welcome', 'Blubrry Services', $General); ?>
        <button type="button" style="display: none;" id="welcome-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'welcome-all')"><img class="pp-nav-icon" style="width: 22px;" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/rss-symbol.svg"><?php echo htmlspecialchars(__('Hidden button', 'powerpress')); ?></button>
        <div id="welcome-all" class="pp-sidenav-tab active">
	        <?php powerpressadmin_welcome($General, $FeedSettings); ?>
        </div>
	</div>

    <div id="settings-feeds" class="pp-tabcontent has-sidenav">
        <div class="pp-sidenav-toggle-container">
            <?php powerpress_render_sidenav_toggle('feeds', 'More Feed Settings and Blubrry Services'); ?>
            <div class="pp-sidenav">
                <div class="pp-sidenav-extra"><p class="pp-sidenav-extra-text"><b><?php echo htmlspecialchars(__('FEED SETTINGS', 'powerpress')); ?></b></p></div>
                <button type="button" id="feeds-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'feeds-feeds')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/megaphone_gray.svg"><?php echo htmlspecialchars(__('Podcast Feeds', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-settings-tab" onclick="sideNav(event, 'feeds-settings')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/option_bar_settings_gray.svg"><?php echo htmlspecialchars(__('Feed Settings', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-artwork-tab" onclick="sideNav(event, 'feeds-artwork')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/camera_gray.svg"><?php echo htmlspecialchars(__('Podcast Artwork', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-seo-tab" onclick="sideNav(event, 'feeds-seo')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/fileboard_checklist_gray.svg"><?php echo htmlspecialchars(__('Podcast SEO', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-basic-tab" onclick="sideNav(event, 'feeds-basic')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/edit_gray.svg"><?php echo htmlspecialchars(__('Basic Show Information', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-rating-tab" onclick="sideNav(event, 'feeds-rating')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/star_favorite_gray.svg"><?php echo htmlspecialchars(__('Rating Settings', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="feeds-apple-tab" onclick="sideNav(event, 'feeds-apple')"><span id="apple-icon-feed" class="destinations-side-icon" style="margin-left: 2px;"></span><span class="destination-side-text" style="margin-left: 6px;"><?php echo htmlspecialchars(__('Apple Settings', 'powerpress')); ?></span></button>
                <?php
                powerpressadmin_edit_blubrry_services($General);
                ?>
                <div class="pp-sidenav-extra"><a href="https://www.blubrry.com/support/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('POWERPRESS DOCUMENTATION', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://www.blubrry.com/podcast-insider/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('PODCAST INSIDER BLOG', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/manual/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('PODCAST MANUAL', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/services/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY RESOURCES', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/support/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY SUPPORT', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://wordpress.org/support/plugin/powerpress/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY POWERPRESS FORUM', 'powerpress')); ?></a></div>
            </div>
        </div>
        <div id="feeds-feeds" class="pp-sidenav-tab active">
            <?php
            powerpressadmin_edit_feed_general($FeedSettings, $General, $FeedAttribs);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-settings" class="pp-sidenav-tab">
            <?php
            powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-artwork" class="pp-sidenav-tab">
            <?php
            powerpressadmin_edit_artwork($FeedSettings, $General);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-seo" class="pp-sidenav-tab">
            <?php
            require_once(POWERPRESS_ABSPATH . "/powerpressadmin-search.php");
            powerpress_admin_search();
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-basic" class="pp-sidenav-tab">
            <?php
            powerpressadmin_edit_funding($FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-rating" class="pp-sidenav-tab">
            <?php
            powerpressadmin_edit_tv($FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="feeds-apple" class="pp-sidenav-tab">
            <?php
            powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
            powerpress_settings_tab_footer();
            ?>
        </div>
    </div>

    <div id="settings-website" class="pp-tabcontent">
        <div class="pp-sidenav-toggle-container">
            <?php powerpress_render_sidenav_toggle('website', 'More Website Settings and Blubrry Services'); ?>
            <div class="pp-sidenav">
                <div class="pp-sidenav-extra"><p class="pp-sidenav-extra-text"><b><?php echo htmlspecialchars(__('WEBSITE SETTINGS', 'powerpress')); ?></b></p></div>
                <button type="button" id="website-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'website-settings')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/desktop_gray.svg"><?php echo htmlspecialchars(__('Website Settings', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="website-blog-tab" onclick="sideNav(event, 'website-blog')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/file_gray.svg"><?php echo htmlspecialchars(__('Blog Posts and Pages', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="website-subscribe-tab" onclick="sideNav(event, 'website-subscribe')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/profile_plus_round_gray.svg"><?php echo htmlspecialchars(__('Subscribe Page', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="website-shortcodes-tab" onclick="sideNav(event, 'website-shortcodes')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/connection_pattern_gray.svg"><?php echo htmlspecialchars(__('PowerPress Shortcodes', 'powerpress')); ?></button>
                <button type="button" class="pp-sidenav-tablinks" id="website-new-window-tab" onclick="sideNav(event, 'website-new-window')"><img class="pp-nav-icon" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/play_gray.svg"><?php echo htmlspecialchars(__('Play in New Window', 'powerpress')); ?></button>
                <?php
                powerpressadmin_edit_blubrry_services($General);
                ?>
                <div class="pp-sidenav-extra"><a href="https://www.blubrry.com/support/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('POWERPRESS DOCUMENTATION', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://www.blubrry.com/podcast-insider/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('PODCAST INSIDER BLOG', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/manual/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('PODCAST MANUAL', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/services/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY RESOURCES', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://blubrry.com/support/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY SUPPORT', 'powerpress')); ?></a></div>
                <div class="pp-sidenav-extra"><a href="https://wordpress.org/support/plugin/powerpress/" class="pp-sidenav-extra-text"><?php echo htmlspecialchars(__('BLUBRRY POWERPRESS FORUM', 'powerpress')); ?></a></div>
            </div>
        </div>

        <?php
        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;
        if( !isset($General['subscribe_links']) )
            $General['subscribe_links'] = false;
        if( !isset($General['subscribe_label']) )
            $General['subscribe_label'] = '';
        require_once( dirname(__FILE__).'/views/settings_tab_appearance.php' );

        ?>


        <div id="website-settings" class="pp-sidenav-tab active">
            <?php
            powerpressadmin_website_settings($General, $FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="website-blog" class="pp-sidenav-tab">
            <?php
            powerpressadmin_blog_settings($General, $FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="website-subscribe" class="pp-sidenav-tab">
            <?php
            powerpress_subscribe_settings($General, $FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="website-shortcodes" class="pp-sidenav-tab">
            <?php
            powerpress_shortcode_settings($General, $FeedAttribs);
            powerpress_settings_tab_footer();
            ?>
        </div>
        <div id="website-new-window" class="pp-sidenav-tab">
            <?php
            powerpressadmin_new_window_settings($General, $FeedSettings);
            powerpress_settings_tab_footer();
            ?>
        </div>
    </div>

    <div id="settings-destinations" class="pp-tabcontent">
        <?php
        powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs);
        ?>
    </div>
	
	<div id="settings-analytics" class="pp-tabcontent">
        <div class="pp-sidenav">
            <?php
            powerpressadmin_edit_blubrry_services($General);
            ?>
        </div>
		<?php
	if( $MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION') )
	{
		PowerPressMultiSitePlugin::edit_blubrry_services($General);
	}
	else
	{
		//powerpressadmin_edit_media_statistics($General);
	}
		?>
	</div>

	<div id="settings-advanced" class="pp-tabcontent">
        <?php powerpress_render_sidenav_container('advanced', 'Blubrry Services', $General); ?>
	<?php
    powerpressadmin_advanced_options($General, false);
    ?>
    </div>

    <div id="settings-make-money" class="pp-tabcontent">
        <?php powerpress_render_sidenav_container('make-money', 'Blubrry Services', $General); ?>
        <?php
        $publisher_origin = rtrim(powerpress_get_publish_url(), '/'); ?>
        <button type="button" style="display: none;" id="make-money-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'make-money-all')"><img class="pp-nav-icon" style="width: 22px;" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/rss-symbol.svg"><?php echo htmlspecialchars(__('Hidden button', 'powerpress')); ?></button>

        <div id="make-money-all" class="pp-sidenav-tab active">
            <div class="pp_container">
                <h1 class="pp-heading"><?php echo __('Programmatic Advertising', 'powerpress'); ?></h1>
                <br />
                <p class="pp-sub"><?php echo __('Blubrry hosting customers have access to our Programmatic Advertising service, which automatically puts ads into your show and pays YOU out directly from Blubrry! Simply configure your shows in the Blubrry Publisher then use the link there to sync you WordPress site.', 'powerpress'); ?></p>
                <br />
                <p class="pp-main"><a class="pp-main" target="_blank"
                   href="https://blubrry.com/services/programmatic-advertising/"
                   class="pp_align-center"><?php echo __('Learn More', 'powerpress'); ?></a></p>
                <br />
                <p class="pp-main"><a class="pp-main"
                   href="<?php echo $publisher_origin; ?>/partners/programmatic-advertising-management/"
                   class="pp_align-center"><?php echo __('Configure Shows for Programmatic Ads', 'powerpress'); ?></a></p>

            </div>
        </div>
    </div>

    <div id="settings-live-item" class="pp-tabcontent">
        <?php powerpress_render_sidenav_container('live-item', 'Blubrry Services', $General); ?>
        <?php powerpressadmin_live_item_options($FeedSettings); ?>
    </div>

    <div id="settings-experimental" class="pp-tabcontent">
        <?php powerpress_render_sidenav_container('experimental', 'Blubrry Services', $General); ?>
        <?php
        powerpressadmin_experimental_options($FeedSettings);
        ?>
    </div>

</div>
<div class="clear"></div>

<?php
}

function powerpressadmin_live_item_options($Feed)
{
    $lit = isset($Feed['live_item']) ? $Feed['live_item'] : array(
        'enabled' => '0',
        'status' => 'Pending',
        'guid' => '',
        'start_date_time' => '',
        'end_date_time' => '',
        'timezone' => 'EST',
        'title' => '',
        'stream_link' => '',
        'fallback_link' => '',
        'episode_link' => '',
        'cover_art' => '',
        'stream_type' => 'audio/mpeg',
        'description' => '',
        'old_status' => 'Pending'
    );

    $litError = get_option('lit_error');

    if ($litError)
        update_option('lit_error', false);

    $litErrorMsg = get_option('lit_error_msg');

    if ($litErrorMsg != "")
        update_option('lit_error_msg', '');

    ?>
    <style>
        .alert {
            font-size: 130%;
            padding: .5%;
            background-color: #f44336; /* Red */
            color: white;
            display: inline-block;
            width: 99%;
            /*margin-bottom: 1.5%;*/
        }
        .alert-danger {
            background-color: #FEF7F8;
            border-left: solid;
            border-left-color: #E36F58;
            color: #444444;
            border-left-width: 10px;
            max-width: 100%;
        }
    </style>
    <div style="margin-left: 10px;">
        <button type="button" style="display: none;" id="live-item-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'live-item-all')"><img class="pp-nav-icon" style="width: 22px;" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/rss-symbol.svg"><?php echo htmlspecialchars(__('Hidden button', 'powerpress')); ?></button>
        <div id="live-item-all" class="pp-sidenav-tab active" style="width: 100%;">
            <h1 class="pp-heading"><?php echo __('Live Item Tag', 'powerpress'); ?></h1>
            <?php if ($litError) {
                ?>
                <div class="alert alert-danger" role="alert">
                    <span><?php echo __($litErrorMsg, 'powerpress'); ?></span>
                </div>
            <?php } ?>
            <p><?php echo __('This is a new initiative as part of Podcasting 2.0. The Live Item tag is for those with a live component to your show, whether it be an audio stream or a video stream. It is important to know that only apps that designate the LIT function at NewPodcastApps.com support this.', 'powerpress'); ?></p>
            <p><?php echo __('Going live is a bigger part of podcasting now. What has been developed by Podcasting 2.0 is the ability for you to show up as live in the supported apps. Giving those listeners the ability to be notified in supported podcasting apps that you are live to be able to listen or watch within the podcasting apps that support this.', 'powerpress'); ?></p>
            <div class="col">
                <div class="row">
                    <input type="hidden" name="Feed[live_item][enabled]" value="0">
                    <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="Feed[live_item][enabled]" value="1" <?php echo ( !empty($lit['enabled']) && $lit['enabled'] != '0' ?' checked':''); ?>>
                    <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em; display: flex; align-items: center; justify-content: flex-start;"">
                        <p class="pp-main">
                            Enable Live Item Feature
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__('By enabling this, you will notify apps of the status of your event, be it Pending, Live, or Ended.', 'powerpress')); ?></span>
                            </div>
                        </p>
                    </div>
                </div>
                <hr style="margin-left: -15px; margin-right: -15px;"/>
                <div class="row">
                    <h2><?php echo __('Live Item Settings', 'powerpress'); ?></h2>
                </div>
                <div class="row">
                    <div class="col-lg-2 pl-0">
                        <label for="lit-status" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Status", "powerpress"); ?></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;">
                                    <?php echo esc_html(__("You must set your statuses for each part of the process.
                                            Switching from Pending to Live to Ended is not automated.
                                            You have to make these status changes to inform platforms of the current Live status.", "powerpress")); ?>
                                    <br />
                                    <br />
                                    <?php echo __("Pending: Announce the parameters of when you expect to go live. This can be set hours or days before the event.", "powerpress")?>
                                    <br/>
                                    <br />
                                    <?php echo __("Live: When you are moments away from going live, update your setting to Live. This will let the supported apps know that you are truly going live. Please note that deviations on when you are expected to go live and when you actually do can change. This will inform the apps you are indeed live.", "powerpress")?>
                                    <br />
                                    <br />
                                    <?php echo __("Ended: Inform apps that your Live show has ended.", "powerpress")?>
                                </span>
                            </div>
                        </label>
                        <input type="hidden" name="Feed[live_item][old_status]" value="<?php echo !empty($lit['status']) ? $lit['status'] : 'Pending'; ?>" />
                        <input type="hidden" name="Feed[live_item][podping_status]" value="<?php echo isset($lit['podping_status']) ? $lit['podping_status'] : -1; ?>" />
                        <select name="Feed[live_item][status]" id="lit-status" class="pp-settings-select" style="width: 100% !important; font-size: 95%;">
                            <option <?php echo (!empty($lit['status']) && $lit['status']  == 'Pending') || empty($lit['status']) ? 'selected' : '' ?> value="Pending"><?php echo __("Pending", "powerpress"); ?></option>
                            <option <?php echo !empty($lit['status']) && $lit['status'] == 'Live' ? 'selected' : '' ?> value="Live"><?php echo __("Live", "powerpress"); ?></option>
                            <option <?php echo !empty($lit['status']) && $lit['status'] == 'Ended' ? 'selected' : '' ?> value="Ended"><?php echo __("Ended", "powerpress"); ?></option>
                        </select>
                    </div>
                    <div class="col-lg-2 pl-0"></div>
                    <div class="col-lg-8 pl-0">
                        <input type="hidden" name="Feed[live_item][guid]" value="<?php echo !empty($lit['guid']) ? $lit['guid'] : ''; ?>">
                        <label for="lit-guid" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Live Item Guid", "powerpress"); ?></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__('Like every Podcast, Podcasting 2.0 assigns a GUID for your live events. This is informational only and highly technical but this GUID will stay with your live events for the life of your show.', 'powerpress')); ?></span>
                            </div>
                        </label>
                        <p><?php echo !empty($lit['guid']) ? $lit['guid'] : __("Your GUID will be created once you give your live item a title.", "powerpress"); ?></p>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-4 pl-0">
                        <label for="lit-start-date" style="margin: 0;"><h3><?php echo __("Start Date/Time", "powerpress"); ?><span style="color: red;">*</span></h3></label>
                        <input id="lit-start-date" name="Feed[live_item][start_date_time]" class="pp-settings-text-input" type="datetime-local" value="<?php echo !empty($lit['start_date_time']) ? $lit['start_date_time'] : "" ?>" />
                    </div>
                    <div class="col-lg-4 pl-0">
                        <label for="lit-end-date" style="margin: 0;"><h3><?php echo __("End Date/Time", "powerpress"); ?><span style="color: red;">*</span></h3></label>
                        <input id="lit-end-date" name="Feed[live_item][end_date_time]" class="pp-settings-text-input" type="datetime-local" value="<?php echo !empty($lit['end_date_time']) ? $lit['end_date_time'] : "" ?>" />
                    </div>
                    <div class="col-lg-4 pl-0">
                        <label for="lit-timezone" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Timezone", "powerpress"); ?><span style="color: red;">*</span></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__('Note: (EST, CST, MST, and PST) are from March 12th to Nov 15th, with (EDT, CDT, MDT, and PDT) from Nov 16th to March 11th)', 'powerpress')); ?></span>
                            </div>
                        </label>
                        <?php printTimezoneSelector(!empty($lit['timezone']) ? $lit['timezone'] : 'EST'); ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12 pl-0">
                        <label for="lit-title" style="margin: 0;"><h3><?php echo __("Livestream Title", "powerpress"); ?><span style="color: red;">*</span></h3></label>
                        <input id="lit-title" maxlength="100" class="pp-settings-text-input" type="text" name="Feed[live_item][title]" value="<?php echo !empty($lit['title']) ? htmlspecialchars($lit['title']) : ''; ?>" maxlength="50" />
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-2 pl-0 pr-0">
                        <label for="lit-stream-type" style="margin: 0;"><h3><?php echo __("Stream Type", "powerpress"); ?><span style="color: red;">*</span></h3></label>
                        <select id="lit-stream-type" name="Feed[live_item][stream_type]" class="pp-settings-select" style="width: 100% !important; font-size: 95%;">
                            <option <?php echo (!empty($lit['stream_type']) && $lit['stream_type'] == 'audio/mpeg') || empty($lit['stream_type']) ? 'selected' : '' ?> value="audio/mpeg">Audio - .mp3</option>
                            <option <?php echo !empty($lit['stream_type']) && $lit['stream_type'] == 'audio/x-m4a' ? 'selected' : '' ?> value="audio/x-m4a">Audio - .m4a</option>
                            <option <?php echo !empty($lit['stream_type']) && $lit['stream_type'] == 'video/mp4' ? 'selected' : '' ?> value="video/mp4">Video - .mp4</option>
                            <option <?php echo !empty($lit['stream_type']) && $lit['stream_type'] == 'application/x-mpegURL' ? 'selected' : '' ?> value="application/x-mpegURL">HLS - .m3u8</option>
                        </select>
                    </div>
                    <div class="col-lg-5">
                        <label for="lit-stream-link" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Audio/Video Steam Link", "powerpress"); ?><span style="color: red;">*</span></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__("This is the link to your livestream. It could be your live audio stream link if you're using Icecast/Shoutcast, or it can be a link to the video endpoint, which is typically an RTMP link. Live video is currently less supported than an audio stream.", 'powerpress')); ?></span>
                            </div>
                        </label>
                        <input id="lit-stream-link" class="pp-settings-text-input" type="text" name="Feed[live_item][stream_link]" value="<?php echo !empty($lit['stream_link']) ? htmlspecialchars($lit['stream_link']) : ''; ?>" />
                    </div>
                    <div class="col-lg-5 pl-0">
                        <label for="lit-fallback-link" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Fallback Link", "powerpress"); ?><span style="color: red;">*</span></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__("If the podcast app does not support your livestream protocol, you need to link to your live YouTube episode or a dedicated page on your website with the live audio or video stream contained there.", 'powerpress')); ?></span>
                            </div>
                        </label>
                        <input id="lit-fallback-link" class="pp-settings-text-input" type="text" name="Feed[live_item][fallback_link]" value="<?php echo !empty($lit['fallback_link']) ? htmlspecialchars($lit['fallback_link']) : ''; ?>" />
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-2 pl-0 pr-0"></div>
                    <div class="col-lg-5">
                        <label for="lit-episode-link" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Episode Link (Optional)", "powerpress"); ?></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__("This is a URL to an episode page that supports the live event. If you do not have a dedicated page for your live event, you could push them to a dedicated page that shows the schedule of your live events. You can be creative here. For example: Link to a fallback link.", 'powerpress')); ?></span>
                            </div>
                        </label>
                        <input id="lit-episode-link" class="pp-settings-text-input" type="text" name="Feed[live_item][episode_link]" value="<?php echo !empty($lit['episode_link']) ? htmlspecialchars($lit['episode_link']) : ''; ?>" />
                    </div>
                    <div class="col-lg-5 pl-0">
                        <label for="lit-cover-art" style="margin: 0; display: flex; align-items: center; justify-content: flex-start;">
                            <h3><?php echo __("Cover Art (Optional)", "powerpress"); ?></h3>
                            <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__("This is album art that will only be shown when you are live so if you want to have specific art shown while you live, you can provide a link to it. Minimum 1400x1400, similar to Apple podcast art but solely used for your live events.", 'powerpress')); ?></span>
                            </div>
                        </label>
                        <input id="lit-cover-art" class="pp-settings-text-input" type="text" name="Feed[live_item][cover_art]" value="<?php echo !empty($lit['cover_art']) ? htmlspecialchars($lit['cover_art']) : ''; ?>" />
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12 pl-0">
                        <label for="lit-description" style="margin: 0;"><h3><?php echo __("Description (Optional)", "powerpress"); ?></h3></label>
                        <textarea id="lit-description" name="Feed[live_item][description]" class="pp-settings-text-input" rows="10"><?php echo !empty($lit['description']) ? htmlspecialchars($lit['description']) : ""; ?></textarea>
                    </div>
                </div>
            </div>

            <?php powerpress_settings_tab_footer(); ?>
        </div>
    </div>

    <?php
}

function printTimezoneSelector($timezoneVal) {
    $tzlist = DateTimeZone::listAbbreviations();
    echo '<select name="Feed[live_item][timezone]" id="lit-timezone" class="pp-settings-select" style="width: 100% !important; font-size: 95%;">';
    foreach ($tzlist as $tz => $value) {
        if (strtoupper($tz) == $timezoneVal)
            echo '<option selected value="' . strtoupper($tz) . '">' . strtoupper($tz) . '</option>';
        else
            echo '<option value="' . strtoupper($tz) . '">' . strtoupper($tz) . '</option>';

        if ($tz == 'ywt')
            break;
    }
    echo '</select>';
}

function powerpressadmin_advanced_options($General, $link_account = false)
{
	// Break the bottom section here out into it's own function
	$ChannelsCheckbox = '';
	if( !empty($General['custom_feeds']) )
		$ChannelsCheckbox = ' onclick="alert(\''.  __('You must delete all of the Podcast Channels to disable this option.', 'powerpress')  .'\');return false;"';
	$CategoryCheckbox = '';
	//if( !empty($General['custom_cat_feeds']) ) // Decided ont to include this warning because it may imply that you have to delete the actual category, which is not true.
	//	$CategoryCheckbox = ' onclick="alert(\'You must remove podcasting from the categories to disable this option.\');return false;"';
?>
<script language="javascript">

jQuery(document).ready( function() {
	
	jQuery('.pp-expand-section').click( function(e) {
		e.preventDefault();
		
		if( jQuery(this).hasClass('pp-expand-section-expanded') ) {
			jQuery(this).removeClass('pp-expand-section-expanded');
			jQuery(this).parent().next('div').hide(400);
			jQuery(this).blur();
		} else {
			jQuery(this).addClass('pp-expand-section-expanded');
			jQuery(this).parent().next('div').show(400);
			jQuery(this).blur();
		}
	});
});

function goToPodcastSEO() {
    jQuery("#feeds-tab").click();
    jQuery("#feeds-seo-tab").click();
    return false;
}
</script>
<div style="margin-left: 10px;">

    <button type="button" style="display: none;" id="advanced-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'advanced-all')"><img class="pp-nav-icon" style="width: 22px;" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/rss-symbol.svg"><?php echo htmlspecialchars(__('Hidden button', 'powerpress')); ?></button>
	<div id="advanced-all" class="pp-sidenav-tab active">
        <h1 class="pp-heading"><?php echo __('Advanced Settings', 'powerpress'); ?></h1>

        <div>
			<input type="hidden" name="General[network_mode]" value="0" />
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[network_mode]" value="1" <?php echo ( !empty($General['network_mode']) ?' checked':''); ?>/>
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Multi-Program Mode', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('This feature allows you to publish to multiple Blubrry-hosted shows from a single user account.', 'powerpress'); ?></p>
            </div>
		</div>
        <div>
            <input type="hidden" name="General[use_caps]" value="0" />
            <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[use_caps]" value="1" <?php echo ( !empty($General['use_caps']) ?' checked':''); ?>/>
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('User Role Management', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Adding User Role Management will allow administrators, editors and authors access to create and configure podcast episodes. 
                    This feature is supported by WordPress Roles and Capabilities.', 'powerpress'); ?>
                </p>
            </div>
        </div>
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="NULL[import_podcast]" value="1" checked disabled />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_import_feed.php'); ?>"><?php echo __('Import Podcast', 'powerpress'); ?></a></p>
                <p class="pp-sub"><?php echo __('Import podcast feed from SoundCloud, LibSyn, PodBean or other podcast service.', 'powerpress'); ?></p>
            </div>
		</div>
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="NULL[migrate_media]" value="1" checked disabled />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_migrate.php'); ?>"><?php echo __('Migrate Media', 'powerpress'); ?></a></p>
                <p class="pp-sub"><?php echo __('Migrate media files to Blubrry Podcast Media Hosting with only a few clicks.', 'powerpress'); ?></p>
            </div>
		</div>
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="NULL[podcasting_seo]" value="1" checked disabled />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><a id="advanced-tab-seo-link" onclick="goToPodcastSEO();return false;"><?php echo __('Podcasting SEO', 'powerpress'); ?></a></p>
                <p class="pp-sub"><?php echo __('Optimize how your podcast appears in Internet search results.', 'powerpress'); ?></p>
            </div>
		</div>
		
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="NULL[player_options]" value="1" checked disabled />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Audio Player Options', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Select from 3 different web based audio players.', 'powerpress'); ?>
                    <b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&sp=1'); ?>">(<?php echo __('configure audio player', 'powerpress'); ?>)</a></b></p>
            </div>
		</div>
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="NULL[video_player_options]" value="1" checked disabled />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Video Player Options', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Select from 3 different web based video players.', 'powerpress'); ?>
                <b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_videoplayer.php&sp=1'); ?>">(<?php echo __('configure video player', 'powerpress'); ?>)</a></b></p>
            </div>
		</div>
		<div>
			<input type="hidden" name="General[disable_wptexturize]" value="0" />
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[disable_wptexturize]" value="1" <?php echo ( !empty($General['disable_wptexturize']) ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <div style="display: flex; align-items: center;">
                    <p class="pp-main" style="margin: 0;"><?php echo __('Disable Smart Typography', 'powerpress'); ?></p>
                    <div class="pp-tooltip-right" style="height: 16px; width: 16px; margin-left: 5px;">i
                        <span class="text-pp-tooltip" style="top: -50%; min-width: 250px;"><?php echo esc_html(__('PowerPress uses a WordPress feature which automatically converts straight quotes into "smart" punctuation. Some publishers require plain ASCII characters, so this option disables that behavior in podcast feeds.', 'powerpress')); ?></span>
                    </div>
                </div>
                <p class="pp-sub"><?php echo __('Keeps quotes and punctuation exactly as you entered them in RSS feeds. Helpful if you submit content to syndication partners that don\'t allow "smart" punctuation (e.g., AP, NYT).', 'powerpress'); ?></p>
            </div>
		</div>
		<div>
			<input type="hidden" name="General[channels]" value="0" />
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[channels]" value="1" <?php echo ( !empty($General['channels']) ?' checked':''); echo $ChannelsCheckbox; ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Custom Podcast Channels', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Manage multiple media files and/or formats to one blog post.', 'powerpress'); ?>
                <?php if( empty($General['channels']) ) { ?>
                (<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)
                <?php } else { ?>
                <b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php'); ?>">(<?php echo __('configure podcast channels', 'powerpress'); ?>)</a></b>
                <?php } ?>
                </p>
            </div>
		</div>
		<div>
			<input type="hidden" name="General[cat_casting]" value="0" />
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[cat_casting]" value="1" <?php echo ( !empty($General['cat_casting']) ?' checked':'');  echo $CategoryCheckbox;  ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Category Podcasting', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Manage podcasting for specific categories.', 'powerpress'); ?>
                <?php if( empty($General['cat_casting']) ) { ?>
                (<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)
                <?php } else { ?>
                <b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php'); ?>">(<?php echo __('configure podcast categories', 'powerpress'); ?>)</a></b>
                <?php } ?>
                </p>
            </div>
		</div>
		
		
		<?php if (!empty($General['taxonomy_podcasting'])) { ?>
		<div id="pp-taxonomy-podcasting-section">
			<input type="hidden" name="General[taxonomy_podcasting]" value="1" />
			<input class="pp-settings-checkbox pp-deprecated-feature-checkbox" data-feature="taxonomy_podcasting" style="margin-top: 3em;" type="checkbox" value="1" checked />
			<div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
				<p class="pp-main"><?php echo __('Taxonomy Podcasting', 'powerpress'); ?></p>
				<p class="pp-sub"><?php echo __('Manage podcasting for specific taxonomies.', 'powerpress'); ?>
				<b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_taxonomyfeeds.php'); ?>">(<?php echo __('configure taxonomy podcasting', 'powerpress'); ?>)</a></b>
				</p>
				<p class="pp-sub" style="color: #996800; font-style: italic;"><?php echo __("We're phasing this out. If you disable it, it can't be re-enabled later.", 'powerpress'); ?></p>
			</div>
		</div>
		<?php } ?>
		<?php if (!empty($General['posttype_podcasting'])) { ?>
		<div id="pp-posttype-podcasting-section">
			<input type="hidden" name="General[posttype_podcasting]" value="1" />
			<input class="pp-settings-checkbox pp-deprecated-feature-checkbox" data-feature="posttype_podcasting" style="margin-top: 3em;" type="checkbox" value="1" checked />
			<div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
				<p class="pp-main"><?php echo __('Post Type Podcasting', 'powerpress'); ?></p>
				<p class="pp-sub"><?php echo __('Manage podcasting for specific post types.', 'powerpress'); ?>
				<b><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_posttypefeeds.php'); ?>">(<?php echo __('configure post type podcasting', 'powerpress'); ?>)</a></b>
				</p>
				<p class="pp-sub" style="color: #996800; font-style: italic;"><?php echo __("We're phasing this out. If you disable it, it can't be re-enabled later.", 'powerpress'); ?></p>
			</div>
		</div>
		<?php } ?>

		<!-- DEPRECATED FEATURE CONFIRMATION MODAL -->
		<?php if (!empty($General['taxonomy_podcasting']) || !empty($General['posttype_podcasting'])) { ?>
		<div id="pp-deprecated-feature-modal" class="pp-modal" style="display:none;">
			<div class="pp-modal-content">
				<h3><?php echo __('Disable deprecated feature?', 'powerpress'); ?></h3>
				<p><?php echo __("If you turn this off, you won't be able to re-enable it later.", 'powerpress'); ?></p>
				<div class="pp-modal-options">
					<label><input type="radio" name="pp_deprecated_confirm" value="keep" checked /> <?php echo __('Keep Enabled', 'powerpress'); ?></label>
					<label><input type="radio" name="pp_deprecated_confirm" value="disable" /> <?php echo __('Disable', 'powerpress'); ?></label>
				</div>
				<div class="pp-modal-actions">
					<button type="button" id="pp-deprecated-confirm-btn" class="button button-primary"><?php echo __('Confirm', 'powerpress'); ?></button>
				</div>
			</div>
		</div>
		<input type="hidden" id="pp-deprecated-nonce" value="<?php echo wp_create_nonce('powerpress-disable-deprecated'); ?>" />
		<?php } ?>
		<div>
			<input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[playlist_player]" value="1" <?php echo ( !empty($General['playlist_player']) ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('PowerPress Playlist Player', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Create playlists for your podcasts.', 'powerpress'); ?>
                <b><a href="https://blubrry.com/support/powerpress-documentation/powerpress-playlist-shortcode/" target="_blank">(<?php echo __('learn more', 'powerpress'); ?>)</a></b>
                </p>
            </div>
		</div>
        <div>
            <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[powerpress_network]" value="1" <?php echo ( !empty($General['powerpress_network']) ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('PowerPress Network', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Create a network of podcasts.', 'powerpress'); ?>
                    <?php if (empty($General['powerpress_network'])): ?>
                        (<?php _e('feature will appear in left menu when enabled', 'powerpress'); ?>)
                        <b><a href="https://blubrry.com/support/powerpress-documentation/podcast-network/" target="_blank">(<?php echo __('learn more', 'powerpress'); ?>)</a></b>
                    <?php else: ?>
                        <b><a href="<?php echo admin_url('admin.php?page=network-plugin'); ?>">(<?php _e('Configure PowerPress Network', 'powerpress'); ?>)</a></b>
                    <?php endif; ?>
                </p>
            </div>
        </div>
        <div>
            <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[powerpress_accept_json]" value="1" <?php echo ( !empty($General['powerpress_accept_json']) ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Allow JSON uploads', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Check this box if you plan to upload chapter files to your WordPress site.', 'powerpress'); ?>
                </p>
            </div>
        </div>
        <div>
            <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[pp_show_block_errors]" value="1" <?php echo ( !isset($General['pp_show_block_errors']) || $General['pp_show_block_errors'] ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Show errors in Block Editor', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Disable if you are not planning to use the PowerPress Block.', 'powerpress'); ?>
                </p>
            </div>
        </div>
        <div>
            <input class="pp-settings-checkbox" style="margin-top: 3em;" type="checkbox" name="General[powerpress_self_hosted_media]" value="1" <?php echo ( !empty($General['powerpress_self_hosted_media']) ?' checked':''); ?> />
            <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 2em;">
                <p class="pp-main"><?php echo __('Disable server-side request forgery check', 'powerpress'); ?></p>
                <p class="pp-sub"><?php echo __('Check this box if you host your podcast media on your WordPress site or somewhere in your local network, so that we can validate your media.', 'powerpress'); ?>
                </p>
            </div>
        </div>
        <?php
        powerpressadmin_edit_media_statistics($General);
        powerpress_settings_tab_footer(); ?>
	</div>
</div>

<?php
}

function powerpressadmin_experimental_options($General, $feed_slug = 'podcast', $link_account = false)
{
    $valueError = isset($General['value_error']) ? $General['value_error'] : "no";
    $valueError = $valueError == "yes";
    $valueErrorMsg = isset($General['value_error_message']) ? $General['value_error_message'] : "";
    ?>
    <style>
        .value-btn:hover {
            cursor: pointer;
        }
    </style>
    <div style="margin-left: 10px;">
        <button type="button" style="display: none;" id="experimental-default-open" class="pp-sidenav-tablinks active" onclick="sideNav(event, 'experimental-all')"><img class="pp-nav-icon" style="width: 22px;" alt="" src="<?php echo powerpress_get_root_url(); ?>images/settings_nav_icons/rss-symbol.svg"><?php echo htmlspecialchars(__('Hidden button', 'powerpress')); ?></button>
        <div id="experimental-all" class="pp-sidenav-tab active" style="width: 100%;">
            <div style="display: flex; flex-direction: row; justify-content: flex-start; align-items: center;">
                <h1 class="pp-heading"><?php echo __('Value4Value (V4V)', 'powerpress'); ?></h1>
                <a href="https://blubrry.com/support/podcasting-2-0-introduction/" style="color: inherit; text-decoration: none;" target="_blank"><div class="pp-tooltip-right" style="height: 20px; width: 20px; margin: 1ch 0 0 1ch;">i</div></a>
            </div>

            <?php
            if ($valueError) {
            ?>
                <div class="alert alert-danger" role="alert">
                    <span><?php echo __($valueErrorMsg, 'powerpress'); ?></span>
                </div>
            <?php } ?>
            <div class="row mr-0 ml-0">
                <p class="pp-sub">
                    <?php
                    echo __('The Value Tag is part of the Podcasting 2.0 initiative geared at helping podcasters receive contributions from their listeners.
                We highly recommend you review our dedicated documentation on the Value Tag as it is a complex topic.
                Blubrry has partnered with Alby to participate in the Value 4 Value podcast model. Signing up with Alby 
                    Signing up with ', 'powerpress');
                    echo '<a href="http://getalby.com/">'.__('Alby', 'powerpress').'</a> ';
                    echo __('gives you the code snippet you need in the Value Tag box. There is a small monthly fee to have an Alby Hub/Wallet.', 'powerpress');
                    ?>
                </p>
            </div>
            <div class="row mr-0 ml-0 mt-4">
                <p class="pp-sub">
                    <?php
                    echo __('Alby and Fountain users only need to enter their Alby or Fountain address and click the arrow, and we will pre-populate the appropriate fields.', 'powerpress');
                    ?>
                </p>
            </div>
            <div class="row mr-0 ml-0 mt-4">
                <p class="pp-sub">
                    <?php echo __('Note:', 'powerpress'); ?>
                    <?php echo __('Powerpress adds an automatic 3% split to support the development of the plug-in . Thanks for your support!', 'powerpress'); ?>
                </p>
            </div>
            <div class="row mr-0 ml-0 mt-4">
                <p class="pp-sub">
                    <strong><?php echo __('Warning:', 'powerpress'); ?></strong>
                    <?php echo __('For those entering the data manually, you should check with your vendor on the valid entries for each field.', 'powerpress'); ?>
                </p>
            </div>

            <!-- 
            Value4Value Template Renderer
            -->
            <?php
            powerpress_render_template([
                'type' => 'v4v',
                'context' => 'channel',
                'FeedSlug' => $feed_slug,
                'Data' => $General,
                'NamePrefix' => "Feed",
                'hide_section_header' => true,
                'show_inherit_checkbox' => false
            ]);
            ?>
            <?php powerpress_settings_tab_footer(); ?>
        </div>
    </div>
    <script defer>
        document.addEventListener('DOMContentLoaded', function() {
            initValueRecipientManager( '<?php echo $feed_slug; ?>');
        });
    </script>

    <?php
}

function powerpressadmin_edit_podpress_options($General)
{
	if( !empty($General['process_podpress']) || powerpress_podpress_episodes_exist() )
	{
		if( !isset($General['process_podpress']) )
			$General['process_podpress'] = 0;
		if( !isset($General['podpress_stats']) )	
			$General['podpress_stats'] = 0;
?>

<h3><?php echo __('PodPress Options', 'powerpress'); ?></h3>
<table class="form-table">
<tr valign="top">
<th scope="row">

<?php echo __('PodPress Episodes', 'powerpress'); ?></th> 
<td>
<select name="General[process_podpress]" class="bpp_input_med">
<?php
$options = array(0=>__('Ignore', 'powerpress'), 1=>__('Include in Posts and Feeds', 'powerpress') );

foreach( $options as $value => $desc )
	echo "\t<option value=\"$value\"". ($General['process_podpress']==$value?' selected':''). ">$desc</option>\n";
	
?>
</select>  (<?php echo __('includes podcast episodes previously created in PodPress', 'powerpress'); ?>)
</td>
</tr>
	<?php if( !empty($General['podpress_stats']) || powerpress_podpress_stats_exist() ) { ?>
	<tr valign="top">
	<th scope="row">

	<?php echo __('PodPress Stats Archive', 'powerpress'); ?></th> 
	<td>
	<select name="General[podpress_stats]" class="bpp_input_sm">
	<?php
	$options = array(0=>__('Hide', 'powerpress'), 1=>__('Display', 'powerpress') );

	foreach( $options as $value => $desc )
		echo "\t<option value=\"$value\"". ($General['podpress_stats']==$value?' selected':''). ">$desc</option>\n";
		
	?>
	</select>  (<?php echo __('display archive of old PodPress statistics', 'powerpress'); ?>)
	</td>
	</tr>
	<?php } ?>
	</table>
<?php
	}
}

function powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs = array() )
{
	// Set default settings (if not set)
	if( !empty($FeedSettings) )
	{
		if( !isset($FeedSettings['itunes_url']) )
			$FeedSettings['itunes_url'] = '';
	}
	if( !isset($General['itunes_url']) )
		$General['itunes_url'] = '';
	else if( !isset($FeedSettings['itunes_url']) ) // Should almost never happen
		$FeedSettings['itunes_url'] = $General['itunes_url'];
	
	$feed_slug = $FeedAttribs['feed_slug'];
	$cat_ID = $FeedAttribs['category_id'];
	
	if( $feed_slug == 'podcast' && $FeedAttribs['type'] == 'general' )
	{
		if( empty($FeedSettings['itunes_url']) && !empty($General['itunes_url']) )
			$FeedSettings['itunes_url'] = $General['itunes_url'];
	}
	
	$itunes_feed_url = '';

	switch( $FeedAttribs['type'] )
	{
		case 'ttid': {
			$itunes_feed_url = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
		}; break;
		case 'category': {
			if( !empty($General['cat_casting_podcast_feeds']) )
				$itunes_feed_url = get_category_feed_link($cat_ID, 'podcast');
			else
				$itunes_feed_url = get_category_feed_link($cat_ID);
		}; break;
		case 'channel': {
			$itunes_feed_url = get_feed_link($feed_slug);
		}; break;
		case 'post_type': {
			$itunes_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
		}; break;
		case 'general':
		default: {
			$itunes_feed_url = get_feed_link('podcast');
		}
	}
	
?>
<h3><?php echo __('iTunes Listing Information', 'powerpress'); ?></h3>

<?php
} // end itunes general

function powerpressadmin_edit_blubrry_services($General, $action_url = false, $action = false)
{
	$DisableStatsInDashboard = false;
	if( !empty($General['disable_dashboard_stats']) )
		$DisableStatsInDashboard = true;

?>
<div id="connect-blubrry-services">
    <?php
    $creds = get_option('powerpress_creds');
    if( $creds ) { ?>
        <div id="blubrry-services-connected-settings">
            <div style="margin-bottom: 1em;">
                <span><img src="<?php echo powerpress_get_root_url(); ?>images/done_24px.svg" style="margin: 0 0 0 8%;vertical-align: text-bottom;"  alt="<?php echo __('Enabled!', 'powerpress'); ?>" /></span>
                <p id="connected-blubrry-blurb"><?php echo __("Connected to <b>Blubrry</b>", 'powerpress'); ?></p>
            </div>
            <a style="display: block;" class="thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo admin_url(); echo wp_nonce_url( "admin.php?action=powerpress-jquery-account-edit", 'powerpress-jquery-account-edit'); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=true" target="_blank"><?php echo __('Blubrry Hosting Settings', 'powerpress'); ?></a>
        </div>
    <?php
    }
	else // Not signed up for hosting?
	{
?>
        <div id="connect-see-options">
            <img id="blubrry-logo-connect" alt="" src="<?php echo powerpress_get_root_url(); ?>images/blubrry_icon.png">
            <h4><?php echo sprintf(__('<b>PowerPress</b> works best with <b>Blubrry</b>', 'powerpress')); ?></h4>
            <p id="connect-blubrry-blurb"><?php echo sprintf(__('Get access to detailed analytics and more by <b>connecting to your Blubrry Hosting Account.</b>', 'powerpress')); ?></p>
            <p style="font-size: 125%; margin: 1ch 0 0 1ch">
                <strong><a class="button-primary  button-blubrry" id="connect-blubrry-button-options"
                           title="<?php echo esc_attr(__('Blubrry Services Info', 'powerpress')); ?>"
                           href="https://blubrry.com/services/podcast-hosting/"
                           target="_blank"><?php echo __('SEE MY OPTIONS', 'powerpress'); ?></a></strong>
            </p>
        </div>
        <div id="connect-blubrry-button-container">
            <p style="margin-top: 1ch;" class="pp-settings-text-no-margin"><?php echo __('Already have a Blubrry account?', 'powerpress'); ?></p>
            <p style="font-size: 125%; margin-top: 5px;">
                <strong><button class="button-primary  button-blubrry" id="connect-blubrry-button-options"
                           type="submit" name="blubrry-login" value="1"
                           title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>">
                        <?php echo __('LET\'S CONNECT', 'powerpress'); ?></button></strong>

            </p>
            <p style="margin-top: 1ch;" class="pp-settings-text-no-margin"><?php echo __('If you are not Hosting with Blubrry or using Blubrry Statistics, there is no need to connect to Blubrry here.', 'powerpress'); ?></p>
        </div>
<?php
	} // end not signed up for hosting
	
?>

</div>
<?php
    if (time() < strtotime('August 1 2023')) {
        $pp_notif = new PowerPress_Notification_Manager();
        $pp_notif->print_one_notice('more-test', true);
    }
}

function powerpressadmin_edit_media_statistics($General)
{

	if( !isset($General['redirect1']) ) {
        $General['redirect1'] = '';
    } elseif (is_chartable_url($General['redirect1'])) {
        $General['redirect1'] = '';
    }

	if( !isset($General['redirect2']) ) {
        $General['redirect2'] = '';
    } elseif (is_chartable_url($General['redirect2'])) {
        $General['redirect2'] = '';
    }

	if( !isset($General['redirect3']) ) {
        $General['redirect3'] = '';
    } elseif (is_chartable_url($General['redirect3'])) {
        $General['redirect3'] = '';
    }

    $DisableStatsInDashboard = false;
    if( !empty($General['disable_dashboard_stats']) )
        $DisableStatsInDashboard = true;

    $StatsIntegrationURL = '';
	if( !empty($General['blubrry_program_keyword']) )
		$StatsIntegrationURL = 'https://media.blubrry.com/'.$General['blubrry_program_keyword'].'/';
?>
    <script>
        function showSecondRedirectInput(event) {
            event.preventDefault();
            document.getElementById('powerpress_redirect2_table').style.display = 'block';
            document.getElementById('powerpress_redirect2_showlink').style.display='none';

        }
        function showThirdRedirectInput(event) {
            event.preventDefault();
            document.getElementById('powerpress_redirect3_table').style.display='block';
            document.getElementById('powerpress_redirect3_showlink').style.display='none';
        }
    </script>
<div id="blubrry_stats_settings">
<h2><?php echo __('Media Statistics', 'powerpress'); ?></h2>
    <div>
        <input name="DisableStatsInDashboard" class="pp-settings-checkbox" style="margin-top: 1em;" type="checkbox" value="1"<?php if( $DisableStatsInDashboard == true ) echo ' checked'; ?> />
        <div class="pp-settings-subsection" style="border-bottom: none; margin-top: 0;">
            <p class="pp-main"><?php echo __('Remove Statistics from WordPress Dashboard', 'powerpress'); ?></p>
        </div>
    </div>
	<div>
        <h4><?php echo __('STATS PREFIX', 'powerpress'); ?></h4>
        <p class="pp-settings-text-no-margin">
		<?php echo __('Enter your Redirect URL issued by your media statistics service provider below.', 'powerpress'); ?>
		</p>
        <div id="stats-prefix-notice" class="card alert alert-danger p-3">
            <h4 style="margin-bottom: 0.5em;">
                <img src="<?php echo powerpress_get_root_url(); ?>images/circleerror_black.svg" alt="Notice" style="width: 24px; vertical-align: text-bottom;" />
                <p>Notice</p>
            </h4>
            <p><b>Before setting a stats prefix, please carefully read the criteria below.</b></p>
            <ul>
                <li>Not all redirect/prepend prefix services are engineered the same. Once you add a prefix/prepend be aware you are reliant on those companies’ service to “always” be online. A failure on their platform will result in your show’s media not being delivered.
                    <ul>
                        <li style="font-size: 100%;">Service Reliability and LSA: All 3rd party redirect services void the Blubrry Service-Level Agreement (SLA). Please be sure the redirect service you are using has a comparable SLA and uptime guarantee.</li>
                    </ul>
                </li>
                <li>Compatibility: Third party redirect/prepend service must be HTTPS The very beginning of the prefix must have https://, https:// is only at the beginning of the url and shouldn't be anywhere in the middle of the prefix.</li>
                <li>Please review carefully the redirect/prepend companies’ service agreement. Companies may use the collected data for marketing, re-targeting your listener, attribution, or measuring your media to include reporting or selling that data to a third party.</li>
                <li>GDPR/CCPA compliance:  The service must be GDPR/CCPA compliant. We will remove the service if it is not GDPR compliant. Your provider should have public-facing documents to certify GDPR/CCPA compliance.</li>
            </ul>
        </div>

		<div style="position: relative; padding-bottom: 10px;">
			<table class="form-table">
			<tr valign="top">
			<th scope="row">
			<?php echo __('Stats Prefix 1', 'powerpress'); ?>
			</th>
			<td>
			<input type="text" class="pp-settings-text-input" name="<?php if( $StatsIntegrationURL && stripos($General['redirect1'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect1]'; else echo 'General[redirect1]'; ?>" value="<?php echo esc_attr($General['redirect1']); ?>" maxlength="255" <?php if( $StatsIntegrationURL && stripos($General['redirect1'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"';  $StatsIntegrationURL = false; } ?> />
			</td>
			</tr>
			</table>
			<?php if( empty($General['redirect2']) && empty($General['redirect3']) ) { ?>
			<div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect2_showlink">
				<a href="#" style="margin-left: 40px;" onclick="showSecondRedirectInput(event)"><?php echo __('Add Another Prefix', 'powerpress'); ?></a href="#">
			</div>
			<?php } ?>
		</div>
	
		
		<div id="powerpress_redirect2_table" style="position: relative; <?php if( empty($General['redirect2']) && empty($General['redirect3']) ) echo 'display:none;'; ?> padding-bottom: 10px;">
			<table class="form-table">
			<tr valign="top">
			<th scope="row">
			<?php echo __('Stats Prefix 2', 'powerpress'); ?>
			</th>
			<td>
			<input type="text" class="pp-settings-text-input" name="<?php if( $StatsIntegrationURL && stripos($General['redirect2'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect2]'; else echo 'General[redirect2]'; ?>" value="<?php echo esc_attr($General['redirect2']); ?>" maxlength="255" <?php if( $StatsIntegrationURL && stripos($General['redirect2'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"';  $StatsIntegrationURL = false; } ?> />
			</td>
			</tr>
			</table>
			<?php if( $General['redirect3'] == '' ) { ?>
			<div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect3_showlink">
				<a href="#" style="margin-left: 40px;" onclick="showThirdRedirectInput(event)"><?php echo __('Add Another Prefix', 'powerpress'); ?></a>
			</div>
			<?php } ?>
		</div>

		<div id="powerpress_redirect3_table" style="<?php if( empty($General['redirect3']) ) echo 'display:none;'; ?>">
			<table class="form-table">
			<tr valign="top">
			<th scope="row">
			<?php echo __('Stats Prefix 3', 'powerpress'); ?>
			</th>
			<td>
			<input type="text" class="pp-settings-text-input" name="<?php if( $StatsIntegrationURL && stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect3]'; else echo 'General[redirect3]'; ?>" value="<?php echo esc_attr($General['redirect3']); ?>"  maxlength="255" <?php if( $StatsIntegrationURL && stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo ' readOnly="readOnly"'; ?> />
			</td>
			</tr>
			</table>
		</div>
	<style type="text/css">
	#TB_window {
		border: solid 1px #3D517E;
	}
	</style>
	</div>
</div><!-- end blubrry_stats_settings -->
<?php
}

	
function powerpressadmin_appearance($General=false, $Feed = 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;
	if( !isset($General['subscribe_links']) )
		$General['subscribe_links'] = true;
	if( !isset($General['subscribe_label']) )
		$General['subscribe_label'] = '';	
		
		
	/*
	$Players = array('podcast'=>__('Default Podcast (podcast)', 'powerpress') );
	if( isset($General['custom_feeds']) )
	{
		foreach( $General['custom_feeds'] as $podcast_slug => $podcast_title )
		{
			if( $podcast_slug == 'podcast' )
				continue;
			$Players[$podcast_slug] = sprintf('%s (%s)', $podcast_title, $podcast_slug);
		}
	}
	*/
    require_once( dirname(__FILE__).'/views/settings_tab_appearance.php' );
    powerpressadmin_website_settings($General, $Feed);
    powerpressadmin_blog_settings($General, $Feed);
    powerpress_subscribe_settings($General, $Feed);
    powerpress_shortcode_settings($General, $Feed);
    powerpressadmin_new_window_settings($General, $Feed);
?>

<?php  
} // End powerpress_admin_appearance()


// Admin page, footer
function powerpress_settings_tab_footer()
{ ?>
    <div class="pp-settings-footer">
        <?php powerpress_settings_save_button(); ?>
    </div>
    <?php
}
function powerpressadmin_welcome($GeneralSettings, $FeedSettings, $NewPostQueryString = '')
{
    if (isset($_GET['feed_slug'])) {
        $feed_slug = $_GET['feed_slug'];
    } else {
        $feed_slug = 'podcast';
    }
    if (isset($FeedSettings['itunes_image']) && !empty($FeedSettings['itunes_image'])) {
        $image = $FeedSettings['itunes_image'];
    } else {
        $image = powerpress_get_root_url() . 'images/pts_cover.jpg';
    }

    // render program card with deferred stats loading for faster page render
    require_once('powerpressadmin-program-card.class.php');
    $programCard = new PowerPressProgramCard($feed_slug, '', true);
?>
<div>
    <div class="pp-settings-setup-notifications">
        <?php
        $stats_notice_dismissed = get_option('powerpress_stats_notice_dismissed');
        $creds = get_option('powerpress_creds');
        if ( !$creds && !$stats_notice_dismissed) {
            $stats_dismiss_url = admin_url('admin.php?page=powerpressadmin_basic&action=powerpress_dismiss&notice=stats');
            ?>
            <div class="pp-welcome-notification">
                <a href='<?php echo $stats_dismiss_url; ?>'>x</a>
                <img src="<?php echo powerpress_get_root_url(); ?>images/onboarding/blubrry_stats.png" />
                <div class="pp-welcome-notification-text">
                    <h3><?php echo __('Free Podcast Statistics', 'powerpress'); ?></h3>
                    <p>
                        <?php echo __('View a summary of your Blubrry Statistics right here in Powerpress.', 'powerpress'); ?>
                        &nbsp;<a href="https://blubrry.com/support/powerpress-documentation/services-stats/"><?php echo __('Learn More', 'powerpress'); ?></a>
                    </p>
                </div>
            </div>

            <?php
        }
        $artwork_notice_dismissed = get_option('powerpress_artwork_notice_dismissed');
        if( empty($FeedSettings['itunes_image']) && !$artwork_notice_dismissed ) {
            $stats_dismiss_url = admin_url('admin.php?page=powerpressadmin_basic&action=powerpress_dismiss&notice=artwork');
            ?>
            <div class="pp-welcome-notification">
                <a href='<?php echo $stats_dismiss_url; ?>'>x</a>
                <img src="<?php echo powerpress_get_root_url(); ?>images/onboarding/hosting_icon.png" />
                <div class="pp-welcome-notification-text">
                    <h3><?php echo __('Your Show is (almost) ready for everyone', 'powerpress'); ?></h3>
                    <p><?php echo __('Some finishing touched needed to send your RSS feed to destinations.', 'powerpress'); ?></p>
                    <p>
                        <a href="<?php echo admin_url('admin.php?page=powerpressadmin_basic&tab=feeds-tab&sidenav-tab=feeds-artwork-tab'); ?>"><?php echo __('Add Show Artwork', 'powerpress'); ?></a>
                        <a style="margin-left: 1em;" href="<?php echo admin_url('post-new.php'); ?>"><?php echo __('Post your first episode', 'powerpress'); ?></a>
                    </p>
                </div>
            </div>
            <?php
        }
        ?>
    </div>
    <?php
    // render program card
    $programCard->render($NewPostQueryString);
    ?>
	<div class="powerpress-welcome-news">
		<h2><?php echo __('<em>PODCAST INSIDER</em> NEWS &amp; UPDATES', 'powerpress'); ?></h2>
		<?php powerpressadmin_community_news(4, true); ?>
	</div>

	<div class="clear"></div>
</div>
<?php
} // End powerpressadmin_welcome()

function powerpressadmin_edit_funding($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
{
	if( !isset($FeedSettings['donate_link']) )
		$FeedSettings['donate_link'] = 0;
	if( !isset($FeedSettings['donate_url']) )
		$FeedSettings['donate_url'] = '';
	if( !isset($FeedSettings['donate_label']) )
		$FeedSettings['donate_label'] = '';
    ?>
    <h1 class="pp-heading"><?php echo __('Basic Show Information', 'powerpress'); ?></h1>

    <!--
            Location Template Renderer      
    -->
    <div id="location-header" class="pp-settings-section">
        <h2><?php echo __('Location', 'powerpress'); ?></h2>

        <?php
        powerpress_render_template([
            'type' => 'location',
            'context' => 'channel',
            'FeedSlug' => $feed_slug,
            'Data' => $FeedSettings,
            'NamePrefix' => "Feed",
            'hide_section_header' => true,
        ]);
        ?>

    </div>

    <div class="pp-settings-section col-12">
        <h2><?php echo __('Episode Frequency', 'powerpress'); ?></h2>
        <div class="row d-flex flex-row align-items-center justify-content-between">
            <div class="form-group col-lg-5 mb-3">
                <label for="dtstart" class="pp-settings-label">
                    <?php echo __('Start Date', 'powerpress')?>
                </label>
                <input class="pp-settings-text-input" type="date" name="Feed[dtstart]" id="dtstart" value="<?php echo htmlspecialchars($FeedSettings['dtstart'] ?? ''); ?>">
            </div>

            <div class="form-check col-lg-5 mb-3">
                <input type="hidden" name="Feed[is_complete]" value="false">
                <input class="form-check-input" type="checkbox" name="Feed[is_complete]" id="complete" value="true" <?php echo !empty($FeedSettings['is_complete']) && $FeedSettings['is_complete'] === 'true' ? 'checked' : '' ?>>
                <label class="form-check-label" for="complete" style="color: black; font-size: 1rem;">
                    <?php echo __("Mark Show Complete", "powerpress"); ?>
                </label>
            </div>
        </div>

        <div class="row ml-0 mr-0">
            <div class="form-check mr-4">
                <input class="form-check-input" type="radio" name="Feed[update_frequency]" id="daily" value="1" <?php echo !empty($FeedSettings['update_frequency']) && $FeedSettings['update_frequency'] == '1' ? 'checked' : '' ?>>
                <label class="form-check-label" for="daily" style="color: black; font-size: 1rem;">
                    <?php echo __("Daily", "powerpress"); ?>
                </label>
            </div>
            <div class="form-check mr-4">
                <input class="form-check-input" type="radio" name="Feed[update_frequency]" id="weekly" value="2" <?php echo !empty($FeedSettings['update_frequency']) && $FeedSettings['update_frequency'] == '2' ? 'checked' : '' ?>>
                <label class="form-check-label" for="weekly" style="color: black; font-size: 1rem;">
                    <?php echo __("Weekly", "powerpress"); ?>
                </label>
            </div>
            <div class="form-check">
                <input class="form-check-input" type="radio" name="Feed[update_frequency]" id="monthly" value="3" <?php echo !empty($FeedSettings['update_frequency']) && $FeedSettings['update_frequency'] == '3' ? 'checked' : '' ?>>
                <label class="form-check-label" for="monthly" style="color: black; font-size: 1rem;">
                    <?php echo __("Monthly", "powerpress"); ?>
                </label>
            </div>
        </div>
        <div id="weekly-select" class="row ml-0 mr-0" style="display: <?php echo !empty($FeedSettings['update_frequency']) && $FeedSettings['update_frequency'] == '2' ? '' : 'none' ?>;">
            <?php
            $selectedDayList = explode(',', $FeedSettings['update_frequency_week'] ?? '');
            $days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
            $count = 0;
            ?>
            <div class="row ml-0 mr-0" style="margin-top: 20px;">
                <?php
                foreach ($days as $day) {
                    ?>
                    <div class="form-check" style="display: flex; align-items: center; margin-right: 10px;">
                        <input class="form-check-input" type="checkbox" value="<?php echo $count;?>" name="Feed[freq-day-<?php echo $count; ?>]" id="freq-day-<?php echo $count; ?>" <?php echo in_array((string) $count, $selectedDayList) ? 'checked' : ''; ?>>
                        <label class="form-check-label" for="freq-day-<?php echo $count; ?>" style="color: black; font-size: 1rem;">
                            <?php echo __($day, "powerpress"); ?>
                        </label>
                    </div>
                    <?php
                    $count += 1;
                }
                ?>
            </div>
        </div>
        <div id="monthly-frequency" class="row ml-0 mr-0" style="margin-top: 20px; display: <?php echo !empty($FeedSettings['update_frequency']) && $FeedSettings['update_frequency'] == '3' ? '' : 'none' ?>;">
            <label class="mt-2 pp-settings-label" for="update_frequency_month">
                <?php echo __("Monthly Frequency", "powerpress"); ?>
            </label>
            <input class="pp-settings-text-input" required min="1" step="1" value="<?php echo $FeedSettings['update_frequency_month'] ?? '1'; ?>"
                   name="Feed[update_frequency_month]" id="update_frequency_month" type="number" />
        </div>
    </div>

    <div class="pp-settings-section col-12">
        <div class="row d-flex justify-content-start align-items-center">
            <h2>
                <?php echo __('Credits', 'powerpress'); ?>
            </h2>
            <div class="pp-tooltip-right" style="height: 20px; width: 20px; margin: 1ch 0 0 1ch;">i
                <span class="text-pp-tooltip" style="top: -50%; min-width: 200px;"><?php echo esc_html(__('You can document your permanent host, co-host, engineer at the show level, etc. You should not duplicate credits at the episode level.', 'powerpress')); ?></span>
            </div>
        </div>
        <!-- 
        Credit Template Renderer
         -->
        <?php 
            powerpress_render_template([
                'type' => 'credit',
                'context' => 'channel',
                'FeedSlug' => $feed_slug,
                'Data' => $FeedSettings,
                'NamePrefix' => "Feed",
                'hide_section_header' => true,
                'show_inherit_checkbox' => false
            ]);
            ?>
    </div>

    <div class="pp-settings-section col-12">
        <h2>
            <?php echo __("Block", "powerpress"); ?>
        </h2>
        <h3 style="font-weight: bold;">
            <?php echo __("Before you Block", "powerpress"); ?>
        </h3>
        <p>
            <?php echo __("Be aware that blocking signals to specific sites that you do not want your podcast to be found there. However, not all services honor the block and you may have to manually request for your content to be removed from these platforms.", "powerpress"); ?>
        </p>
        <div style="display: flex; align-items: center; margin-top: 20px;">
            <input class="pp-settings-checkbox" style="margin-top: 0; margin-right: 10px;" type="checkbox" value="1" id="block-check" name="Feed[block]" <?php echo isset($FeedSettings["block"]) && intval($FeedSettings["block"]) == 1 ? "checked" : "" ?>>
            <label class="form-check-label" for="block" style="color: black; font-size: 1rem;">
                <?php echo __("I understand what blocking services/directories entails.", "powerpress"); ?>
            </label>
        </div>
        <div id="block-section" class="mt-2" style="display: <?php echo isset($FeedSettings["block"]) && intval($FeedSettings["block"]) == 1 ? "" : "none" ?>;">
            <div style="display: flex; align-items: center; margin-top: 20px;">
                <input class="pp-settings-checkbox" style="margin-top: 0; margin-right: 10px;" type="checkbox" value="1" id="block-all-check" name="Feed[block_all]" <?php echo isset($FeedSettings["block_all"]) && intval($FeedSettings["block_all"]) == 1 ? "checked" : "" ?>>
                <label class="form-check-label" for="block-all-check" style="color: black; font-size: 1rem;">
                    <?php echo __("I would like to block all directories.", "powerpress"); ?>
                </label>
            </div>
            <div class="row" id="block-list" style="margin-top: 20px; display: <?php echo isset($FeedSettings["block_all"]) && intval($FeedSettings["block_all"]) == 1 ? "none" : "" ?>;">
                <?php
                $blockList = getBlockTaxonomy();
                $existingBlockList = explode(';', $FeedSettings['block_list'] ?? '');
                ?>
                <div class="col-md-6">
                    <h4 style="font-weight: bold;">
                        <?php echo __("Directories", "powerpress"); ?>
                    </h4>
                    <input type="text" id="search-directories" class="form-control" onkeyup="searchList('search-directories', 'search-results')" placeholder="Search for names..">
                    <ul id="search-results">
                        <?php foreach ($blockList as $blockDir) {
                            ?>
                            <li style="display: none;" class="search-result" id="li-<?php echo $blockDir; ?>"><a><?php echo $blockDir;?></a></li>
                            <?php
                        } ?>
                    </ul>
                </div>
                <div class="col-md-6">
                    <h4 style="font-weight: bold;">Block List</h4>
                    <div class="col" style="border-radius: 5px; border: 1px solid #E2E2E2;" id="block-list-col">
                        <?php
                        $blockCount = 0;
                        if ($existingBlockList[0] != '') {
                            foreach ($existingBlockList as $blockDir) { ?>
                                <div id="block-<?php echo $blockDir?>">
                                    <div class="row" style="padding-left: 5%; padding-right: 5%; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd;">
                                        <h4 style="margin: 0;">
                                            <?php echo __($blockDir, "powerpress"); ?>
                                        </h4>
                                        <input type="hidden" name="Feed[block_list][]" value="<?php echo $blockDir?>" />
                                        <button type="button" style="border: none; background: inherit; color: red; font-size: 25px; cursor: pointer;" id="remove-block-<?php echo $blockDir; ?>">&times;</button>
                                    </div>
                                </div>
                                <?php
                                $blockCount += 1;
                            }
                        } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
<!--  Donate link and label -->
    <div class="pp-settings-section">
        <h2><?php echo __('Donate Link', 'powerpress'); ?> </h2>
        <label for="donate_link"></label>
        <input class="pp-settings-checkbox" style="margin-top: 2.5ch;" type="checkbox" id="donate_link" name="Feed[donate_link]" value="1" <?php if( $FeedSettings['donate_link'] == 1 ) echo 'checked '; ?>/>
        <div class="pp-settings-subsection">
	        <p class="pp-main"><?php echo __('Syndicate a donate link with your podcast. Create your own crowdfunding page with PayPal donate buttons, or link to a service such as Patreon.', 'powerpress'); ?></p>
        </div>
        <br />
        <!-- 
        Donate Template Renderer
         -->
        <?php 
            powerpress_render_template([
                'type' => 'donate',
                'context' => 'channel',
                'FeedSlug' => $feed_slug,
                'Data' => $FeedSettings,
                'NamePrefix' => "Feed",
                'hide_section_header' => true,
                'show_inherit_checkbox' => false
            ]);
            ?>
	    <p class="pp-settings-text" style="margin-top: 1em;"><a href="https://blubrry.com/support/powerpress-documentation/syndicating-a-donate-link-in-your-podcast/" target="_blank"><?php echo __('Learn more about syndicating donate links for podcasting', 'powerpress'); ?></a></p>
    </div>
    <script defer>

        document.addEventListener('DOMContentLoaded', function() {
            initLocationManager('<?php echo $feed_slug; ?>');
            initCreditsManager( '<?php echo $feed_slug; ?>');
        });

        <?php
        $blockListStr = '[';
        $first = true;
        foreach ($existingBlockList as $block) {
            if (!$first)
                $blockListStr .= ',';

            $blockListStr .= "'$block'";

            $first = false;
        }
        $blockListStr .= ']';
        ?>
        let currentBlockList = <?php echo $blockListStr; ?>;

        function searchList(searchId, resultsId) {
            // Declare variables
            var input, filter, ul, li, a, i, txtValue;
            input = document.getElementById(searchId);
            filter = input.value.toUpperCase();
            ul = document.getElementById(resultsId);
            li = ul.getElementsByTagName('li');

            // Loop through all list items, and hide those who don't match the search query
            for (i = 0; i < li.length; i++) {
                a = li[i].getElementsByTagName("a")[0];
                txtValue = a.textContent || a.innerText;
                if (txtValue.toUpperCase().indexOf(filter) > -1 && filter !== '' && !currentBlockList.includes(txtValue)) {
                    li[i].style.display = "";
                } else {
                    li[i].style.display = "none";
                }
            }
        }

        jQuery(document).ready(function() {
            jQuery('[id*="li-"]').on('click', function() {
                let name = this.id.substring(3);
                let newHTML = '<div id="block-' + name + '">';
                newHTML += '<div class="row" style="padding-left: 5%; padding-right: 5%; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd;">';
                newHTML += '<h4 style="margin: 0;">' + name + '</h4>';
                newHTML += '<input type="hidden" name="Feed[block_list][]" value="' + name + '" />';
                newHTML += '<button type="button" style="border: none; background: inherit; color: red; font-size: 25px; cursor: pointer;" id="remove-block-'+name+'">&times;</button>';
                newHTML += '</div>';
                newHTML += '</div>';

                jQuery('#block-list-col').append(newHTML);

                currentBlockList.push(name);

                let ul = document.getElementById("search-results");
                let li = ul.getElementsByTagName('li');

                // hide search results after adding
                for (let i = 0; i < li.length; i++) {
                    let a = li[i].getElementsByTagName("a")[0];
                    let txtValue = a.textContent || a.innerText;

                    if (txtValue === name)
                        li[i].style.display = "none";
                }
            });

            jQuery(document).on('click',"[id*='remove-block-']", function (e) {
                let name = this.id.substring(13);
                jQuery('#block-' + name).remove();

                let index = currentBlockList.indexOf(name);
                currentBlockList.splice(index, 1);

                let input = document.getElementById('search-directories');
                let filter = input.value.toUpperCase();
                let ul = document.getElementById("search-results");
                let li = ul.getElementsByTagName('li');

                // hide search results after adding
                for (let i = 0; i < li.length; i++) {
                    let a = li[i].getElementsByTagName("a")[0];
                    let txtValue = a.textContent || a.innerText;
                    if (txtValue.toUpperCase().indexOf(filter) > -1 && filter !== '' && txtValue === name) {
                        li[i].style.display = "";
                    }
                }
            });

            jQuery('#block-check').on('change', function () {
                if (this.checked)
                    jQuery('#block-section').show();
                else
                    jQuery('#block-section').hide();
            });

            jQuery('#block-all-check').on('change', function () {
                if (this.checked)
                    jQuery('#block-list').hide();
                else
                    jQuery('#block-list').show();
            });

            jQuery('#daily').on('click', function() {
                jQuery('#weekly-select').hide();
                jQuery('#monthly-frequency').hide();
            });

            jQuery('#weekly').on('click', function() {
                jQuery('#weekly-select').show();
                jQuery('#monthly-frequency').hide();
            });

            jQuery('#monthly').on('click', function() {
                jQuery('#weekly-select').hide();
                jQuery('#monthly-frequency').show();
            });

            jQuery('#update_frequency_month').on('change', function() {
                let value = this.value;

                if (value < 1)
                    this.value = 1;
            });
        });
    </script>
<?php
}

function getBlockTaxonomy() {
    $options = ["acast","amazon","anchor","apple","audible","audioboom","backtracks","bitcoin","blubrry","buzzsprout","captivate","castos","castopod","facebook","fireside","fyyd","google","gpodder","hypercatcher","kasts","libsyn","mastodon","megafono","megaphone","omnystudio","overcast","paypal","pinecast","podbean","podcastaddict","podcastguru","podcastindex","podcasts","podchaser","podcloud","podfriend","podiant","podigee","podnews","podomatic","podserve","podverse","redcircle","relay","resonaterecordings","rss","shoutengine","simplecast","slack","soundcloud","spotify","spreaker","tiktok","transistor","twitter","whooshkaa","youtube","zencast"];
    return $options;
}

function powerpressadmin_edit_tv($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
{
	if( !isset($FeedSettings['parental_rating']) )
		$FeedSettings['parental_rating'] = '';

?>
<h1 class="pp-heading"><?php echo __('Rating Settings', 'powerpress'); ?></h1>
<p class="pp-settings-text"><?php echo sprintf(__('A parental rating is used to display your content on %s applications available on Internet connected TV\'s. The TV Parental Rating applies to both audio and video media.', 'powerpress'), '<strong><a href="http://www.blubrry.com/roku_blubrry/" target="_blank">Blubrry</a></strong>'); ?></p>
<div class="pp-settings-section" style="border-left: none;">
    <h2><?php echo __('Parental Rating', 'powerpress'); ?>  </h2>
	<?php
	$Ratings = array(''=>__('No rating specified', 'powerpress'),
			'TV-Y'=>__('Children of all ages', 'powerpress'),
			'TV-Y7'=>__('Children 7 years and older', 'powerpress'),
			'TV-Y7-FV'=>__('Children 7 years and older [fantasy violence]', 'powerpress'),
			'TV-G'=>__('General audience', 'powerpress'),
			'TV-PG'=>__('Parental guidance suggested', 'powerpress'),
			'TV-14'=>__('May be unsuitable for children under 14 years of age', 'powerpress'),
			'TV-MA'=>__('Mature audience - may be unsuitable for children under 17', 'powerpress')
		);
	$RatingsTips = array(''=>'',
				'TV-Y'=>__('Whether animated or live-action, the themes and elements in this program are specifically designed for a very young audience, including children from ages 2-6. These programs are not expected to frighten younger children.  Examples of programs issued this rating include Sesame Street, Barney & Friends, Dora the Explorer, Go, Diego, Go! and The Backyardigans.', 'powerpress'),
				'TV-Y7'=>__('These shows may or may not be appropriate for some children under the age of 7. This rating may include crude, suggestive humor, mild fantasy violence, or content considered too scary or controversial to be shown to children under seven. Examples include Foster\'s Home for Imaginary Friends, Johnny Test, and SpongeBob SquarePants.', 'powerpress'),
				'TV-Y7-FV'=>__('When a show has noticeably more fantasy violence, it is assigned the TV-Y7-FV rating. Action-adventure shows such Pokemon series and the Power Rangers series are assigned a TV-Y7-FV rating.', 'powerpress'),
				'TV-G'=>__('Although this rating does not signify a program designed specifically for children, most parents may let younger children watch this program unattended. It contains little or no violence, no strong language and little or no sexual dialogue or situation. Networks that air informational, how-to content, or generally inoffensive content.', 'powerpress'),
				'TV-PG'=>__('This rating signifies that the program may be unsuitable for younger children without the guidance of a parent. Many parents may want to watch it with their younger children. Various game shows and most reality shows are rated TV-PG for their suggestive dialog, suggestive humor, and/or coarse language. Some prime-time sitcoms such as Everybody Loves Raymond, Fresh Prince of Bel-Air, The Simpsons, Futurama, and Seinfeld  usually air with a TV-PG rating.', 'powerpress'),
				'TV-14'=>__('Parents are strongly urged to exercise greater care in monitoring this program and are cautioned against letting children of any age watch unattended. This rating may be accompanied by any of the following sub-ratings:', 'powerpress'),
				'TV-MA'=>__('A TV-MA rating means the program may be unsuitable for those below 17. The program may contain extreme graphic violence, strong profanity, overtly sexual dialogue, very coarse language, nudity and/or strong sexual content. The Sopranos is a popular example.', 'powerpress')
		);
			
	
	foreach( $Ratings as $rating => $title )
	{
		$tip = $RatingsTips[ $rating ];
		if (!$rating) {
		    $style = "style=\"margin-bottom:\"";
        }
?>
    <div>
        <input class="pp-settings-radio" type="radio" name="Feed[parental_rating]" value="<?php echo $rating; ?>" <?php if( $FeedSettings['parental_rating'] == $rating) echo 'checked'; ?> />
        <div class="pp-settings-subsection">
            <p class="pp-main">
                <?php if( $rating ) { ?>
                    <strong><?php echo $rating; ?></strong>
                <?php } else { ?>
                    <strong><?php echo htmlspecialchars($title); ?></strong>
                <?php } ?>
            </p>
            <?php if( $rating ) { ?>
                <p class="pp-sub">
                    <?php echo htmlspecialchars($title); ?>
                </p>
            <?php } else { ?>
                <br />
            <?php  } ?>
        </div>
    </div>
	<?php
	}
?>
</div>

<?php
}

function powerpressadmin_edit_artwork($FeedSettings, $General)
{
	$SupportUploads = powerpressadmin_support_uploads();
?>

<h1 class="pp-heading"><?php echo __('Podcast Artwork', 'powerpress'); ?></h1>


<div class="pp-settings-section">
    <h2><?php echo __('Podcast Artwork', 'powerpress'); ?></h2>
    <label for="Feed[itunes_image]" class="pp-settings-label"><?php echo __('Artwork URL', 'powerpress'); ?></label>
    <input class="pp-settings-text-input" type="text" id="itunes_image" name="Feed[itunes_image]" value="<?php echo esc_attr( !empty($FeedSettings['itunes_image'])? $FeedSettings['itunes_image']:''); ?>" maxlength="255" />
    <label for="Feed[itunes_image]" class="pp-settings-label-under"><?php echo __('Apple Podcast image must be at least 1400 x 1400 pixels in .jpg or .png format. Apple Podcast image must not exceed 3000 x 3000 pixels and must use RGB color space. The filesize should not exceed 0.5MB.', 'powerpress'); ?></label>

    <?php if( $SupportUploads ) { ?>
    <input name="itunes_image_checkbox" id="itunes_image_checkbox" type="hidden" value="0" />
    <div id="itunes_image_upload">
        <div>
            <div class="pp-settings-button">
                <label class="pp-settings-button-label" for="itunes_image_file">
                    <img class="pp-settings-icon" src="<?php echo powerpress_get_root_url(); ?>images/cloud_up.svg" alt="">
                    <?php echo __('Upload Image', 'powerpress'); ?>
                </label>
                <input type="file" id="itunes_image_file" name="itunes_image_file" accept="image/*" class="pp_file_upload" style="display: none" />
            </div>
        </div>
    </div>
        <!--<a href="#" onclick="javascript: window.open( document.getElementById('itunes_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>-->
    <script>
        document.getElementById('itunes_image_file').onchange = function (event) {
            document.getElementById('itunes_image').value = this.value.replace("C:\\fakepath\\", "");
            let checkbox_id = "itunes_image_checkbox";
            if (event.currentTarget.value.length > 0) {
                document.getElementById(checkbox_id).value = 1;
            }
        };
        document.getElementById('itunes_image').onchange = function(event) {
            let checkbox_id = "itunes_image_checkbox";
            if (event.currentTarget.value.length > 0) {
                document.getElementById(checkbox_id).value = 1;
            } else {
                document.getElementById(checkbox_id).value = 0;
            }
        };
    </script>
    <?php } ?>
</div>
<?php

}


function powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs)
{
	require_once( dirname(__FILE__).'/views/settings_tab_destinations.php' );
}

