| @@ -1,25 +1,118 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__) . '/admin-ui.php'); |
| 3 | 3 | |
| 4 | +class FeedWordPressCategoriesPage extends FeedWordPressAdminPage { | |
| 5 | + function FeedWordPressCategoriesPage ($link) { | |
| 6 | + FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresscategories', $link); | |
| 7 | + $this->dispatch = 'feedwordpress_categories_settings'; | |
| 8 | + $this->filename = __FILE__; | |
| 9 | + } | |
| 10 | + | |
| 11 | + /*static*/ function feed_categories_box ($page, $box = NULL) { | |
| 12 | + | |
| 13 | + $link = $page->link; | |
| 14 | + | |
| 15 | + $unfamiliar = array ('create'=>'','tag' => '', 'default'=>'','filter'=>''); | |
| 16 | + if ($page->for_feed_settings()) : | |
| 17 | + $unfamiliar['site-default'] = ''; | |
| 18 | + $ucKey = $link->settings["unfamiliar category"]; | |
| 19 | + $ucDefault = 'site-default'; | |
| 20 | + else : | |
| 21 | + $ucKey = FeedWordPress::on_unfamiliar('category'); | |
| 22 | + $ucDefault = 'create'; | |
| 23 | + endif; | |
| 24 | + | |
| 25 | + if (!is_string($ucKey) or !array_key_exists($ucKey, $unfamiliar)) : | |
| 26 | + $ucKey = $ucDefault; | |
| 27 | + endif; | |
| 28 | + $unfamiliar[$ucKey] = ' checked="checked"'; | |
| 29 | + | |
| 30 | + // Hey ho, let's go... | |
| 31 | + ?> | |
| 32 | +<table class="edit-form"> | |
| 33 | +<tr> | |
| 34 | +<th scope="row">Unfamiliar categories:</th> | |
| 35 | +<td><p>When one of the categories on a syndicated post is a category that FeedWordPress has not encountered before ...</p> | |
| 36 | + | |
| 37 | +<ul class="options"> | |
| 38 | +<?php if ($page->for_feed_settings()) : ?> | |
| 39 | +<li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['site-default']; ?> /> use the <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>">site-wide setting</a> | |
| 40 | +(currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li> | |
| 41 | +<?php endif; ?> | |
| 42 | + | |
| 43 | +<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['create']; ?> /> create a new category</label></li> | |
| 44 | + | |
| 45 | +<?php if (FeedWordPressCompatibility::post_tags()) : ?> | |
| 46 | +<li><label><input type="radio" name="unfamiliar_category" value="tag"<?php echo $unfamiliar['tag']; ?>/> create a new tag</label></li> | |
| 47 | +<?php endif; ?> | |
| 48 | + | |
| 49 | +<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 endif; ?></label></li> | |
| 50 | +<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 endif; ?> and don't syndicate posts unless they match at least one familiar category</label></li> | |
| 51 | +</ul></td> | |
| 52 | +</tr> | |
| 53 | + | |
| 54 | +<?php if ($page->for_feed_settings()) : ?> | |
| 55 | +<tr> | |
| 56 | +<th scope="row">Multiple categories:</th> | |
| 57 | +<td> | |
| 58 | +<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']); endif; ?>" /> | |
| 59 | +<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 | |
| 60 | +categories in a single category element. The regular expression should match | |
| 61 | +the characters used to separate one category from the next. If the feed uses | |
| 62 | +spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s". | |
| 63 | +If the feed does not provide multiple categories in a single element, leave this | |
| 64 | +blank.</p></td> | |
| 65 | +</tr> | |
| 66 | +<?php endif; ?> | |
| 67 | +</table> | |
| 68 | + <?php | |
| 69 | + } /* FeedWordPressCategoriesPage::feed_categories_box() */ | |
| 70 | + | |
| 71 | + function categories_box ($page, $box = NULL) { | |
| 72 | + $link = $page->link; | |
| 73 | + if ($page->for_feed_settings()) : | |
| 74 | + if (is_array($link->settings['cats'])) : $cats = $link->settings['cats']; | |
| 75 | + else : $cats = array(); | |
| 76 | + endif; | |
| 77 | + else : | |
| 78 | + $cats = array_map('trim', | |
| 79 | + preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_cats')) | |
| 80 | + ); | |
| 81 | + endif; | |
| 82 | + $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL); | |
| 83 | + | |
| 84 | + fwp_category_box($dogs, 'all '.$page->these_posts_phrase()); | |
| 85 | + } /* FeedWordPressCategoriesPage::categories_box () */ | |
| 86 | + | |
| 87 | + function tags_box ($page, $box = NULL) { | |
| 88 | + $link = $page->link; | |
| 89 | + if ($page->for_feed_settings()) : | |
| 90 | + $tags = $link->settings['tags']; | |
| 91 | + else : | |
| 92 | + $tags = array_map('trim', | |
| 93 | + preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_tags')) | |
| 94 | + ); | |
| 95 | + endif; | |
| 96 | + | |
| 97 | + fwp_tags_box($tags, 'all '.$page->these_posts_phrase()); | |
| 98 | + } /* FeedWordPressCategoriesPage::tags_box () */ | |
| 99 | +} | |
| 100 | + | |
| 4 | 101 | function fwp_categories_page () { |
| 5 | 102 | global $wpdb, $wp_db_version; |
| 103 | + | |
| 104 | + if (FeedWordPress::needs_upgrade()) : | |
| 105 | + fwp_upgrade_page(); | |
| 106 | + return; | |
| 107 | + endif; | |
| 6 | 108 | |
| 7 | 109 | FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_categories_settings', /*capability=*/ 'manage_links'); |
| 8 | 110 | |
| 9 | - if (isset($GLOBALS['fwp_post']['save']) or isset($GLOBALS['fwp_post']['fix_mismatch'])) : | |
| 10 | - $link_id = $_REQUEST['save_link_id']; | |
| 11 | - elseif (isset($_REQUEST['link_id'])) : | |
| 12 | - $link_id = $_REQUEST['link_id']; | |
| 13 | - else : | |
| 14 | - $link_id = NULL; | |
| 15 | - endif; | |
| 111 | + $link = FeedWordPressAdminPage::submitted_link(); | |
| 112 | + $link_id = $link->id; | |
| 16 | 113 | |
| 17 | - if (is_numeric($link_id) and $link_id) : | |
| 18 | - $link =& new SyndicatedLink($link_id); | |
| 19 | - else : | |
| 20 | - $link = NULL; | |
| 21 | - endif; | |
| 114 | + $catsPage = new FeedWordPressCategoriesPage($link); | |
| 22 | 115 | |
| 23 | 116 | $mesg = null; |
| 24 | 117 | |
| 25 | 118 | //////////////////////////////////////////////// |
| @@ -24,9 +117,9 @@ | ||
| 24 | 117 | |
| 25 | 118 | //////////////////////////////////////////////// |
| 26 | 119 | // Process POST request, if any ///////////////// |
| 27 | 120 | //////////////////////////////////////////////// |
| 28 | - if (isset($GLOBALS['fwp_post']['save'])) : | |
| 121 | + if (isset($GLOBALS['fwp_post']['save']) or isset($GLOBALS['fwp_post']['submit'])) : | |
| 29 | 122 | $saveCats = array(); |
| 30 | 123 | if (isset($GLOBALS['fwp_post']['post_category'])) : |
| 31 | 124 | foreach ($GLOBALS['fwp_post']['post_category'] as $cat_id) : |
| 32 | 125 | $saveCats[] = '{#'.$cat_id.'}'; |
| @@ -32,8 +125,17 @@ | ||
| 32 | 125 | $saveCats[] = '{#'.$cat_id.'}'; |
| 33 | 126 | endforeach; |
| 34 | 127 | endif; |
| 35 | 128 | |
| 129 | + // Different variable names to cope with different WordPress AJAX UIs | |
| 130 | + $syndicatedTags = array(); | |
| 131 | + if (isset($GLOBALS['fwp_post']['tax_input']['post_tag'])) : | |
| 132 | + $syndicatedTags = explode(",", $GLOBALS['fwp_post']['tax_input']['post_tag']); | |
| 133 | + elseif (isset($GLOBALS['fwp_post']['tags_input'])) : | |
| 134 | + $syndicatedTags = explode(",", $GLOBALS['fwp_post']['tags_input']); | |
| 135 | + endif; | |
| 136 | + $syndicatedTags = array_map('trim', $syndicatedTags); | |
| 137 | + | |
| 36 | 138 | if (is_object($link) and $link->found()) : |
| 37 | 139 | $alter = array (); |
| 38 | 140 | |
| 39 | 141 | // Categories |
| @@ -41,14 +143,9 @@ | ||
| 41 | 143 | else : unset($link->settings['cats']); |
| 42 | 144 | endif; |
| 43 | 145 | |
| 44 | 146 | // Tags |
| 45 | - if (isset($GLOBALS['fwp_post']['tags_input'])) : | |
| 46 | - $link->settings['tags'] = array(); | |
| 47 | - foreach (explode(',', $GLOBALS['fwp_post']['tags_input']) as $tag) : | |
| 48 | - $link->settings['tags'][] = trim($tag); | |
| 49 | - endforeach; | |
| 50 | - endif; | |
| 147 | + $link->settings['tags'] = $syndicatedTags; | |
| 51 | 148 | |
| 52 | 149 | // Unfamiliar categories |
| 53 | 150 | if (isset($GLOBALS['fwp_post']["unfamiliar_category"])) : |
| 54 | 151 | if ('site-default'==$GLOBALS['fwp_post']["unfamiliar_category"]) : |
| @@ -66,25 +163,15 @@ | ||
| 66 | 163 | unset($link->settings['cat_split']); |
| 67 | 164 | endif; |
| 68 | 165 | endif; |
| 69 | 166 | |
| 70 | - $alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'"; | |
| 71 | - | |
| 72 | - $alter_set = implode(", ", $alter); | |
| 73 | - | |
| 74 | - // issue update query | |
| 75 | - $result = $wpdb->query(" | |
| 76 | - UPDATE $wpdb->links | |
| 77 | - SET $alter_set | |
| 78 | - WHERE link_id='$link_id' | |
| 79 | - "); | |
| 80 | - $updated_link = true; | |
| 81 | - | |
| 82 | - // reload link information from DB | |
| 83 | - if (function_exists('clean_bookmark_cache')) : | |
| 84 | - clean_bookmark_cache($link_id); | |
| 85 | - endif; | |
| 86 | - $link =& new SyndicatedLink($link_id); | |
| 167 | + // Save settings | |
| 168 | + $link->save_settings(/*reload=*/ true); | |
| 169 | + $catsPage->updated = true; | |
| 170 | + | |
| 171 | + // Reset, reload | |
| 172 | + unset($link); | |
| 173 | + $link = new SyndicatedLink($link_id); | |
| 87 | 174 | else : |
| 88 | 175 | // Categories |
| 89 | 176 | if (!empty($saveCats)) : |
| 90 | 177 | update_option('feedwordpress_syndication_cats', implode(FEEDWORDPRESS_CAT_SEPARATOR, $saveCats)); |
| @@ -92,254 +179,78 @@ | ||
| 92 | 179 | delete_option('feedwordpress_syndication_cats'); |
| 93 | 180 | endif; |
| 94 | 181 | |
| 95 | 182 | // Tags |
| 96 | - if (isset($_REQUEST['tags_input'])) : | |
| 97 | - $tags = explode(",", $_REQUEST['tags_input']); | |
| 183 | + if (!empty($syndicatedTags)) : | |
| 184 | + update_option('feedwordpress_syndication_tags', implode(FEEDWORDPRESS_CAT_SEPARATOR, $syndicatedTags)); | |
| 98 | 185 | else : |
| 99 | - $tags = array(); | |
| 100 | - endif; | |
| 101 | - | |
| 102 | - if (!empty($tags)) : | |
| 103 | - update_option('feedwordpress_syndication_tags', implode(FEEDWORDPRESS_CAT_SEPARATOR, $tags)); | |
| 104 | - else : | |
| 105 | 186 | delete_option('feedwordpress_syndication_tags'); |
| 106 | 187 | endif; |
| 107 | 188 | |
| 108 | 189 | update_option('feedwordpress_unfamiliar_category', $_REQUEST['unfamiliar_category']); |
| 109 | 190 | |
| 110 | - $updated_link = true; | |
| 191 | + $catsPage->updated = true; | |
| 111 | 192 | endif; |
| 193 | + | |
| 194 | + do_action('feedwordpress_admin_page_categories_save', $GLOBALS['fwp_post'], $catsPage); | |
| 112 | 195 | else : |
| 113 | - $updated_link = false; | |
| 196 | + $catsPage->updated = false; | |
| 114 | 197 | endif; |
| 115 | 198 | |
| 116 | 199 | //////////////////////////////////////////////// |
| 117 | - // Get defaults from database ////////////////// | |
| 200 | + // Prepare settings page /////////////////////// | |
| 118 | 201 | //////////////////////////////////////////////// |
| 119 | 202 | |
| 120 | - $unfamiliar = array ('create'=>'','tag' => '', 'default'=>'','filter'=>''); | |
| 121 | - if (is_object($link) and $link->found()) : | |
| 122 | - $unfamiliar['site-default'] = ''; | |
| 123 | - $ucKey = $link->settings["unfamiliar category"]; | |
| 124 | - $ucDefault = 'site-default'; | |
| 203 | + $catsPage->display_update_notice_if_updated('Syndicated categories'.FEEDWORDPRESS_AND_TAGS, $mesg); | |
| 204 | + $catsPage->open_sheet('Categories'.FEEDWORDPRESS_AND_TAGS); | |
| 205 | + ?> | |
| 206 | + <style type="text/css"> | |
| 207 | + table.edit-form th { width: 27%; vertical-align: top; } | |
| 208 | + table.edit-form td { width: 73%; vertical-align: top; } | |
| 209 | + table.edit-form td ul.options { margin: 0; padding: 0; list-style: none; } | |
| 210 | + </style> | |
| 125 | 211 | |
| 126 | - if (is_array($link->settings['cats'])) : $cats = $link->settings['cats']; | |
| 127 | - else : $cats = array(); | |
| 128 | - endif; | |
| 212 | + <div id="post-body"> | |
| 213 | + <?php | |
| 214 | + //////////////////////////////////////////////// | |
| 215 | + // Display settings boxes ////////////////////// | |
| 216 | + //////////////////////////////////////////////// | |
| 129 | 217 | |
| 130 | - $tags = $link->settings['tags']; | |
| 131 | - else : | |
| 132 | - $ucKey = FeedWordPress::on_unfamiliar('category'); | |
| 133 | - $ucDefault = 'create'; | |
| 134 | - | |
| 135 | - $cats = array_map('trim', | |
| 136 | - preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_cats')) | |
| 137 | - ); | |
| 138 | - $tags = array_map('trim', | |
| 139 | - preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_tags')) | |
| 140 | - ); | |
| 218 | + $boxes_by_methods = array( | |
| 219 | + 'feed_categories_box' => __('Feed Categories'.FEEDWORDPRESS_AND_TAGS), | |
| 220 | + 'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv'), | |
| 221 | + 'tags_box' => __('Tags'), | |
| 222 | + ); | |
| 223 | + if (!FeedWordPressCompatibility::post_tags()) : | |
| 224 | + unset($boxes_by_methods['tags_box']); | |
| 141 | 225 | endif; |
| 142 | 226 | |
| 143 | - if (!is_string($ucKey) or !array_key_exists($ucKey, $unfamiliar)) : | |
| 144 | - $ucKey = $ucDefault; | |
| 145 | - endif; | |
| 146 | - $unfamiliar[$ucKey] = ' checked="checked"'; | |
| 227 | + foreach ($boxes_by_methods as $method => $row) : | |
| 228 | + if (is_array($row)) : | |
| 229 | + $id = $row['id']; | |
| 230 | + $title = $row['title']; | |
| 231 | + else : | |
| 232 | + $id = 'feedwordpress_'.$method; | |
| 233 | + $title = $row; | |
| 234 | + endif; | |
| 147 | 235 | |
| 148 | - $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL); | |
| 236 | + fwp_add_meta_box( | |
| 237 | + /*id=*/ $id, | |
| 238 | + /*title=*/ $title, | |
| 239 | + /*callback=*/ array('FeedWordPressCategoriesPage', $method), | |
| 240 | + /*page=*/ $catsPage->meta_box_context(), | |
| 241 | + /*context=*/ $catsPage->meta_box_context() | |
| 242 | + ); | |
| 243 | + endforeach; | |
| 244 | + do_action('feedwordpress_admin_page_categories_meta_boxes', $catsPage); | |
| 149 | 245 | ?> |
| 150 | -<script type="text/javascript"> | |
| 151 | - function contextual_appearance (item, appear, disappear, value, visibleStyle, checkbox) { | |
| 152 | - if (typeof(visibleStyle)=='undefined') visibleStyle = 'block'; | |
| 153 | - | |
| 154 | - var rollup=document.getElementById(item); | |
| 155 | - var newuser=document.getElementById(appear); | |
| 156 | - var sitewide=document.getElementById(disappear); | |
| 157 | - if (rollup) { | |
| 158 | - if ((checkbox && rollup.checked) || (!checkbox && value==rollup.value)) { | |
| 159 | - if (newuser) newuser.style.display=visibleStyle; | |
| 160 | - if (sitewide) sitewide.style.display='none'; | |
| 161 | - } else { | |
| 162 | - if (newuser) newuser.style.display='none'; | |
| 163 | - if (sitewide) sitewide.style.display=visibleStyle; | |
| 164 | - } | |
| 165 | - } | |
| 166 | - } | |
| 167 | -</script> | |
| 168 | - | |
| 169 | -<?php if ($updated_link) : ?> | |
| 170 | -<div class="updated"><p>Syndicated categories and tags settings updated.</p></div> | |
| 171 | -<?php elseif (!is_null($mesg)) : ?> | |
| 172 | -<div class="updated"><p><?php print wp_specialchars($mesg, 1); ?></p></div> | |
| 173 | -<?php endif; ?> | |
| 174 | - | |
| 175 | -<div class="wrap"> | |
| 176 | -<form style="position: relative" action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 177 | -<div><?php | |
| 178 | - FeedWordPressCompatibility::stamp_nonce('feedwordpress_categories_settings'); | |
| 179 | - | |
| 180 | - if (is_numeric($link_id) and $link_id) : | |
| 181 | -?> | |
| 182 | -<input type="hidden" name="save_link_id" value="<?php echo $link_id; ?>" /> | |
| 246 | + <div class="metabox-holder"> | |
| 183 | 247 | <?php |
| 184 | - else : | |
| 248 | + fwp_do_meta_boxes($catsPage->meta_box_context(), $catsPage->meta_box_context(), $catsPage); | |
| 185 | 249 | ?> |
| 186 | -<input type="hidden" name="save_link_id" value="*" /> | |
| 187 | -<?php | |
| 188 | - endif; | |
| 189 | -?> | |
| 190 | -</div> | |
| 191 | - | |
| 192 | -<?php $links = FeedWordPress::syndicated_links(); ?> | |
| 193 | -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 194 | - <div class="icon32"><img src="<?php print htmlspecialchars(WP_PLUGIN_URL.'/'.$GLOBALS['fwp_path'].'/feedwordpress.png'); ?>" alt="" /></div> | |
| 195 | -<?php endif; ?> | |
| 196 | -<h2>Categories & Tags Settings<?php if (!is_null($link) and $link->found()) : ?>: <?php echo wp_specialchars($link->link->link_name, 1); ?><?php endif; ?></h2> | |
| 197 | - | |
| 198 | -<style type="text/css"> | |
| 199 | - table.edit-form th { width: 27%; vertical-align: top; } | |
| 200 | - table.edit-form td { width: 73%; vertical-align: top; } | |
| 201 | - table.edit-form td ul.options { margin: 0; padding: 0; list-style: none; } | |
| 202 | -</style> | |
| 203 | - | |
| 204 | -<?php if (fwp_test_wp_version(FWP_SCHEMA_27)) : ?> | |
| 205 | - <style type="text/css"> | |
| 206 | - #post-search { | |
| 207 | - float: right; | |
| 208 | - margin:11px 12px 0; | |
| 209 | - min-width: 130px; | |
| 210 | - position:relative; | |
| 211 | - } | |
| 212 | - .fwpfs { | |
| 213 | - color: #dddddd; | |
| 214 | - background:#797979 url(<?php bloginfo('home') ?>/wp-admin/images/fav.png) repeat-x scroll left center; | |
| 215 | - border-color:#777777 #777777 #666666 !important; -moz-border-radius-bottomleft:12px; | |
| 216 | - -moz-border-radius-bottomright:12px; | |
| 217 | - -moz-border-radius-topleft:12px; | |
| 218 | - -moz-border-radius-topright:12px; | |
| 219 | - border-style:solid; | |
| 220 | - border-width:1px; | |
| 221 | - line-height:15px; | |
| 222 | - padding:3px 30px 4px 12px; | |
| 223 | - } | |
| 224 | - .fwpfs.slide-down { | |
| 225 | - border-bottom-color: #626262; | |
| 226 | - -moz-border-radius-bottomleft:0; | |
| 227 | - -moz-border-radius-bottomright:0; | |
| 228 | - -moz-border-radius-topleft:12px; | |
| 229 | - -moz-border-radius-topright:12px; | |
| 230 | - background-image:url(<?php bloginfo('home') ?>/wp-admin/images/fav-top.png); | |
| 231 | - background-position:0 top; | |
| 232 | - background-repeat:repeat-x; | |
| 233 | - border-bottom-style:solid; | |
| 234 | - border-bottom-width:1px; | |
| 235 | - } | |
| 236 | - </style> | |
| 237 | - | |
| 238 | - <script type="text/javascript"> | |
| 239 | - jQuery(document).ready(function($){ | |
| 240 | - $('.fwpfs').toggle( | |
| 241 | - function(){$('.fwpfs').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideDown') ) { $('.fwpfs').addClass('slide-down'); }}, 10) }, | |
| 242 | - function(){$('.fwpfs').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('.fwpfs').hasClass('slideUp') ) { $('.fwpfs').removeClass('slide-down'); }}, 10) } | |
| 243 | - ); | |
| 244 | - $('.fwpfs').bind( | |
| 245 | - 'change', | |
| 246 | - function () { this.form.submit(); } | |
| 247 | - ); | |
| 248 | - $('#post-search .button').css( 'display', 'none' ); | |
| 249 | - }); | |
| 250 | - </script> | |
| 251 | -<?php endif; /* else : */?> | |
| 252 | -<p id="post-search"> | |
| 253 | -<select name="link_id" class="fwpfs" style="max-width: 20.0em;"> | |
| 254 | - <option value="*"<?php if (is_null($link) or !$link->found()) : ?> selected="selected"<?php endif; ?>>- defaults for all feeds -</option> | |
| 255 | -<?php if ($links) : foreach ($links as $ddlink) : ?> | |
| 256 | - <option value="<?php print (int) $ddlink->link_id; ?>"<?php if (!is_null($link) and ($link->link->link_id==$ddlink->link_id)) : ?> selected="selected"<?php endif; ?>><?php print wp_specialchars($ddlink->link_name, 1); ?></option> | |
| 257 | -<?php endforeach; endif; ?> | |
| 258 | -</select> | |
| 259 | -<input class="button" type="submit" name="go" value="<?php _e('Go') ?> »" /> | |
| 260 | -</p> | |
| 261 | -<?php /* endif; */ ?> | |
| 262 | - | |
| 263 | -<?php if (!is_null($link) and $link->found()) : ?> | |
| 264 | - <p>These settings only affect posts syndicated from | |
| 265 | - <strong><?php echo wp_specialchars($link->link->link_name, 1); ?></strong>.</p> | |
| 266 | -<?php else : ?> | |
| 267 | - <p>These settings affect posts syndicated from any feed unless they are overridden | |
| 268 | - by settings for that specific feed.</p> | |
| 269 | -<?php endif; ?> | |
| 270 | - | |
| 271 | -<div id="poststuff"> | |
| 272 | -<div id="post-body"> | |
| 273 | -<?php | |
| 274 | - fwp_option_box_opener(__('Categories'), 'categorydiv', 'postbox'); | |
| 275 | - fwp_category_box($dogs, 'all syndicated posts'.((is_object($link) and $link->found()) ? ' from this feed':'')); | |
| 276 | -?> | |
| 277 | -<table class="edit-form"> | |
| 278 | -<tr> | |
| 279 | -<th scope="row">Unfamiliar categories:</th> | |
| 280 | -<td><p>When one of the categories on a syndicated post is a category that FeedWordPress has not encountered before ...</p> | |
| 281 | - | |
| 282 | -<ul class="options"> | |
| 283 | -<?php if (is_object($link) and ($link->found())) : ?> | |
| 284 | -<li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['site-default']; ?> /> use the <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>">site-wide setting</a> | |
| 285 | -(currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li> | |
| 286 | -<?php endif; ?> | |
| 287 | - | |
| 288 | -<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['create']; ?> /> create a new category</label></li> | |
| 289 | - | |
| 290 | -<?php if (fwp_test_wp_version(FWP_SCHEMA_23)) : ?> | |
| 291 | -<li><label><input type="radio" name="unfamiliar_category" value="tag"<?php echo $unfamiliar['tag']; ?>/> create a new tag</label></li> | |
| 292 | -<?php endif; ?> | |
| 293 | - | |
| 294 | -<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 endif; ?></label></li> | |
| 295 | -<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 endif; ?> and don't syndicate posts unless they match at least one familiar category</label></li> | |
| 296 | -</ul></td> | |
| 297 | -</tr> | |
| 298 | - | |
| 299 | -<?php if (is_object($link) and $link->found()) : ?> | |
| 300 | -<tr> | |
| 301 | -<th scope="row">Multiple categories:</th> | |
| 302 | -<td> | |
| 303 | -<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']); endif; ?>" /> | |
| 304 | -<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 | |
| 305 | -categories in a single category element. The regular expression should match | |
| 306 | -the characters used to separate one category from the next. If the feed uses | |
| 307 | -spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s". | |
| 308 | -If the feed does not provide multiple categories in a single element, leave this | |
| 309 | -blank.</p></td> | |
| 310 | -</tr> | |
| 311 | -<?php endif; ?> | |
| 312 | -</table> | |
| 313 | -<?php | |
| 314 | - fwp_option_box_closer(); | |
| 315 | - fwp_linkedit_periodic_submit(); | |
| 316 | - | |
| 317 | -if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 318 | - fwp_tags_box($tags); | |
| 319 | - fwp_linkedit_periodic_submit(); | |
| 320 | -endif; ?> | |
| 321 | -</div> | |
| 322 | -</div> | |
| 323 | - | |
| 324 | -<p class="submit"> | |
| 325 | -<input class="button-primary" type="submit" name="save" value="Save Changes" /> | |
| 326 | -</p> | |
| 327 | - | |
| 328 | -<script type="text/javascript"> | |
| 329 | - contextual_appearance('unfamiliar-author', 'unfamiliar-author-newuser', 'unfamiliar-author-default', 'newuser', 'inline'); | |
| 330 | -<?php if (is_object($link) and $link->found()) : ?> | |
| 331 | -<?php for ($j=1; $j<=$i; $j++) : ?> | |
| 332 | - contextual_appearance('author-rules-<?php echo $j; ?>', 'author-rules-<?php echo $j; ?>-newuser', 'author-rules-<?php echo $j; ?>-default', 'newuser', 'inline'); | |
| 333 | -<?php endfor; ?> | |
| 334 | - contextual_appearance('add-author-rule', 'add-author-rule-newuser', 'add-author-rule-default', 'newuser', 'inline'); | |
| 335 | - contextual_appearance('fix-mismatch-to', 'fix-mismatch-to-newuser', null, 'newuser', 'inline'); | |
| 336 | -<?php else : ?> | |
| 337 | - contextual_appearance('match-author-by-email', 'unless-null-email', null, 'yes', 'block', /*checkbox=*/ true); | |
| 338 | -<?php endif; ?> | |
| 339 | -</script> | |
| 340 | -</form> | |
| 341 | -</div> <!-- class="wrap" --> | |
| 250 | + </div> <!-- class="metabox-holder" --> | |
| 251 | + </div> <!-- id="post-body" --> | |
| 252 | + <?php $catsPage->close_sheet(); ?> | |
| 342 | 253 | <?php |
| 343 | 254 | } /* function fwp_categories_page () */ |
| 344 | 255 | |
| 345 | 256 | fwp_categories_page(); |