function powerpress_admin_posttypefeeds() { $General = powerpress_get_settings('powerpress_general'); $post_types = powerpress_admin_get_post_types(false); ?> <h2><?php echo __('Post Type Podcasting', 'powerpress'); ?> </h2> <p> <?php echo __('Post Type Podcasting adds custom podcast settings to specific Post Type feeds.', 'powerpress'); ?> </p> <style type="text/css"> .column-url { width: 40%; } .column-name { width: 30%; } .column-feed-slug { width: 15%; } .column-post-type { width: 15%; } .column-episode-count { width: 15%; } .category-list { width: 100%; } .form-field select { width: 95%; } </style> <div id="col-container"> <div id="col-right"> <table class="widefat fixed" cellspacing="0"> <thead> <tr> <?php print_column_headers('powerpressadmin_posttypefeeds'); ?> </tr> </thead> <tfoot> <tr> <?php print_column_headers('powerpressadmin_posttypefeeds', false); ?> </tr> </tfoot> <tbody> <?php $count = 0; while (list($null, $post_type) = each($post_types)) { $PostTypeSettingsArray = get_option('powerpress_posttype_' . $post_type); if (!$PostTypeSettingsArray) { continue; } while (list($feed_slug, $PostTypeSettings) = each($PostTypeSettingsArray)) { $feed_title = !empty($PostTypeSettings['title']) ? $PostTypeSettings['title'] : '(blank)'; // $post_type // $feed_slug //global $wpdb; // var_dump($term_info); //$category = get_category_to_edit($cat_ID); $columns = powerpress_admin_posttypefeeds_columns(); $hidden = array(); if ($count % 2 == 0) { echo '<tr valign="middle" class="alternate">'; } else { echo '<tr valign="middle">'; } $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_posttypefeeds.php&action=powerpress-editposttypefeed&feed_slug=' . $feed_slug . '&podcast_post_type=' . $post_type); $url = get_post_type_archive_feed_link($post_type, $feed_slug); $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if (strlen($short_url) > 35) { $short_url = substr($short_url, 0, 32) . '...'; } foreach ($columns as $column_name => $column_display_name) { $class = "class=\"column-{$column_name}\""; switch ($column_name) { case 'feed-slug': echo "<td {$class}>{$feed_slug}"; echo "</td>"; break; case 'name': echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . $feed_title . '</a></strong><br />'; $actions = array(); $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>'; $actions['remove'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_posttypefeeds.php&action=powerpress-delete-posttype-feed&podcast_post_type={$post_type}&feed_slug={$feed_slug}", 'powerpress-delete-posttype-feed-' . $post_type . '_' . $feed_slug) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for Post Type '%s'\n 'Cancel' to stop, 'OK' to delete.", 'powerpress'), $feed_title)) . "') ) { return true;}return false;\">" . __('Remove', 'powerpress') . "</a>"; $action_count = count($actions); $i = 0; echo '<div class="row-actions">'; foreach ($actions as $action => $linkaction) { ++$i; $i == $action_count ? $sep = '' : ($sep = ' | '); echo '<span class="' . $action . '">' . $linkaction . $sep . '</span>'; } echo '</div>'; echo '</td>'; break; case 'url': echo "<td {$class}><a href='{$url}' title='" . esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title)) . "' target=\"_blank\">{$short_url}</a>"; echo '<div class="row-actions">'; echo '<span class="' . $action . '"><a href="http://www.feedvalidator.org/check.cgi?url=' . urlencode(str_replace('&', '&', $url)) . '" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>'; echo '</div>'; echo "</td>"; break; case 'episode-count': echo "<td {$class}>{$episode_total}"; echo "</td>"; break; case 'post-type': echo "<td {$class}>{$post_type}"; echo "</td>"; break; default: break; } } echo "\n </tr>\n"; $count++; } } ?> </tbody> </table> </div> <!-- col-right --> <div id="col-left"> <div class="col-wrap"> <div class="form-wrap"> <h3><?php echo __('Add Podcasting to a custom Post Type', 'powerpress'); ?> </h3> <input type="hidden" name="action" value="powerpress-addposttypefeed" /> <div class="form-field form-required"> <label for="powerpress_post_type_select"><?php echo __('Post Type', 'powerpress'); ?> </label> <select id="powerpress_post_type_select" name="podcast_post_type" style="width: 95%;"> <option value=""><?php echo __('Select Post Type', 'powerpress'); ?> </option> <?php reset($post_types); while (list($null, $post_type) = each($post_types)) { if ($post_type == 'post') { continue; } $post_type = htmlspecialchars($post_type); echo "\t<option value=\"{$post_type}\">{$post_type}</option>\n"; } ?> </select> </div> <div class="form-field form-required"> <label for="feed_title"><?php echo __('Feed Title', 'powerpress'); ?> </label> <input name="feed_title" id="feed_title" type="text" value="" size="100" /> </div> <div class="form-field"> <label for="feed_slug"><?php echo __('Feed Slug', 'powerpress'); ?> </label> <input name="feed_slug" id="feed_slug" type="text" value="" size="40" /> <p><?php echo __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'powerpress'); ?> </p> </div> <?php wp_nonce_field('powerpress-add-posttype-feed'); ?> <p class="submit"><input type="submit" class="button" name="add_podcasting" value="<?php echo __('Add Podcasting to Post Type', 'powerpress'); ?> " /> </p> </div> </div> </div> <!-- col-left --> </div> <!-- col-container --> <?php }
function powerpress_admin_menu() { $Powerpress = get_option('powerpress_general'); if (defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION')) { // CRAP } else { if (empty($Powerpress['use_caps']) || current_user_can('edit_podcast')) { // Otherwise we're using a version of wordpress that is not supported. require_once POWERPRESS_ABSPATH . '/powerpressadmin-metabox.php'; $FeedSlugPostTypesArray = array(); if (!empty($Powerpress['posttype_podcasting'])) { $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting'); if (empty($FeedSlugPostTypesArray)) { $FeedSlugPostTypesArray = array(); } } if (!defined('POWERPRESS_POST_TYPES')) { $page_types = array('page'); // Only apply to default pages if (empty($Powerpress['posttype_podcasting'])) { $page_types = powerpress_admin_get_post_types('page'); } // Get pages by capability type while (list($null, $page_type) = each($page_types)) { if (empty($FeedSlugPostTypesArray['podcast'][$page_type])) { add_meta_box('powerpress-podcast', __('Podcast Episode', 'powerpress'), 'powerpress_meta_box', $page_type, 'normal'); } } $post_types = array('post'); // Only apply to default posts if (empty($Powerpress['posttype_podcasting'])) { $post_types = powerpress_admin_get_post_types('post'); } // Get pages by capability type } else { $post_type_string = str_replace(' ', '', POWERPRESS_POST_TYPES); // Get all the spaces out $post_types = explode(',', $post_type_string); } if (!empty($Powerpress['posttype_podcasting'])) { add_meta_box('powerpress-podcast', __('Podcast Episode (default)', 'powerpress'), 'powerpress_meta_box', 'post', 'normal'); // Default podcast box for post type 'post' $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting'); if (empty($FeedSlugPostTypesArray)) { $FeedSlugPostTypesArray = array(); } while (list($feed_slug, $FeedSlugPostTypes) = each($FeedSlugPostTypesArray)) { while (list($post_type, $type_title) = each($FeedSlugPostTypes)) { if ($feed_slug != 'podcast' || $post_type != 'post') { $feed_title = $type_title; if (empty($feed_title)) { $feed_title = $feed_slug; } //echo (" $feed_slug "); add_meta_box('powerpress-' . $feed_slug, __('Podcast Episode', 'powerpress') . ': ' . $feed_title, 'powerpress_meta_box', $post_type, 'normal'); } } } } if (isset($Powerpress['custom_feeds'])) { $FeedDefaultPodcast = get_option('powerpress_feed_podcast'); while (list($null, $post_type) = each($post_types)) { // Make sure this post type can edit the default podcast channel... if (!empty($FeedDefaultPodcast['custom_post_type']) && $FeedDefaultPodcast['custom_post_type'] != $post_type) { continue; } if (empty($FeedSlugPostTypesArray['podcast'][$post_type])) { add_meta_box('powerpress-podcast', __('Podcast Episode (default)', 'powerpress'), 'powerpress_meta_box', $post_type, 'normal'); } } while (list($feed_slug, $feed_title) = each($Powerpress['custom_feeds'])) { if ($feed_slug == 'podcast') { continue; } $FeedCustom = get_option('powerpress_feed_' . $feed_slug); $feed_slug = esc_attr($feed_slug); reset($post_types); while (list($null, $post_type) = each($post_types)) { // Make sure this post type can edit the default podcast channel... if (!empty($FeedCustom['custom_post_type']) && $FeedCustom['custom_post_type'] != $post_type) { continue; } if (empty($FeedSlugPostTypesArray[$feed_slug][$post_type])) { add_meta_box('powerpress-' . $feed_slug, __('Podcast Episode for Custom Channel', 'powerpress') . ': ' . esc_attr($feed_title), 'powerpress_meta_box', $post_type, 'normal'); } } } reset($Powerpress['custom_feeds']); } else { reset($post_types); while (list($null, $post_type) = each($post_types)) { if (empty($FeedSlugPostTypesArray['podcast'][$post_type])) { add_meta_box('powerpress-podcast', __('Podcast Episode', 'powerpress'), 'powerpress_meta_box', $post_type, 'normal'); } } } // For custom compatibility type set: if (isset($Powerpress['custom_feeds']) && defined('POWERPRESS_CUSTOM_CAPABILITY_TYPE')) { $post_types = powerpress_admin_get_post_types(POWERPRESS_CUSTOM_CAPABILITY_TYPE); if (!empty($post_types)) { while (list($feed_slug, $feed_title) = each($Powerpress['custom_feeds'])) { if ($feed_slug == 'podcast') { continue; } $FeedCustom = get_option('powerpress_feed_' . $feed_slug); reset($post_types); while (list($null, $post_type) = each($post_types)) { if (!empty($FeedCustom['custom_post_type']) && $FeedCustom['custom_post_type'] != $post_type) { continue; } if (empty($FeedSlugPostTypesArray[$feed_slug][$post_type])) { add_meta_box('powerpress-' . $feed_slug, __('Podcast Episode for Custom Channel', 'powerpress') . ': ' . $feed_title, 'powerpress_meta_box', $post_type, 'normal'); } } } reset($Powerpress['custom_feeds']); } } } } if (current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS)) { $Powerpress = powerpress_default_settings($Powerpress, 'basic'); if (isset($_GET['page']) && strstr($_GET['page'], 'powerpress') !== false && isset($_POST['General'])) { $ToBeSaved = $_POST['General']; if (isset($ToBeSaved['channels'])) { $Powerpress['channels'] = $ToBeSaved['channels']; } if (isset($ToBeSaved['cat_casting'])) { $Powerpress['cat_casting'] = $ToBeSaved['cat_casting']; } if (isset($ToBeSaved['taxonomy_podcasting'])) { $Powerpress['taxonomy_podcasting'] = $ToBeSaved['taxonomy_podcasting']; } if (isset($ToBeSaved['posttype_podcasting'])) { $Powerpress['posttype_podcasting'] = $ToBeSaved['posttype_podcasting']; } if (isset($ToBeSaved['podpress_stats'])) { $Powerpress['podpress_stats'] = $ToBeSaved['podpress_stats']; } if (isset($ToBeSaved['blubrry_hosting'])) { $Powerpress['blubrry_hosting'] = $ToBeSaved['blubrry_hosting']; } } add_menu_page(__('PowerPress', 'powerpress'), __('PowerPress', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic', powerpress_get_root_url() . 'powerpress_ico.png'); add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Settings', 'powerpress'), __('Settings', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic'); add_options_page(__('PowerPress', 'powerpress'), __('PowerPress', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic'); add_submenu_page('powerpress/powerpressadmin_basic.php', __('Migrate to Blubrry Podcast Media Hosting', 'powerpress'), __('Migrate Media', 'powerpress') . ' ' . powerpressadmin_new('font-weight: bold; color: #ffffff;'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_migrate.php', 'powerpress_admin_page_migrate'); add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Podcasting SEO', 'powerpress'), '<span style="color:#f18500">' . __('Podcasting SEO', 'powerpress') . '</span> ' . powerpressadmin_new('font-weight: bold; color: #ffffff;') . '', POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_search.php', 'powerpress_admin_page_search'); add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Audio Player Options', 'powerpress'), __('Audio Player', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_player.php', 'powerpress_admin_page_players'); add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Video Player Options', 'powerpress'), __('Video Player', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_videoplayer.php', 'powerpress_admin_page_videoplayers'); // Coming soon, maybe PP 6.1 //add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Mobile Player Options', 'powerpress'), __('Mobile Player', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_mobileplayer.php', 'powerpress_admin_page_mobileplayers'); if (!empty($Powerpress['channels'])) { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Channels', 'powerpress'), __('Podcast Channels', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds'); } if (!empty($Powerpress['cat_casting'])) { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcasting', 'powerpress'), __('Category Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds'); } if (defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($Powerpress['taxonomy_podcasting'])) { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Taxonomy Podcasting', 'powerpress'), __('Taxonomy Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_taxonomyfeeds.php', 'powerpress_admin_page_taxonomyfeeds'); } if (defined('POWERPRESS_POSTTYPE_PODCASTING') || !empty($Powerpress['posttype_podcasting'])) { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Post Type Podcasting', 'powerpress'), __('Post Type Podcasting', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_posttypefeeds.php', 'powerpress_admin_page_posttypefeeds'); } if (!empty($Powerpress['podpress_stats'])) { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PodPress Stats', 'powerpress'), __('PodPress Stats', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_podpress-stats.php', 'powerpress_admin_page_podpress_stats'); } if (!empty($Powerpress['blubrry_hosting']) && $Powerpress['blubrry_hosting'] !== 'false') { add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress MP3 Tags', 'powerpress'), __('MP3 Tags', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_tags.php', 'powerpress_admin_page_tags'); } add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Tools', 'powerpress'), __('Tools', 'powerpress'), POWERPRESS_CAPABILITY_EDIT_PAGES, 'powerpress/powerpressadmin_tools.php', 'powerpress_admin_page_tools'); } }
function powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $cat_ID = false, $FeedAttribs = array()) { if (!isset($FeedSettings['redirect'])) { $FeedSettings['redirect'] = ''; } if (!isset($FeedSettings['premium_label'])) { $FeedSettings['premium_label'] = ''; } if (!empty($FeedAttribs['type']) && ($FeedAttribs['type'] == 'ttid' || $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'channel' && defined('CHANNEL_STATS_REDIRECT') || $FeedAttribs['type'] == 'post_type' && defined('POST_TYPE_STATS_REDIRECT'))) { ?> <h3><?php echo __('Media Statistics', 'powerpress'); ?> </h3> <p> <?php echo __('Enter your Redirect URL issued by your media statistics service provider below.', 'powerpress'); ?> </p> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('Redirect URL', 'powerpress'); ?> </th> <td> <input type="text" style="width: 60%;" name="Feed[redirect]" value="<?php echo esc_attr($FeedSettings['redirect']); ?> " maxlength="250" /> <?php if ($FeedAttribs['type'] == 'category') { ?> <p class="description"><?php echo __('Note: Category Media Redirect URL is applied to category feeds and pages only. The redirect will also apply to single pages if this is the only category associated with the blog post.', 'powerpress'); ?> </p> <?php } else { if ($FeedAttribs['type'] == 'ttid') { ?> <p class="description"><?php echo __('Note: Media Redirect URL is applied to this podcast feed only. The redirect will NOT apply to pages.', 'powerpress'); ?> </p> <?php } else { if ($FeedAttribs['type'] == 'channel') { ?> <p class="description"><?php echo __('When specified, this will be the only media statistics redirect applied to this podcast channel.', 'powerpress'); ?> </p> <?php } else { if ($FeedAttribs['type'] == 'post_type') { ?> <p class="description"><?php echo __('When specified, this will be the only media statistics redirect applied to this podcast post type.', 'powerpress'); ?> </p> <?php } } } } ?> </td> </tr> </table> <?php } if ($feed_slug) { ?> <h3><?php echo __('Episode Entry Box', 'powerpress'); ?> </h3> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('Background Color', 'powerpress'); ?> </th> <td> <input type="text" id="episode_background_color" name="EpisodeBoxBGColor[<?php echo $feed_slug; ?> ]" style="width: 100px; float:left; border: 1px solid #333333; <?php if (!empty($General['episode_box_background_color'][$feed_slug])) { echo 'background-color: ' . $General['episode_box_background_color'][$feed_slug]; } ?> ;" value="<?php if (!empty($General['episode_box_background_color'][$feed_slug])) { echo esc_attr($General['episode_box_background_color'][$feed_slug]); } ?> " maxlength="10" onblur="jQuery('#episode_background_color').css({'background-color' : this.value });" /> <div style="background-color: #FFDFEF;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#FFDFEF'; jQuery('#episode_background_color').css({'background-color' :'#FFDFEF' });"></div> <div style="background-color: #FBECD8;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#FBECD8'; jQuery('#episode_background_color').css({'background-color' :'#FBECD8' });"></div> <div style="background-color: #FFFFCC;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#FFFFCC'; jQuery('#episode_background_color').css({'background-color' :'#FFFFCC' });"></div> <div style="background-color: #DFFFDF;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#DFFFDF'; jQuery('#episode_background_color').css({'background-color' :'#DFFFDF' });"></div> <div style="background-color: #EBFFFF;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#EBFFFF'; jQuery('#episode_background_color').css({'background-color' :'#EBFFFF' });"></div> <div style="background-color: #D9E0EF;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#D9E0EF'; jQuery('#episode_background_color').css({'background-color' :'#D9E0EF' });"></div> <div style="background-color: #EBE0EB;" class="powerpress_color_box" onclick="document.getElementById('episode_background_color').value='#EBE0EB'; jQuery('#episode_background_color').css({'background-color' :'#EBE0EB' });"></div> (<?php echo __('leave blank for default', 'powerpress'); ?> ) <p class="clear"><?php echo __('Use a distinctive background color for this podcast channel\'s episode box.', 'powerpress'); ?> </p> </td> </tr> </table> <!-- password protected feed option --> <?php if (@$General['premium_caps'] && $feed_slug && $feed_slug != 'podcast') { ?> <h3><?php echo __('Password Protect Podcast Channel', 'powerpress'); ?> </h3> <p> <?php echo __('Require visitors to have membership to your blog in order to gain access to this channel\'s Premium Content.', 'powerpress'); ?> </p> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('Protect Content', 'powerpress'); ?> </th> <td> <p style="margin-top: 5px;"><input type="checkbox" name="ProtectContent" value="1" <?php echo !empty($FeedSettings['premium']) ? 'checked ' : ''; ?> onchange="powerpress_toggle_premium_content(this.checked);" /> <?php echo __('Require user to be signed-in to access feed.', 'powerpress'); ?> </p> <?php ?> <div style="margin-left: 20px; display: <?php echo !empty($FeedSettings['premium']) ? 'block' : 'none'; ?> ;" id="premium_role"><?php echo __('User must have the following capability', 'powerpress'); ?> : <select name="Feed[premium]" class="bpp_input_med"> <?php $caps = powerpress_admin_capabilities(); $actual_premium_value = 'premium_content'; if (!empty($FeedSettings['premium'])) { $actual_premium_value = $FeedSettings['premium']; } echo '<option value="">' . __('None', 'powerpress') . '</option>'; while (list($value, $desc) = each($caps)) { echo "\t<option value=\"{$value}\"" . ($actual_premium_value == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } ?> </select></div> </td> </tr> </table> <div id="protected_content_message" style="display: <?php echo !empty($FeedSettings['premium']) ? 'block' : 'none'; ?> ;"> <script language="Javascript" type="text/javascript"><!-- function powerpress_toggle_premium_content(enabled) { jQuery('#premium_role').css('display', (enabled?'block':'none') ); jQuery('#protected_content_message').css('display', (enabled?'block':'none') ); } function powerpress_premium_label_append_signin_link() { jQuery('#premium_label').val( jQuery('#premium_label').val() + '<a href="<?php echo get_option('siteurl'); ?> /wp-login.php" title="<?php echo __('Sign In', 'powerpress'); ?> "><?php echo __('Sign In', 'powerpress'); ?> <\/a>'); } function powerpress_default_premium_label(event) { if( confirm('<?php echo __('Use default label, are you sure?', 'powerpress'); ?> ') ) { jQuery('#premium_label_custom').css('display', (this.checked==false?'block':'none') ); jQuery('#premium_label').val(''); } else { return false; } return true; } //--> </script> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('Unauthorized Label', 'powerpress'); ?> </th> <td> <p style="margin-top: 5px;"><input type="radio" name="PremiumLabel" value="0" <?php echo $FeedSettings['premium_label'] == '' ? 'checked ' : ''; ?> onclick="return powerpress_default_premium_label(this)" /> <?php echo __('Use default label', 'powerpress'); ?> : </p> <p style="margin-left: 20px;"> <?php echo $FeedSettings['title']; ?> : <a href="<?php echo get_option('siteurl'); ?> /wp-login.php" target="_blank" title="Protected Content">(<?php echo __('Protected Content', 'powerpress'); ?> )</a> </p> <p style="margin-top: 5px;"><input type="radio" name="PremiumLabel" id="premium_label_1" value="1" <?php echo $FeedSettings['premium_label'] != '' ? 'checked ' : ''; ?> onchange="jQuery('#premium_label_custom').css('display', (this.checked?'block':'none') );" /> <?php echo __('Use a custom label', 'powerpress'); ?> : </p> <div id="premium_label_custom" style="margin-left: 20px; display: <?php echo $FeedSettings['premium_label'] != '' ? 'block' : 'none'; ?> ;"> <textarea name="Feed[premium_label]" id="premium_label" style="width: 80%; height: 65px; margin-bottom: 0; padding-bottom: 0;"><?php echo htmlspecialchars($FeedSettings['premium_label']); ?> </textarea> <div style="width: 80%; font-size: 85%; text-align: right;"> <a href="#" onclick="powerpress_premium_label_append_signin_link();return false;"><?php echo __('Add sign in link to message', 'powerpress'); ?> </a> </div> <p style="width: 80%;"> <?php echo __('Label above appears in place of the in-page player and links when the current signed-in user does not have access to the protected content.', 'powerpress'); ?> </p> </div> </td> </tr> </table> </div> <?php } else { if (!empty($General['premium_caps']) && $feed_slug) { ?> <h3><?php echo __('Password Protect Podcast Channel', 'powerpress'); ?> </h3> <p> <?php echo __('This feature is not available for the default podcast channel.', 'powerpress'); ?> </p> <?php } } // Podcast Channels and Custom Post Types... if ($FeedAttribs['type'] == 'channel') { ?> <h3><?php echo __('Custom Post Types', 'powerpress'); ?> </h3> <p> <?php echo __('Set whether all post types or a specific custom post type may use this podcast channel. Custom post type must be of type \'Posts\'. Other post types such as \'Pages\' or \'Categories\' do not apply.', 'powerpress'); ?> </p> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('Custom Post Type', 'powerpress'); ?> </th> <td> <?php ?> <select name="Feed[custom_post_type]" class="bpp_input_med"> <?php $post_types = powerpress_admin_get_post_types('post'); $custom_post_type = ''; if (!empty($FeedSettings['custom_post_type'])) { $custom_post_type = $FeedSettings['custom_post_type']; } echo '<option value="">' . __('All Post Types (default)', 'powerpress') . '</option>'; while (list($index, $value) = each($post_types)) { $desc = $value; // TODO: See if we can get a post type label somehow $postTypeObj = get_post_type_object($value); if (!empty($postTypeObj->labels->name)) { $desc = $postTypeObj->labels->name . ' (' . $value . ')'; } echo "\t<option value=\"{$value}\"" . ($custom_post_type == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } if (defined('POWERPRESS_CUSTOM_CAPABILITY_TYPE')) { $post_types = powerpress_admin_get_post_types(POWERPRESS_CUSTOM_CAPABILITY_TYPE); if (!empty($post_types)) { while (list($index, $value) = each($post_types)) { $desc = $value; // TODO: See if we can get a post type label somehow $postTypeObj = get_post_type_object($value); if (!empty($postTypeObj->labels->name)) { $desc = $postTypeObj->labels->name . ' (' . $value . ')'; } echo "\t<option value=\"{$value}\"" . ($custom_post_type == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } } } ?> </select> <p> <?php echo __('Use the default setting if you do not understand custom post types.', 'powerpress'); ?> </p> </td> </tr> </table> <?php } } // else if channel }
function form($instance) { if (empty($instance['title'])) { $instance['title'] = __('Subscribe to Podcast', 'powerpress'); } if (empty($instance['subscribe_type'])) { $instance['subscribe_type'] = ''; } if (empty($instance['subscribe_post_type'])) { $instance['subscribe_post_type'] = ''; } if (empty($instance['subscribe_feed_slug'])) { $instance['subscribe_feed_slug'] = ''; } if (empty($instance['subscribe_category_id'])) { $instance['subscribe_category_id'] = ''; } $GeneralSettings = get_option('powerpress_general'); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Title:', 'powerpress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($instance['title']); ?> " /> </p> <p class="pp-sub-widget-p-subscribe_type"> <label for="<?php echo $this->get_field_id('subscribe_type'); ?> "><?php _e('Select Podcast Type:', 'powerpress'); ?> </label> <select class="widefat powerpress-subscribe-type" onchange="javascript: powerpress_subscribe_widget_change(this)" id="<?php echo $this->get_field_id('subscribe_type'); ?> " name="<?php echo $this->get_field_name('subscribe_type'); ?> "> <?php $types = array('' => __('Default Podcast', 'powerpress'), 'channel' => __('Podcast Channel', 'powerpress')); //, 'ttid'=>__('Taxonomy Podcasting','powerpress')); if (!empty($GeneralSettings['cat_casting']) || $instance['subscribe_type'] == 'category') { // If category podcasting enabled $types['category'] = __('Category Podcasting', 'powerpress'); } if (!empty($GeneralSettings['posttype_podcasting']) || $instance['subscribe_type'] == 'post_type') { // If post type podcasting enabled $types['post_type'] = __('Post Type Podcasting', 'powerpress'); } while (list($type, $label) = each($types)) { echo '<option value="' . $type . '"' . selected($instance['subscribe_type'], $type, false) . '>' . $label . "</option>\n"; } ?> </select> </p> <?php // If Post type podcasting enabled... if (!empty($GeneralSettings['posttype_podcasting']) || $instance['subscribe_type'] == 'post_type') { ?> <p id="<?php echo $this->get_field_id('subscribe_post_type_section'); ?> " class="pp-sub-widget-p-post_type"<?php if ($instance['subscribe_type'] != 'post_type') { echo " style=\"display: none;\""; } ?> > <label for="<?php echo $this->get_field_id('subscribe_post_type'); ?> "><?php _e('Select Post Type:', 'powerpress'); ?> </label> <select class="widefat" id="<?php echo $this->get_field_id('subscribe_post_type'); ?> " name="<?php echo $this->get_field_name('subscribe_post_type'); ?> "> <option value=""><?php echo __('Select Post Type', 'powerpress'); ?> </option> <?php $post_types = powerpress_admin_get_post_types(false); while (list($index, $label) = each($post_types)) { echo '<option value="' . $label . '"' . selected($instance['subscribe_post_type'], $label, false) . '>' . $label . "</option>\n"; } ?> </select> </p> <?php } ?> <p id="<?php echo $this->get_field_id('subscribe_feed_slug_section'); ?> " class="pp-sub-widget-p-channel"<?php if ($instance['subscribe_type'] != 'post_type' && $instance['subscribe_type'] != 'channel') { echo " style=\"display: none;\""; } ?> > <label for="<?php echo $this->get_field_id('subscribe_feed_slug'); ?> "><?php esc_html_e('Feed Slug:', 'powerpress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('subscribe_feed_slug'); ?> " name="<?php echo $this->get_field_name('subscribe_feed_slug'); ?> " type="text" value="<?php echo esc_attr($instance['subscribe_feed_slug']); ?> " /> </p> <?php // If category podcasting... if (!empty($GeneralSettings['cat_casting']) || $instance['subscribe_type'] == 'category') { ?> <p id="<?php echo $this->get_field_id('subscribe_category_id_section'); ?> " class="pp-sub-widget-p-category"<?php if ($instance['subscribe_type'] != 'category') { echo " style=\"display: none;\""; } ?> > <label for="<?php echo $this->get_field_id('subscribe_category_id'); ?> "><?php esc_html_e('Category ID:', 'powerpress'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('subscribe_category_id'); ?> " name="<?php echo $this->get_field_name('subscribe_category_id'); ?> " type="text" value="<?php echo esc_attr($instance['subscribe_category_id']); ?> " /> </p> <?php } }