function powerpress_admin_basic()
{
    $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');
    if (!isset($General['advanced_mode_2'])) {
        $General['advanced_mode_2'] = true;
    }
    $FeedSettings = powerpress_get_settings('powerpress_feed');
    $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
    $CustomFeed = get_option('powerpress_feed_' . 'podcast');
    // Get the custom podcast feed settings saved in the database
    if ($CustomFeed) {
        $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;
        }
    }
    ?>
<script type="text/javascript"><!--
function CheckRedirect(obj)
{
	if( obj.value )
	{
		if( obj.value.indexOf('rawvoice') == -1 && obj.value.indexOf('techpodcasts') == -1 && 
			obj.value.indexOf('blubrry') == -1 && obj.value.indexOf('podtrac') == -1 )
		{
			if( !confirm('<?php 
    echo __('The redirect entered is not recongized as a supported statistics redirect service.', 'powerpress');
    ?>
\n\n<?php 
    echo __('Are you sure you wish to continue with this redirect url?', 'powerpress');
    ?>
') )
			{
				obj.value = '';
				return false;
			}
		}
	}
	return true;
}

function SelectEmbedField(checked)
{
	if( checked )
		jQuery('#embed_replace_player').removeAttr("disabled");
	else
		jQuery('#embed_replace_player').attr("disabled","disabled");
}

jQuery(document).ready(function($) {
	
	jQuery('#powerpress_advanced_mode_button').click( function(event) {
		event.preventDefault();
		jQuery('#powerpress_advanced_mode').val('0');
		jQuery(this).closest("form").submit();
	});
	
	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 ) {
			$("#episode_box_order").attr("disabled", true);
		} else {
			$("#episode_box_order").removeAttr("disabled");
		}
	});

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

<input type="hidden" name="action" value="powerpress-save-settings" />


<input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="1" />
<input type="hidden" id="save_tab_pos" name="tab" value="<?php 
    echo empty($_POST['tab']) ? 0 : intval($_POST['tab']);
    ?>
" />

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

<div id="powerpress_settings_page" class="powerpress_tabbed_content"> 
  <ul class="powerpress_settings_tabs">
		<li><a href="#tab0"><span><?php 
    echo htmlspecialchars(__('Welcome', 'powerpress'));
    ?>
</span></a></li> 
		<li><a href="#tab1"><span><?php 
    echo htmlspecialchars(__('Basic Settings', 'powerpress'));
    ?>
</span></a></li> 
		<li><a href="#tab2"><span><?php 
    echo htmlspecialchars(__('Services & Stats', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab3"><span><?php 
    echo htmlspecialchars(__('Media Appearance', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab4"><span><?php 
    echo htmlspecialchars(__('Feeds', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab5"><span><?php 
    echo htmlspecialchars(__('iTunes', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab6"><span><?php 
    echo htmlspecialchars(__('Artwork', 'powerpress'));
    ?>
</span></a></li>
  </ul>
	
	<div id="tab0" class="powerpress_tab">
	<?php 
    powerpressadmin_welcome($General);
    ?>
	</div>
	
  <div id="tab1" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_entry_options($General);
    powerpressadmin_edit_podpress_options($General);
    ?>
	</div>
	
	<div id="tab2" class="powerpress_tab">
		<?php 
    if ($MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION')) {
        PowerPressMultiSitePlugin::edit_blubrry_services($General);
    } else {
        powerpressadmin_edit_blubrry_services($General);
        powerpressadmin_edit_media_statistics($General);
    }
    ?>
	</div>
	
	<div id="tab3" class="powerpress_tab">
		<?php 
    powerpressadmin_appearance($General, $FeedSettings);
    ?>
	</div>
	
	<div id="tab4" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_feed_general($FeedSettings, $General);
    powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_tv($FeedSettings);
    ?>
	</div>
	
	<div id="tab5" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    ?>
	</div>
	
	<div id="tab6" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_artwork($FeedSettings, $General);
    ?>
	</div>
	
</div>
<div class="clear"></div>

<?php 
    powerpressadmin_advanced_options($General);
}
Example #2
0
function powerpress_load_general_feed_settings()
{
    global $wp_query;
    global $powerpress_feed;
    if ($powerpress_feed !== false) {
        $powerpress_feed = false;
        // Get the powerpress settings
        $GeneralSettings = get_option('powerpress_general');
        if (!isset($GeneralSettings['custom_feeds']['podcast'])) {
            $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed';
        }
        // Fixes scenario where the user never configured the custom default podcast feed.
        if ($GeneralSettings) {
            $FeedSettingsBasic = get_option('powerpress_feed');
            // Get overall feed settings
            if (is_feed() && defined('WPCACHEHOME') && empty($GeneralSettings['allow_feed_comments'])) {
                global $wp_super_cache_comments;
                $wp_super_cache_comments = 0;
            }
            if (is_feed() && defined('W3TC') && empty($GeneralSettings['allow_feed_comments'])) {
                add_filter('w3tc_can_print_comment', 'powerpress_w3tc_can_print_comment', 10, 1);
            }
            // If we're in advanced mode and we're dealing with a category feed we're extending, lets work with it...
            if (is_category() && isset($GeneralSettings['custom_cat_feeds']) && is_array($GeneralSettings['custom_cat_feeds']) && in_array(get_query_var('cat'), $GeneralSettings['custom_cat_feeds'])) {
                $cat_ID = get_query_var('cat');
                $FeedCustom = get_option('powerpress_cat_feed_' . $cat_ID);
                // Get custom feed specific settings
                $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
                $powerpress_feed = array();
                $powerpress_feed['is_custom'] = true;
                $powerpress_feed['category'] = $cat_ID;
                $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']);
                // Category feeds could originate from Podpress
                $powerpress_feed['rss_language'] = '';
                // default, let WordPress set the language
                $powerpress_feed['default_url'] = '';
                if (!empty($GeneralSettings['default_url'])) {
                    $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') . '/';
                }
                $explicit_array = array("no", "yes", "clean");
                $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
                if (!empty($Feed['itunes_talent_name'])) {
                    $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
                } else {
                    $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
                }
                $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
                if (!empty($GeneralSettings['seo_itunes'])) {
                    $powerpress_feed['enhance_itunes_summary'] = 1;
                }
                $powerpress_feed['posts_per_rss'] = false;
                if (!empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0) {
                    $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
                }
                $powerpress_feed['feed_redirect_url'] = '';
                if (!empty($Feed['feed_redirect_url'])) {
                    $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
                }
                if ($Feed['itunes_author_post'] == true) {
                    $powerpress_feed['itunes_author_post'] = true;
                }
                if ($Feed['rss_language'] != '') {
                    $powerpress_feed['rss_language'] = $Feed['rss_language'];
                }
                if (!empty($GeneralSettings['podcast_embed_in_feed'])) {
                    $powerpress_feed['podcast_embed_in_feed'] = true;
                }
                if (!empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image'])) {
                    $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
                }
                return;
            } else {
                if ((defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($GeneralSettings['taxonomy_podcasting'])) && (is_tag() || is_tax())) {
                    // We need to get the term_id and the tax_id (tt_id)
                    $term_slug = get_query_var('term');
                    $taxonomy = get_query_var('taxonomy');
                    if (empty($term_slug) && empty($taxonomy)) {
                        $term_slug = get_query_var('tag');
                        if (!empty($term_slug)) {
                            $taxonomy = 'post_tag';
                        }
                    }
                    $term = false;
                    if (!empty($term_slug) && !empty($taxonomy)) {
                        $term = term_exists($term_slug, $taxonomy);
                    }
                    if (!empty($term['term_taxonomy_id'])) {
                        $FeedCustom = get_option('powerpress_taxonomy_' . $term['term_taxonomy_id']);
                        // Get custom feed specific settings
                        if ($FeedCustom) {
                            $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
                            $powerpress_feed = array();
                            $powerpress_feed['is_custom'] = true;
                            $powerpress_feed['term_taxonomy_id'] = $term['term_taxonomy_id'];
                            $powerpress_feed['process_podpress'] = false;
                            // Taxonomy feeds will not originate from Podpress
                            $powerpress_feed['rss_language'] = '';
                            // default, let WordPress set the language
                            $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') . '/';
                            $explicit_array = array("no", "yes", "clean");
                            $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
                            if (!empty($Feed['itunes_talent_name'])) {
                                $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
                            } else {
                                $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
                            }
                            $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
                            if (!empty($GeneralSettings['seo_itunes'])) {
                                $powerpress_feed['enhance_itunes_summary'] = 1;
                            }
                            $powerpress_feed['posts_per_rss'] = false;
                            if (!empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0) {
                                $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
                            }
                            if ($Feed['feed_redirect_url'] != '') {
                                $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
                            }
                            if ($Feed['itunes_author_post'] == true) {
                                $powerpress_feed['itunes_author_post'] = true;
                            }
                            if ($Feed['rss_language'] != '') {
                                $powerpress_feed['rss_language'] = $Feed['rss_language'];
                            }
                            if (!empty($GeneralSettings['podcast_embed_in_feed'])) {
                                $powerpress_feed['podcast_embed_in_feed'] = true;
                            }
                            if (!empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image'])) {
                                $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
                            }
                            return;
                        }
                    }
                }
            }
            $feed_slug = get_query_var('feed');
            // Are we dealing with a custom podcast channel or a custom post type podcast feed...
            if (!empty($GeneralSettings['posttype_podcasting']) || !empty($GeneralSettings['custom_feeds'][$feed_slug])) {
                $Feed = false;
                if (!empty($GeneralSettings['posttype_podcasting'])) {
                    $post_type = get_query_var('post_type');
                    //$post_type = get_post_type();
                    // Get the settings for this podcast post type
                    $PostTypeSettingsArray = get_option('powerpress_posttype_' . $post_type);
                    if (!empty($PostTypeSettingsArray[$feed_slug])) {
                        $FeedCustom = $PostTypeSettingsArray[$feed_slug];
                        $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
                        $Feed['post_type'] = $post_type;
                    }
                }
                if (empty($Feed) && !empty($GeneralSettings['custom_feeds'][$feed_slug])) {
                    $FeedCustom = get_option('powerpress_feed_' . $feed_slug);
                    // Get custom feed specific settings
                    $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic, $feed_slug == 'podcast');
                }
                if ($Feed) {
                    $powerpress_feed = array();
                    $powerpress_feed['is_custom'] = true;
                    $powerpress_feed['feed-slug'] = $feed_slug;
                    if (!empty($Feed['post_type'])) {
                        $powerpress_feed['post_type'] = $Feed['post_type'];
                    }
                    $powerpress_feed['process_podpress'] = $feed_slug == 'podcast' ? !empty($GeneralSettings['process_podpress']) : false;
                    // We don't touch podpress data for custom feeds
                    $powerpress_feed['rss_language'] = '';
                    // RSS language should be set by WordPress by default
                    $powerpress_feed['default_url'] = '';
                    if (!empty($powerpress_feed['default_url'])) {
                        $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') . '/';
                    }
                    $explicit = array("no", "yes", "clean");
                    $powerpress_feed['explicit'] = 'no';
                    if (!empty($Feed['itunes_explicit'])) {
                        $powerpress_feed['explicit'] = $explicit[$Feed['itunes_explicit']];
                    }
                    if (!empty($Feed['itunes_talent_name'])) {
                        $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
                    } else {
                        $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
                    }
                    $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
                    if (!empty($GeneralSettings['seo_itunes'])) {
                        $powerpress_feed['enhance_itunes_summary'] = 1;
                    }
                    $powerpress_feed['posts_per_rss'] = false;
                    if (!empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0) {
                        $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
                    }
                    if (!empty($Feed['feed_redirect_url'])) {
                        $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
                    }
                    if (!empty($Feed['itunes_author_post'])) {
                        $powerpress_feed['itunes_author_post'] = true;
                    }
                    if (!empty($Feed['rss_language'])) {
                        $powerpress_feed['rss_language'] = $Feed['rss_language'];
                    }
                    if (!empty($GeneralSettings['podcast_embed_in_feed'])) {
                        $powerpress_feed['podcast_embed_in_feed'] = true;
                    }
                    if (!empty($Feed['maximize_feed'])) {
                        $powerpress_feed['maximize_feed'] = true;
                    }
                    if (!empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image'])) {
                        $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
                    }
                    return;
                }
            }
            if (!isset($FeedSettingsBasic['apply_to'])) {
                $FeedSettingsBasic['apply_to'] = 1;
            }
            // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
            switch ($FeedSettingsBasic['apply_to']) {
                case 0:
                    if ($feed_slug != 'podcast') {
                        break;
                    }
                    // important: no break here!
                // important: no break here!
                case 2:
                    if ($feed_slug != 'feed' && $feed_slug != 'rss2' && $feed_slug != 'podcast') {
                        break;
                    }
                    // We're only adding podcasts to the rss2 feed in this situation
                    if ($wp_query->is_category) {
                        // don't touch the category feeds...
                        break;
                    }
                    if ($wp_query->is_tag) {
                        // don't touch the tag feeds...
                        break;
                    }
                    if ($wp_query->is_comment_feed) {
                        // don't touch the comments feeds...
                        break;
                    }
                    // important: no break here!
                // important: no break here!
                case 1:
                    $powerpress_feed = array();
                    // Only store what's needed for each feed item
                    $powerpress_feed['is_custom'] = false;
                    // ($feed_slug == 'podcast'?true:false);
                    $powerpress_feed['feed-slug'] = $feed_slug;
                    $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']);
                    // We don't touch podpress data for custom feeds
                    $powerpress_feed['default_url'] = '';
                    if (!empty($GeneralSettings['default_url'])) {
                        $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') . '/';
                    }
                    $explicit = array("no", "yes", "clean");
                    $powerpress_feed['explicit'] = 'no';
                    if (!empty($FeedSettingsBasic['itunes_explicit'])) {
                        $powerpress_feed['explicit'] = $explicit[$FeedSettingsBasic['itunes_explicit']];
                    }
                    if (!empty($FeedSettingsBasic['itunes_talent_name'])) {
                        $powerpress_feed['itunes_talent_name'] = $FeedSettingsBasic['itunes_talent_name'];
                    } else {
                        $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
                    }
                    $powerpress_feed['enhance_itunes_summary'] = 0;
                    if (isset($FeedSettingsBasic['enhance_itunes_summary'])) {
                        $powerpress_feed['enhance_itunes_summary'] = $FeedSettingsBasic['enhance_itunes_summary'];
                    }
                    if (!empty($GeneralSettings['seo_itunes'])) {
                        $powerpress_feed['enhance_itunes_summary'] = 1;
                    }
                    $powerpress_feed['posts_per_rss'] = false;
                    if (!empty($FeedSettingsBasic['posts_per_rss']) && is_numeric($FeedSettingsBasic['posts_per_rss']) && $FeedSettingsBasic['posts_per_rss'] > 0) {
                        $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
                    }
                    if (!empty($FeedSettingsBasic['itunes_author_post'])) {
                        $powerpress_feed['itunes_author_post'] = true;
                    }
                    $powerpress_feed['rss_language'] = '';
                    // Cannot set the language setting in simple mode
                    if (!empty($GeneralSettings['podcast_embed_in_feed'])) {
                        $powerpress_feed['podcast_embed_in_feed'] = true;
                    }
                    if (!empty($FeedSettingsBasic['episode_itunes_image']) && !empty($FeedSettingsBasic['itunes_image'])) {
                        $powerpress_feed['itunes_image'] = $FeedSettingsBasic['itunes_image'];
                    }
                    break;
                    // All other cases we let fall through
            }
        }
    }
}