check_admin_referer(); if (!current_user_can('manage_categories')) { die(__('Cheatin’ uh?')); } $cat_ID = (int) $_GET['cat_ID']; $cat_name = get_catname($cat_ID); if (1 == $cat_ID) { die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name)); } wp_delete_category($cat_ID); header('Location: categories.php?message=2'); break; case 'edit': require_once 'admin-header.php'; $cat_ID = (int) $_GET['cat_ID']; $category = get_category_to_edit($cat_ID); ?> <div class="wrap"> <h2><?php _e('Edit Category'); ?> </h2> <form name="editcat" action="categories.php" method="post"> <table class="editform" width="100%" cellspacing="2" cellpadding="5"> <tr> <th width="33%" scope="row"><?php _e('Category name:'); ?> </th> <td width="67%"><input name="cat_name" type="text" value="<?php
/** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $category * @param unknown_type $level * @param unknown_type $name_override * @return unknown */ function _cat_row( $category, $level, $name_override = false ) { static $row_class = ''; $category = get_category( $category, OBJECT, 'display' ); $default_cat_id = (int) get_option( 'default_category' ); $pad = str_repeat( '— ', $level ); $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); $edit_link = "categories.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />'; $actions = array(); $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; if ( $default_cat_id != $category->term_id ) $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $action_count = count($actions); $i = 0; $edit .= '<div class="row-actions">'; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $edit .= "<span class='$action'>$link$sep</span>"; } $edit .= '</div>'; } else { $edit = $name; } $row_class = 'alternate' == $row_class ? '' : 'alternate'; $qe_data = get_category_to_edit($category->term_id); $category->count = number_format_i18n( $category->count ); $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count; $output = "<tr id='cat-$category->term_id' class='iedit $row_class'>"; $columns = get_column_headers('categories'); $hidden = get_hidden_columns('categories'); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': $output .= "<th scope='row' class='check-column'>"; if ( $default_cat_id != $category->term_id ) { $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />"; } else { $output .= " "; } $output .= '</th>'; break; case 'name': $output .= "<td $attributes>$edit"; $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; $output .= '<div class="name">' . $qe_data->name . '</div>'; $output .= '<div class="slug">' . $qe_data->slug . '</div>'; $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>'; break; case 'description': $output .= "<td $attributes>$category->description</td>"; break; case 'slug': $output .= "<td $attributes>$category->slug</td>"; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; $output .= "<td $attributes>$posts_count</td>\n"; } } $output .= '</tr>'; return $output; }
function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs = array()) { $feed_slug = $FeedAttribs['feed_slug']; $cat_ID = $FeedAttribs['category_id']; $SupportUploads = powerpressadmin_support_uploads(); if (!isset($FeedSettings['itunes_subtitle'])) { $FeedSettings['itunes_subtitle'] = ''; } if (!isset($FeedSettings['itunes_summary'])) { $FeedSettings['itunes_summary'] = ''; } if (!isset($FeedSettings['itunes_keywords'])) { $FeedSettings['itunes_keywords'] = ''; } if (!isset($FeedSettings['itunes_cat_1'])) { $FeedSettings['itunes_cat_1'] = ''; } if (!isset($FeedSettings['itunes_cat_2'])) { $FeedSettings['itunes_cat_2'] = ''; } if (!isset($FeedSettings['itunes_cat_3'])) { $FeedSettings['itunes_cat_3'] = ''; } if (!isset($FeedSettings['itunes_explicit'])) { $FeedSettings['itunes_explicit'] = 0; } if (!isset($FeedSettings['itunes_talent_name'])) { $FeedSettings['itunes_talent_name'] = ''; } if (!isset($FeedSettings['email'])) { $FeedSettings['email'] = ''; } if (!isset($FeedSettings['itunes_new_feed_url_podcast'])) { $FeedSettings['itunes_new_feed_url_podcast'] = ''; } if (!isset($FeedSettings['itunes_new_feed_url'])) { $FeedSettings['itunes_new_feed_url'] = ''; } $AdvancediTunesSettings = !empty($FeedSettings['itunes_summary']); if (!empty($FeedSettings['itunes_subtitle'])) { $AdvancediTunesSettings = true; } ?> <h3><?php echo __('iTunes Settings', 'powerpress'); ?> </h3> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Program Subtitle', 'powerpress'); ?> <br /> </th> <td> <input type="text" name="Feed[itunes_subtitle]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_subtitle']); ?> " maxlength="250" /> </td> </tr> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Program Summary', 'powerpress'); ?> </th> <td> <p style="margin-top: 5px;"><?php echo __('Your summary may not contain HTML and cannot exceed 4,000 characters in length.', 'powerpress'); ?> </p> <textarea name="Feed[itunes_summary]" rows="5" style="width:80%;" ><?php echo $FeedSettings['itunes_summary']; ?> </textarea> </td> </tr> <?php if (!empty($General['advanced_mode_2'])) { ?> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Episode Summary', 'powerpress'); ?> </th> <td> <div><input type="checkbox" name="Feed[enhance_itunes_summary]" value="1" <?php echo !empty($FeedSettings['enhance_itunes_summary']) ? 'checked ' : ''; ?> /> <?php echo __('Optimize iTunes Summary from Blog Posts', 'powerpress'); ?> </div> <p> <?php echo __('Creates a friendlier view of your post/episode content by converting web links and images to clickable links in the iTunes application.', 'powerpress'); ?> </p> </td> </tr> </table> <table class="form-table"> <?php if (!empty($FeedSettings['itunes_keywords'])) { ?> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Program Keywords', 'powerpress'); ?> <br /> </th> <td> <input type="text" name="Feed[itunes_keywords]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_keywords']); ?> " maxlength="250" /> <p><?php echo __('Feature Deprecated by Apple. Keywords above are for your reference only.', 'powerpress'); ?> </p> </td> </tr> <?php } // End iTunes keywords } // end advanced mode ?> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Category', 'powerpress'); ?> <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?> </span> </th> <td> <select name="Feed[itunes_cat_1]" class="bpp_input_med"> <?php $MoreCategories = false; if (!empty($FeedSettings['itunes_cat_2'])) { $MoreCategories = true; } else { if (!empty($FeedSettings['itunes_cat_3'])) { $MoreCategories = true; } } $Categories = powerpress_itunes_categories(true); echo '<option value="">' . __('Select Category', 'powerpress') . '</option>'; $UseCategories = powerpress_categories_strict($Categories, $FeedSettings['itunes_cat_1']); while (list($value, $desc) = each($UseCategories)) { echo "\t<option value=\"{$value}\"" . ($FeedSettings['itunes_cat_1'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } reset($Categories); ?> </select> <?php if (!$MoreCategories && empty($General['seo_itunes'])) { ?> <a href="#" onclick="document.getElementById('more_itunes_cats').style.display='block';return false;"><?php echo __('more', 'powerpress'); ?> </a> <?php } ?> <p> <?php echo __('The category above is where you will appear when browsing iTunes.', 'powerpress'); ?> </p> </td> </tr> </table> <!-- start advanced features --> <div id="more_itunes_cats" style="display: <?php echo $MoreCategories || !empty($General['seo_itunes']) ? 'block' : 'none'; ?> ;"> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Category 2', 'powerpress'); ?> </th> <td> <select name="Feed[itunes_cat_2]" class="bpp_input_med"> <?php echo '<option value="">' . __('Select Category', 'powerpress') . '</option>'; $UseCategories = powerpress_categories_strict($Categories, $FeedSettings['itunes_cat_2']); while (list($value, $desc) = each($UseCategories)) { echo "\t<option value=\"{$value}\"" . ($FeedSettings['itunes_cat_2'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } reset($Categories); ?> </select> <?php if (!empty($General['seo_itunes'])) { ?> <p> <em><?php echo __('SEO Suggestion: Select a second category.', 'powerpress'); ?> </em> </p> <?php } ?> </td> </tr> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Category 3', 'powerpress'); ?> </th> <td> <select name="Feed[itunes_cat_3]" class="bpp_input_med"> <?php echo '<option value="">' . __('Select Category', 'powerpress') . '</option>'; $UseCategories = powerpress_categories_strict($Categories, $FeedSettings['itunes_cat_3']); while (list($value, $desc) = each($UseCategories)) { echo "\t<option value=\"{$value}\"" . ($FeedSettings['itunes_cat_3'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n"; } reset($Categories); ?> </select> <?php if (!empty($General['seo_itunes'])) { ?> <p> <em><?php echo __('SEO Suggestion: Select a third category.', 'powerpress'); ?> </em> </p> <?php } ?> </td> </tr> </table> </div> <!-- end advanced features --> <table class="form-table"> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Explicit', 'powerpress'); ?> </th> <td> <select name="Feed[itunes_explicit]" class="bpp_input_med"> <?php $explicit = array(0 => __('No - display nothing', 'powerpress'), 1 => __('Yes - explicit content', 'powerpress'), 2 => __('Clean - no explicit content', 'powerpress')); while (list($value, $desc) = each($explicit)) { echo "\t<option value=\"{$value}\"" . ($FeedSettings['itunes_explicit'] == $value ? ' selected' : '') . ">{$desc}</option>\n"; } ?> </select> </td> </tr> <?php if (!empty($General['advanced_mode_2'])) { ?> <!-- start advanced features --> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Author Name', 'powerpress'); ?> </th> <td> <input type="text" name="Feed[itunes_talent_name]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['itunes_talent_name']); ?> " maxlength="250" /><br /> <div><input type="checkbox" name="Feed[itunes_author_post]" value="1" <?php echo !empty($FeedSettings['itunes_author_post']) ? 'checked ' : ''; ?> /> <?php echo __('Use blog post author\'s name for individual episodes.', 'powerpress'); ?> </div> <?php if (!empty($General['seo_itunes'])) { ?> <p> <em><?php echo __('SEO Suggestion: Include talent names and slogans not mentioned in the show title.', 'powerpress'); ?> </em> </p> <?php } ?> </td> </tr> <!-- end advanced features --> <?php } ?> <tr valign="top"> <th scope="row"> <?php echo __('iTunes Email', 'powerpress'); ?> <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?> </span> </th> <td> <input type="text" name="Feed[email]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['email']); ?> " maxlength="250" /> <div>(<?php echo __('iTunes will email this address when your podcast is accepted into the iTunes Directory.', 'powerpress'); ?> )</div> </td> </tr> </table> <?php if (!empty($General['advanced_mode_2'])) { ?> <!-- start advanced features --> <table class="form-table"> <tr valign="top"> <th scope="row" > <?php echo __('iTunes New Feed URL', 'powerpress'); ?> </th> <td> <div id="new_feed_url_step_1" style="display: <?php echo !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ? 'none' : 'block'; ?> ;"> <p style="margin-top: 5px;"><strong><a href="#" onclick="return powerpress_new_feed_url_prompt();"><?php echo __('Set iTunes New Feed URL', 'powerpress'); ?> </a></strong></p> <p><strong> <?php echo __('The iTunes New Feed URL option works primarily for Apple\'s iTunes application only, and should only be used if you are unable to implement a HTTP 301 redirect.', 'powerpress'); ?> <?php echo __('A 301 redirect will route <u>all podcast clients including iTunes</u> to your new feed address.', 'powerpress'); ?> </strong> </p> <p> <?php echo __('Learn more:', 'powerpress'); ?> <a href="http://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php echo __('Changing Your Podcast RSS Feed Address (URL)', 'powerpress'); ?> </a> </p> </div> <div id="new_feed_url_step_2" style="display: <?php echo !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ? 'block' : 'none'; ?> ;"> <p style="margin-top: 5px;"><strong><?php echo __('WARNING: Changes made here are permanent. If the New Feed URL entered is incorrect, you will lose subscribers and will no longer be able to update your listing in the iTunes Store.', 'powerpress'); ?> </strong></p> <p><strong><?php echo __('DO NOT MODIFY THIS SETTING UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING.', 'powerpress'); ?> </strong></p> <p> <?php echo htmlspecialchars(sprintf(__('Apple recommends you maintain the %s tag in your feed for at least two weeks to ensure that most subscribers will receive the new New Feed URL.', 'powerpress'), '<itunes:new-feed-url>')); ?> </p> <p> <?php $FeedName = __('Main RSS2 feed', 'powerpress'); $FeedURL = get_feed_link('rss2'); if ($cat_ID) { $category = get_category_to_edit($cat_ID); $FeedName = sprintf(__('%s category feed', 'powerpress'), htmlspecialchars($category->name)); $FeedURL = get_category_feed_link($cat_ID); } else { if ($feed_slug) { if (!empty($General['custom_feeds'][$feed_slug])) { $FeedName = $General['custom_feeds'][$feed_slug]; } else { $FeedName = __('Podcast', 'powerpress'); } $FeedName = trim($FeedName) . ' ' . __('feed', 'powerpress'); $FeedURL = get_feed_link($feed_slug); } else { if ($FeedAttribs['type'] == 'ttid') { $term_object = get_term_to_edit($FeedAttribs['term_id'], $FeedAttribs['taxonomy_type']); $FeedName = sprintf(__('%s taxonomy term feed', 'powerpress'), htmlspecialchars($term_object->name)); $FeedURL = get_term_feed_link($FeedAttribs['term_id'], $FeedAttribs['taxonomy_type'], 'rss2'); } } } echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL); ?> </p> <p style="margin-bottom: 0;"> <label style="width: 25%; float:left; display:block; font-weight: bold;"><?php echo __('New Feed URL', 'powerpress'); ?> </label> <input type="text" name="Feed[itunes_new_feed_url]" style="width: 55%;" value="<?php echo esc_attr($FeedSettings['itunes_new_feed_url']); ?> " maxlength="250" /> </p> <p style="margin-left: 25%;margin-top: 0;font-size: 90%;">(<?php echo __('Leave blank for no New Feed URL', 'powerpress'); ?> )</p> <p><a href="http://www.apple.com/itunes/whatson/podcasts/specs.html#changing" target="_blank"><?php echo __('More information regarding the iTunes New Feed URL is available here.', 'powerpress'); ?> </a></p> <p> <?php if (!$cat_ID && !$feed_slug) { if (empty($General['channels'])) { echo sprintf(__('Please activate the \'Custom Podcast Channels\' Advanced Option to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast')); } else { echo sprintf(__('Please navigate to the \'Custom Podcast Channels\' section to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast')); } } ?> </p> </div> </td> </tr> </table> <?php if (defined('POWERPRESS_NOT_SUPPORTED')) { // start powerpress not supported features ?> <fieldset style="border: 1px dashed #333333;"> <legend style="margin: 0 20px; padding: 0 5px; font-weight: bold;"><?php echo __('Features Not Supported by PowerPress', 'powerpress'); ?> </legend> <div style="margin-left: 230px; margin-bottom: 10px;"> <p> <strong style="color: #CC0000; font-weight: bold;"><?php echo __('USE THE FOLLOWING SETTINGS AT YOUR OWN RISK.', 'powerpress'); ?> </strong> </p> <p style="margin-bottom: 0;"> <?php echo __('Feeds affected', 'powerpress'); ?> : </p> <div style="margin-left: 20px;"> <?php // $General, $feed_slug=false, $cat_ID=false if ($feed_slug) { echo '<a href="'; echo get_feed_link($feed_slug); echo '" target="_blank">'; echo get_feed_link($feed_slug); echo '</a>'; } else { if ($cat_ID) { echo '<a href="'; echo get_category_feed_link($cat_ID); echo '" target="_blank">'; echo get_category_feed_link($cat_ID); echo '</a>'; } else { echo '<a href="'; echo get_feed_link('feed'); echo '" target="_blank">'; echo get_feed_link('feed'); echo '</a>'; if (empty($General['custom_feeds']['podcast'])) { echo '<br /><a href="'; echo get_feed_link('podcast'); echo '" target="_blank">'; echo get_feed_link('podcast'); echo '</a>'; } } } ?> </div> </div> <div id="permanent_itunes_settings"> <table class="form-table"> <tr valign="top"> <th scope="row" > <?php echo __('iTunes Block', 'powerpress'); ?> </th> <td> <input type="checkbox" name="Feed[itunes_block]" value="1" <?php if (!empty($FeedSettings['itunes_block'])) { echo 'checked'; } ?> /> <?php echo __('Prevent the entire podcast from appearing in the iTunes Podcast directory.', 'powerpress'); ?> </td> </tr> <tr valign="top"> <th scope="row" > <?php echo __('iTunes Complete', 'powerpress'); ?> </th> <td> <input type="checkbox" name="Feed[itunes_complete]" value="1" <?php if (!empty($FeedSettings['itunes_complete'])) { echo 'checked'; } ?> /> <?php echo __('Indicate the completion of a podcast. iTunes will no longer update your listing in the iTunes Podcast directory.', 'powerpress'); ?> </td> </tr> </table> </div> </fieldset> <?php } // End PowerPress not supported features ?> <!-- end advanced features --> <?php } // end other advanced options }
function powerpress_admin_categoryfeeds() { $General = powerpress_get_settings('powerpress_general'); ?> <h2><?php echo __('Category Podcasting', 'powerpress'); ?> </h2> <p> <?php echo __('Category Podcasting adds custom podcast settings to specific blog category feeds, allowing you to organize episodes by topic.', 'powerpress'); ?> </p> <p> <?php echo sprintf(__('If you are looking to organize episodes by file or format, please use %s.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') . '" title="' . __('Custom Podcast Channels') . '">' . __('Custom Podcast Channels') . '</a>'); ?> </p><style type="text/css"> .column-url { width: 40%; } .column-name { width: 30%; } .column-feed-slug { width: 15%; } .column-episode-count { width: 15%; } .category-list { width: 100%; } </style> <div id="col-container"> <div id="col-right"> <table class="widefat fixed" cellspacing="0"> <thead> <tr> <?php print_column_headers('powerpressadmin_categoryfeeds'); ?> </tr> </thead> <tfoot> <tr> <?php print_column_headers('powerpressadmin_categoryfeeds', false); ?> </tr> </tfoot> <tbody> <?php $Feeds = array(); if (isset($General['custom_cat_feeds'])) { $Feeds = $General['custom_cat_feeds']; } $count = 0; while (list($null, $cat_ID) = each($Feeds)) { if (empty($cat_ID)) { continue; } $category = get_category_to_edit($cat_ID); if (is_wp_error($category)) { // $cat_ID does not existing continue; } //var_dump($category); $columns = powerpress_admin_customfeeds_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_categoryfeeds.php&action=powerpress-editcategoryfeed&cat=') . $cat_ID; $feed_title = $category->name; $url = get_category_feed_link($cat_ID); $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}\""; //$short_url = ''; switch ($column_name) { case 'feed-slug': echo "<td {$class}>{$category->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)) . '">' . esc_html($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_categoryfeeds.php&action=powerpress-delete-category-feed&cat={$cat_ID}", 'powerpress-delete-category-feed-' . $cat_ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for category feed '%s'\n 'Cancel' to stop, 'OK' to delete.", 'powerpress'), esc_html($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">'; if (defined('POWERPRESS_FEEDVALIDATOR_URL')) { echo '<span class="' . $action . '"><a href="' . POWERPRESS_FEEDVALIDATOR_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; 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 Podcast Settings to existing Category Feed', 'powerpress'); ?> </h3> <input type="hidden" name="action" value="powerpress-addcategoryfeed" /> <input type="hidden" name="taxonomy" value="category" /> <?php //wp_original_referer_field(true, 'previous'); wp_nonce_field('powerpress-add-taxonomy-feed'); ?> <div class="form-field form-required"> <label for="feed_name"><?php echo __('Category', 'powerpress'); ?> </label> <?php wp_dropdown_categories(array('class' => 'category-list', 'show_option_none' => __('Select Category', 'powerpress'), 'orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 1, 'name' => 'term', 'id' => 'term_id')); ?> </div> <p class="submit"><input type="submit" class="button" name="submit" value="<?php echo __('Add Podcast Settings to Category Feed', 'powerpress'); ?> " /></p> </div> </div> </div> <!-- col-left --> </div> <!-- col-container --> <h3><?php echo __('Example Usage', 'powerpress'); ?> </h3> <p> <?php echo __('Example 1: You have a podcast that covers two topics that sometimes share same posts and sometimes do not. Use your main podcast feed as a combined feed of both topics and use category feeds to distribute topic specific episodes.', 'powerpress'); ?> </p> <p> <?php echo __('Example 2: You want to use categories to keep episodes separate from each other. Each category can be used to distribute separate podcasts with the main podcast feed combining all categories to provide a network feed.', 'powerpress'); ?> </p> <?php }
/** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $category * @param unknown_type $level * @param unknown_type $name_override * @return unknown */ function _cat_row($category, $level, $name_override = false) { static $row_class = ''; $category = get_category($category, OBJECT, 'display'); $default_cat_id = (int) get_option('default_category'); $pad = str_repeat('— ', max(0, $level)); $name = $name_override ? $name_override : $pad . ' ' . $category->name; $edit_link = "categories.php?action=edit&cat_ID={$category->term_id}"; if (current_user_can('manage_categories')) { $edit = "<a class='row-title' href='{$edit_link}' title='" . esc_attr(sprintf(__('Edit “%s”'), $category->name)) . "'>" . esc_attr($name) . '</a><br />'; $actions = array(); $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; if ($default_cat_id != $category->term_id) { $actions['delete'] = "<a class='delete:the-list:cat-{$category->term_id} submitdelete' href='" . wp_nonce_url("categories.php?action=delete&cat_ID={$category->term_id}", 'delete-category_' . $category->term_id) . "'>" . __('Delete') . "</a>"; } $actions = apply_filters('cat_row_actions', $actions, $category); $action_count = count($actions); $i = 0; $edit .= '<div class="row-actions">'; foreach ($actions as $action => $link) { ++$i; $i == $action_count ? $sep = '' : ($sep = ' | '); $edit .= "<span class='{$action}'>{$link}{$sep}</span>"; } $edit .= '</div>'; } else { $edit = $name; } $row_class = 'alternate' == $row_class ? '' : 'alternate'; $qe_data = get_category_to_edit($category->term_id); $category->count = number_format_i18n($category->count); $posts_count = $category->count > 0 ? "<a href='edit.php?cat={$category->term_id}'>{$category->count}</a>" : $category->count; $output = "<tr id='cat-{$category->term_id}' class='iedit {$row_class}'>"; $columns = get_column_headers('categories'); $hidden = get_hidden_columns('categories'); foreach ($columns as $column_name => $column_display_name) { $class = "class=\"{$column_name} column-{$column_name}\""; $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } $attributes = "{$class}{$style}"; switch ($column_name) { case 'cb': $output .= "<th scope='row' class='check-column'>"; if ($default_cat_id != $category->term_id) { $output .= "<input type='checkbox' name='delete[]' value='{$category->term_id}' />"; } else { $output .= " "; } $output .= '</th>'; break; case 'name': $output .= "<td {$attributes}>{$edit}"; $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; $output .= '<div class="name">' . $qe_data->name . '</div>'; $output .= '<div class="slug">' . $qe_data->slug . '</div>'; $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>'; break; case 'description': $output .= "<td {$attributes}>{$category->description}</td>"; break; case 'slug': $output .= "<td {$attributes}>{$category->slug}</td>"; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; $output .= "<td {$attributes}>{$posts_count}</td>\n"; break; default: $output .= "<td {$attributes}>"; $output .= apply_filters('manage_categories_custom_column', '', $column_name, $category->term_id); $output .= "</td>"; } } $output .= '</tr>'; return $output; }
/** * Display the icons panel in Icons tab * @author Brahim MACHKOURI */ function bm_caticons_adminicons() { // I took some of the code from categories.php of WordPress 2.5 and modified it a little global $wpdb; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if (isset($_GET['deleteit']) && isset($_GET['delete'])) { $action = 'bulk-delete'; } switch ($action) { case 'update-category-icon': $cat_ID = (int) $_GET['cat_ID']; $priority = $_REQUEST['ig_priority']; $icon = $_REQUEST['ig_icon']; $small_icon = $_REQUEST['ig_small_icon']; if ($wpdb->get_var($wpdb->prepare("SELECT cat_id FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'"))) { $wpdb->query($wpdb->prepare("UPDATE {$wpdb->ig_caticons} SET priority='{$priority}', icon='{$icon}', small_icon='{$small_icon}' WHERE cat_id='{$cat_ID}'")); } else { $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->ig_caticons} (cat_id, priority, icon, small_icon) VALUES ('{$cat_ID}', '{$priority}', '{$icon}', '{$small_icon}')")); } break; case 'delete': $cat_ID = (int) $_GET['cat_ID']; if (!is_admin() || !current_user_can('manage_categories')) { wp_die(__('Are you trying to cheat ?', 'category_icons')); } $cat_name = get_catname($cat_ID); $request = "DELETE FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'"; if (false === $wpdb->query($wpdb->prepare($request))) { wp_die(__('Error in Category Icons', 'category_icons') . ' : ' . $request); } break; case 'bulk-delete': if (!is_admin() || !current_user_can('manage_categories')) { wp_die(__('You are not allowed to delete category icons.', 'category_icons')); } foreach ((array) $_GET['delete'] as $cat_ID) { $cat_name = get_catname($cat_ID); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'")); } break; } switch ($action) { case 'edit': $cat_ID = (int) $_GET['cat_ID']; $category = get_category_to_edit($cat_ID); list($priority, $icon, $small_icon) = bm_caticons_get_icons($cat_ID); ?> <div class="wrap"> <h2><?php _e('Select Category Icons', 'category_icons'); ?> </h2> <form method="post" name="caticons-form1" action=""> <?php wp_nonce_field('caticons-nonce'); ?> <input type="hidden" name="ig_module" value="caticons" /> <input type="hidden" name="ig_tab" value="icons" /> <input type="hidden" name="action" value="update-category-icon" /> <table border="0" class="form-table"> <tr> <th scope="row" style="vertical-align:text-top;"><?php _e('Category ID', 'category_icons'); ?> </th> <td colspan="2" ><?php echo $cat_ID; ?> </td> </tr> <tr> <th scope="row" style="vertical-align:text-top;"><?php _e('Name', 'category_icons'); ?> </th> <td colspan="2"><?php echo $category->name; ?> </td> </tr> <tr> <th scope="row" class="num" style="vertical-align:text-top;"><?php _e('Priority', 'category_icons'); ?> </th> <td colspan="2"> <input type="text" name="ig_priority" size="5" value="<?php echo $priority; ?> " /> </td> </tr> <tr> <th scope="row" style="vertical-align:text-top;"><?php _e('Icon', 'category_icons'); ?> </th> <td valign="top"><label><?php _e('Select a file : ', 'category_icons'); ?> </label> <select name="ig_icon" onchange="icon_preview.src=('<?php echo ig_caticons_url(); ?> /'+this.options[this.selectedIndex].value);"> <option value="">--- <?php _e('No Icon', 'category_icons'); ?> ---</option> <?php bm_caticons_get_icons_paths($icon); ?> </select><br/> <label><?php _e('Or enter an URL : ', 'category_icons'); ?> <input type="text" name="bm_icon_url"/></label> </td> <td valign="top"><img id="icon_preview" src="<?php echo ig_caticons_url() . "/{$icon}"; ?> " alt="icon" /></td> </tr> <tr> <th scope="row" style="vertical-align:text-top;"><?php _e('Small Icon', 'category_icons'); ?> </th> <td valign="top"><label><?php _e('Select a file : ', 'category_icons'); ?> </label> <select name="ig_small_icon" onchange="small_icon_preview.src=('<?php echo ig_caticons_url(); ?> /'+this.options[this.selectedIndex].value);"> <option value="">--- <?php _e('No Icon', 'category_icons'); ?> ---</option> <?php bm_caticons_get_icons_paths($small_icon); ?> </select><br/> <label><?php _e('Or enter an URL : ', 'category_icons'); ?> <input type="text" name="bm_smallicon_url"/></label> </td> <td valign="top"><img id="small_icon_preview" src="<?php echo ig_caticons_url() . "/{$small_icon}"; ?> " alt="small icon" /></td> </tr> </table> <div class="submit"><input type="submit" name="info_update" value="<?php _e('Select Icons', 'category_icons'); ?> »" /></div> </form> </div> <?php break; default: ?> <div class="wrap"> <form id="posts-filter" action="" method="get" name="caticons-form2"> <?php wp_nonce_field('caticons-nonce'); ?> <input type="hidden" name="ig_module" value="caticons" /> <input type="hidden" name="page" value="category_icons.php" /> <input type="hidden" name="action" value="delete" /> <input type="hidden" name="ig_tab" value="icons" /> <div class="tablenav"> <div class="alignleft"> <input type="submit" value="<?php _e('Delete icons and priority', 'category_icons'); ?> " name="deleteit" class="button-secondary delete" /> </div> <br class="clear" /> </div> <br class="clear" /> <table class="widefat" id="caticons_table"> <thead> <tr> <th scope="col" id="cb" class="check-column"><input type="checkbox" /></th> <th scope="col"><?php _e('ID', 'category_icons'); ?> </th> <th scope="col" ><?php _e('Name', 'category_icons'); ?> </th> <th scope="col" style="text-align:center"><?php _e('Description', 'category_icons'); ?> </th> <th scope="col" class="num" style="text-align:center"><?php _e('Posts', 'category_icons'); ?> </th> <th scope="col" style="text-align:center"><?php _e('Priority', 'category_icons'); ?> </th> <th scope="col" style="text-align:center"><?php _e('Icon', 'category_icons'); ?> </th> <th scope="col" style="text-align:center"><?php _e('Small Icon', 'category_icons'); ?> </th> </tr> </thead> <tbody id="the-list" class="list:cat"> <?php bm_caticons_rows(); ?> </tbody> </table> </form> <div class="tablenav"> <br class="clear" /> </div> <br class="clear" /> </div> <?php } // end switch }