} } /* FeedWordPressCompatibility::stamp_nonce() */ /*static*/ function bottom_script_hook($filename) { $hook = 'admin_footer'; if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_28)) { // WordPress 2.8+ $hook = $hook . '-' . basename($filename); } return $hook; } } /* class FeedWordPressCompatibility */ define('FEEDWORDPRESS_AND_TAGS', FeedWordPressCompatibility::post_tags() ? ' & Tags' : ''); $fwp_capability['manage_options'] = 'manage_options'; $fwp_capability['manage_links'] = 'manage_links'; require_once dirname(__FILE__) . '/feedwordpress-walker-category-checklist.class.php'; function fwp_category_checklist($post_id = 0, $descendents_and_self = 0, $selected_cats = false, $prefix = '') { if (function_exists('wp_category_checklist')) { $walker = new FeedWordPress_Walker_Category_Checklist(); $walker->set_prefix($prefix); wp_category_checklist($post_id, $descendents_and_self, $selected_cats, false, $walker); } else { // selected_cats is an array of integer cat_IDs / term_ids for // the categories that should be checked global $post_ID; $cats = get_nested_categories(); // Undo damage from usort() in WP 2.0
function instead_of_categories_box($link_id = null) { if (!is_null($link_id)) { $from_this_feed = 'from this feed'; $by_default = ''; $id_param = "&link_id=" . $link_id; } else { $from_this_feed = 'from syndicated feeds'; $by_default = " by default"; $id_param = ""; } ?> <p>Use the <a href="admin.php?page=<?php echo FWP_CATEGORIES_PAGE_SLUG . $id_param; ?> "><?php _e('Categories' . FEEDWORDPRESS_AND_TAGS); ?> </a> settings page to set up how new posts <?php print $from_this_feed; ?> are assigned categories <?php if (FeedWordPressCompatibility::post_tags()) { ?> or tags<?php } print $by_default; ?> .</p> <?php }
function display() { //////////////////////////////////////////////// // Display settings boxes ////////////////////// //////////////////////////////////////////////// $this->boxes_by_methods = array('feed_categories_box' => __('Feed Categories' . FEEDWORDPRESS_AND_TAGS), 'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv')); if (!FeedWordPressCompatibility::post_tags()) { unset($this->boxes_by_methods['tags_box']); } parent::display(); }
function feed_categories_box($page, $box = NULL) { $link = $page->link; $unfamiliar = array('create' => '', 'tag' => '', 'default' => '', 'filter' => ''); if ($page->for_feed_settings()) { $unfamiliar['site-default'] = ''; $ucKey = isset($link->settings["unfamiliar category"]) ? $link->settings["unfamiliar category"] : null; $ucDefault = 'site-default'; } else { $ucKey = FeedWordPress::on_unfamiliar('category'); $ucDefault = 'create'; } if (!is_string($ucKey) or !array_key_exists($ucKey, $unfamiliar)) { $ucKey = $ucDefault; } $unfamiliar[$ucKey] = ' checked="checked"'; // Hey ho, let's go... ?> <table class="edit-form"> <tr> <th scope="row">Unfamiliar categories:</th> <td><p>When one of the categories on a syndicated post is a category that FeedWordPress has not encountered before ...</p> <ul class="options"> <?php if ($page->for_feed_settings()) { ?> <li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['site-default']; ?> /> use the <a href="admin.php?page=<?php echo FWP_CATEGORIES_PAGE_SLUG; ?> ">site-wide setting</a> (currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?> </strong>)</label></li> <?php } ?> <li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['create']; ?> /> create a new category</label></li> <?php if (FeedWordPressCompatibility::post_tags()) { ?> <li><label><input type="radio" name="unfamiliar_category" value="tag"<?php echo $unfamiliar['tag']; ?> /> create a new tag</label></li> <?php } ?> <li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar['default']; ?> /> don't create new categories<?php if (fwp_test_wp_version(FWP_SCHEMA_23)) { ?> or tags<?php } ?> </label></li> <li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar['filter']; ?> /> don't create new categories<?php if (fwp_test_wp_version(FWP_SCHEMA_23)) { ?> or tags<?php } ?> and don't syndicate posts unless they match at least one familiar category</label></li> </ul></td> </tr> <?php if ($page->for_feed_settings()) { ?> <tr> <th scope="row">Multiple categories:</th> <td> <input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($link->settings['cat_split'])) { echo htmlspecialchars($link->settings['cat_split']); } ?> " /> <p class="setting-description">Enter a <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">Perl-compatible regular expression</a> here if the feed provides multiple categories in a single category element. The regular expression should match the characters used to separate one category from the next. If the feed uses spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s". If the feed does not provide multiple categories in a single element, leave this blank.</p></td> </tr> <?php } ?> </table> <?php }