Example #1
0
    function powerpress_multisite_page()
    {
        global $wpdb, $wp_roles, $current_user, $current_site, $is_subdomain;
        if (isset($_REQUEST['blog_id'])) {
            require_once POWERPRESS_ABSPATH . '/powerpressadmin-basic.php';
            $Settings = get_blog_option($_REQUEST['blog_id'], 'powerpress_general');
            $this->_admin_page_header('powerpress-multisite', 'powerpress-multisite-save-site-settings');
            ?>
<input type="hidden" name="action" value="powerpress-multisite-save-site-settings" />
<input type="hidden" name="blog_id" value="<?php 
            echo $_REQUEST['blog_id'];
            ?>
" />
<div id="powerpress_admin_header">
<h2><?php 
            echo __('Blubrry PowerPress Site Settings', 'powerpress');
            ?>
</h2> 
</div>
<div>
<?php 
            powerpressadmin_edit_blubrry_services($Settings, network_admin_url('sites.php?action=powerpress-multisite&amp;ajax=1&amp;blog_id=' . $_REQUEST['blog_id']), 'powerpress-multisite-ajax-account');
            powerpressadmin_edit_media_statistics($Settings);
            ?>
</div>
<div class="clear"></div>
<?php 
            powerpress_admin_page_footer(true);
        } else {
            $Settings = get_site_option('powerpress_multisite', array('services_multisite_only' => false));
            $this->_admin_page_header('powerpress-multisite', 'powerpress-multisite-save-network-settings');
            ?>
<input type="hidden" name="action" value="powerpress-multisite-save-network-settings" />
<div id="powerpress_admin_header">
<h2><?php 
            echo __('Blubrry PowerPress Network Settings', 'powerpress-multisite');
            ?>
</h2>
</div>
<div>
<?php 
            ?>

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="blogname"><?php 
            echo htmlspecialchars(__('Services & Stats', 'powerpress-multisite'));
            ?>
</label></th>
<td><fieldset><legend class="screen-reader-text"><span><?php 
            echo htmlspecialchars(__('Services & Stats', 'powerpress-multisite'));
            ?>
</span></legend><label for="users_can_register">
<input name="PowerPress[services_multisite_only]" type="checkbox" id="services_multisite_only" value="1" <?php 
            if (!empty($Settings['services_multisite_only'])) {
                echo 'checked';
            }
            ?>
  />
<?php 
            echo htmlspecialchars(__('Managed by Network', 'powerpress-multisite'));
            ?>
</label>
</fieldset>
<p><?php 
            echo __('When checked, only the Network Admin interface can configure services and statistics.', 'powerpress-multisite');
            ?>
</p>
</td>
</tr>

</table>


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


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

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

<?php 
    powerpressadmin_default_steps($FeedSettings, $General, $Step);
    if ($MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION')) {
        PowerPressMultiSitePlugin::edit_blubrry_services($General);
    } else {
        powerpressadmin_edit_blubrry_services($General);
    }
    ?>
<h3><?php 
    echo __('Podcast Settings', 'powerpress');
    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
    echo __('Program Title', 'powerpress');
    ?>
</th>
<td>
<input type="text" name="Feed[title]" style="width: 60%;"  value="<?php 
    echo esc_attr($FeedSettings['title']);
    ?>
" maxlength="255" />
(<?php 
    echo __('leave blank to use blog title', 'powerpress');
    ?>
)
<p><?php 
    echo __('Blog title:', 'powerpress') . ' ' . get_bloginfo_rss('name');
    ?>
</p>
</td>
</tr>
</table>
<?php 
    if ($Step > 1) {
        // Only display if we have episdoes in the feed!
        powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    }
    // iTunes settings (in simple mode of course)
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_artwork($FeedSettings, $General);
    powerpressadmin_appearance($General, $FeedSettings);
    powerpressadmin_advanced_options($General);
}