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);
}
Exemplo n.º 2
0
function powerpress_admin_editfeed($type = '', $type_value = '', $feed_slug = false)
{
    $SupportUploads = powerpressadmin_support_uploads();
    $General = powerpress_get_settings('powerpress_general');
    $FeedAttribs = array('type' => $type, 'feed_slug' => '', 'category_id' => 0, 'term_taxonomy_id' => 0, 'term_id' => 0, 'taxonomy_type' => '', 'post_type' => '');
    $cat_ID = false;
    $term_taxonomy_id = false;
    $FeedTitle = __('Feed Settings', 'powerpress');
    switch ($type) {
        case 'channel':
            $feed_slug = $type_value;
            $FeedAttribs['feed_slug'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_feed_' . $feed_slug);
            if (!$FeedSettings) {
                $FeedSettings = array();
                $FeedSettings['title'] = '';
                if (!empty($General['custom_feeds'][$feed_slug])) {
                    $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
                }
            }
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            if (!isset($General['custom_feeds'][$feed_slug])) {
                $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
            }
            $FeedTitle = sprintf('Podcast Settings for Channel: %s', htmlspecialchars($General['custom_feeds'][$feed_slug]));
            echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
            echo '<input type="hidden" name="action" value="powerpress-save-channel" />';
            break;
        case 'category':
            $cat_ID = $type_value;
            $FeedAttribs['category_id'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_cat_feed_' . $cat_ID);
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            $category = get_category_to_edit($cat_ID);
            $FeedTitle = sprintf(__('Podcast Settings for Category: %s', 'powerpress'), htmlspecialchars($category->name));
            echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
            echo '<input type="hidden" name="action" value="powerpress-save-category" />';
            break;
        case 'ttid':
            $term_taxonomy_id = $type_value;
            $FeedAttribs['term_taxonomy_id'] = $type_value;
            $FeedSettings = powerpress_get_settings('powerpress_taxonomy_' . $term_taxonomy_id);
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
            global $wpdb;
            $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM {$wpdb->term_taxonomy} WHERE term_taxonomy_id = {$term_taxonomy_id}", ARRAY_A);
            if (!empty($term_info[0]['term_id'])) {
                $term_ID = $term_info[0]['term_id'];
                $taxonomy_type = $term_info[0]['taxonomy'];
                $FeedAttribs['term_id'] = $term_ID;
                $FeedAttribs['taxonomy_type'] = $taxonomy_type;
                $term_object = get_term_to_edit($term_ID, $taxonomy_type);
                $FeedTitle = sprintf(__('Podcast Settings for Taxonomy Term: %s', 'powerpress'), htmlspecialchars($term_object->name));
            } else {
                $FeedTitle = sprintf(__('Podcast Settings for Taxonomy Term: %s', 'powerpress'), 'Term ID ' . htmlspecialchars($term_taxonomy_id));
            }
            echo sprintf('<input type="hidden" name="ttid" value="%s" />', $term_taxonomy_id);
            echo '<input type="hidden" name="action" value="powerpress-save-ttid" />';
            break;
        case 'post_type':
            $FeedAttribs['post_type'] = $type_value;
            $FeedAttribs['feed_slug'] = $feed_slug;
            $FeedSettingsArray = powerpress_get_settings('powerpress_posttype_' . $FeedAttribs['post_type']);
            if (!is_array($FeedSettingsArray[$feed_slug])) {
                $FeedSettingsArray[$feed_slug] = array();
            }
            $FeedSettings = powerpress_default_settings($FeedSettingsArray[$feed_slug], 'editfeed_custom');
            //$category = get_category_to_edit($cat_ID);
            $PostTypeTitle = $FeedAttribs['post_type'];
            // TODO: Get readable title of post type
            $FeedTitle = sprintf(__('Podcast Settings for Post Type %s with slug %s', 'powerpress'), htmlspecialchars($PostTypeTitle), htmlspecialchars($feed_slug));
            echo sprintf('<input type="hidden" name="podcast_post_type" value="%s" />', $FeedAttribs['post_type']);
            echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
            echo '<input type="hidden" name="action" value="powerpress-save-post_type" />';
            break;
        default:
            $FeedSettings = powerpress_get_settings('powerpress_feed');
            $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
            echo '<input type="hidden" name="action" value="powerpress-save-settings" />';
            break;
    }
    echo '<h2>' . $FeedTitle . '</h2>';
    if ($cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories']))) {
        echo '<input type="hidden" name="from_categories" value="1" />';
    }
    ?>
<div id="powerpress_settings_page" class="powerpress_tabbed_content"> 
  <ul class="powerpress_settings_tabs">
		<li><a href="#feed_tab_feed"><span><?php 
    echo htmlspecialchars(__('Feed Settings', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#feed_tab_itunes"><span><?php 
    echo htmlspecialchars(__('iTunes Settings', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#feed_tab_artwork"><span><?php 
    echo htmlspecialchars(__('Artwork', 'powerpress'));
    ?>
</span></a></li>
	<?php 
    if (in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel'))) {
        ?>
		<li><a href="#feed_tab_appearance"><span><?php 
        echo htmlspecialchars(__('Media Appearance', 'powerpress'));
        ?>
</span></a></li>
	<?php 
    }
    ?>
	<?php 
    if (in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel'))) {
        ?>
		<li><a href="#feed_tab_other"><span><?php 
        echo htmlspecialchars(__('Other Settings', 'powerpress'));
        ?>
</span></a></li> 
	<?php 
    }
    ?>
  </ul>
	
	
	<div id="feed_tab_feed" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
    if (!empty($General['advanced_mode_2'])) {
        powerpressadmin_edit_tv($FeedSettings, $feed_slug);
    }
    ?>
	</div>
	
	<div id="feed_tab_itunes" class="powerpress_tab">
		<?php 
    if ($feed_slug != 'podcast') {
        powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    }
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    ?>
	</div>
	
	<div id="feed_tab_artwork" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_artwork($FeedSettings, $General);
    ?>
	</div>
	
	<?php 
    if ($feed_slug || $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'ttid') {
        ?>
	<div id="feed_tab_appearance" class="powerpress_tab">
		<?php 
        //powerpressadmin_appearance($General);
        if ($feed_slug) {
            powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug, $FeedAttribs);
        }
        powerpress_admin_appearance_common($FeedSettings, $FeedAttribs);
        ?>
	</div>
	
	<div id="feed_tab_other" class="powerpress_tab">
		<?php 
        powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID, $FeedAttribs);
        ?>
	</div>
	<?php 
    }
    ?>
	
</div>
<div class="clear"></div>
<?php 
}