| @@ -6,9 +6,10 @@ | ||
| 6 | 6 | fwp_upgrade_page(); |
| 7 | 7 | return; |
| 8 | 8 | endif; |
| 9 | 9 | |
| 10 | - if (isset($_POST['submit'])) : | |
| 10 | + $caption = 'Save Changes'; | |
| 11 | + if (isset($_POST['action']) and $_POST['action']==$caption): | |
| 11 | 12 | check_admin_referer(); |
| 12 | 13 | |
| 13 | 14 | if (!current_user_can('manage_options')): |
| 14 | 15 | die (__("Cheatin' uh ?")); |
| @@ -58,26 +59,13 @@ | ||
| 58 | 59 | endforeach; |
| 59 | 60 | endif; |
| 60 | 61 | |
| 61 | 62 | if (!empty($cats)) : |
| 62 | - update_option('feedwordpress_syndication_cats', implode(FEEDWORDPRESS_CAT_SEPARATOR, $cats)); | |
| 63 | + update_option('feedwordpress_syndication_cats', implode("\n", $cats)); | |
| 63 | 64 | else : |
| 64 | 65 | delete_option('feedwordpress_syndication_cats'); |
| 65 | 66 | endif; |
| 66 | 67 | |
| 67 | - // Tags | |
| 68 | - if (isset($_REQUEST['tags_input'])) : | |
| 69 | - $tags = explode(",", $_REQUEST['tags_input']); | |
| 70 | - else : | |
| 71 | - $tags = array(); | |
| 72 | - endif; | |
| 73 | - | |
| 74 | - if (!empty($tags)) : | |
| 75 | - update_option('feedwordpress_syndication_tags', implode(FEEDWORDPRESS_CAT_SEPARATOR, $tags)); | |
| 76 | - else : | |
| 77 | - delete_option('feedwordpress_syndication_tags'); | |
| 78 | - endif; | |
| 79 | - | |
| 80 | 68 | if (isset($_REQUEST['comment_status']) and ($_REQUEST['comment_status'] == 'open')) : |
| 81 | 69 | update_option('feedwordpress_syndicated_comment_status', 'open'); |
| 82 | 70 | else : |
| 83 | 71 | update_option('feedwordpress_syndicated_comment_status', 'closed'); |
| @@ -158,16 +146,25 @@ | ||
| 158 | 146 | else : |
| 159 | 147 | $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); |
| 160 | 148 | endif; |
| 161 | 149 | |
| 162 | - $cats = array_map('trim', | |
| 163 | - preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_cats')) | |
| 164 | - ); | |
| 165 | - $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL); | |
| 150 | + $cats = get_option('feedwordpress_syndication_cats'); | |
| 151 | + $dogs = get_nested_categories(-1, 0); | |
| 152 | + $cats = array_map('strtolower', | |
| 153 | + array_map('trim', | |
| 154 | + preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $cats) | |
| 155 | + )); | |
| 156 | + | |
| 157 | + foreach ($dogs as $tag => $dog) : | |
| 158 | + $found_by_name = in_array(strtolower(trim($dog['cat_name'])), $cats); | |
| 159 | + if (isset($dog['cat_ID'])) : $dog['cat_id'] = $dog['cat_ID']; endif; | |
| 160 | + $found_by_id = in_array('{#'.trim($dog['cat_id']).'}', $cats); | |
| 166 | 161 | |
| 167 | - $tags = array_map('trim', | |
| 168 | - preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, get_option('feedwordpress_syndication_tags')) | |
| 169 | - ); | |
| 162 | + if ($found_by_name or $found_by_id) : | |
| 163 | + $dogs[$tag]['checked'] = true; | |
| 164 | + endif; | |
| 165 | + endforeach; | |
| 166 | + | |
| 170 | 167 | ?> |
| 171 | 168 | <script type="text/javascript"> |
| 172 | 169 | function flip_newuser (item) { |
| 173 | 170 | rollup=document.getElementById(item); |
| @@ -186,13 +183,11 @@ | ||
| 186 | 183 | </script> |
| 187 | 184 | |
| 188 | 185 | <div class="wrap"> |
| 189 | 186 | <h2>Syndication Options</h2> |
| 190 | -<div id="poststuff"> | |
| 191 | 187 | <form action="" method="post"> |
| 192 | -<?php fwp_linkedit_single_submit(); ?> | |
| 193 | -<div id="post-body"> | |
| 194 | -<?php fwp_option_box_opener('Syndicated Feeds', 'syndicatedfeedsdiv'); ?> | |
| 188 | +<fieldset class="options"> | |
| 189 | +<legend>Syndicated Feeds</legend> | |
| 195 | 190 | <table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
| 196 | 191 | <tr> |
| 197 | 192 | <th width="33%" scope="row">Syndicated Link category:</th> |
| 198 | 193 | <td width="67%"><?php |
| @@ -228,78 +223,59 @@ | ||
| 228 | 223 | <li><input type="checkbox" name="hardcode_description" value="no"<?php echo (($hardcode_description=='yes')?'':' checked="checked"');?>/> Update when contributor description if the feed tagline changes</li> |
| 229 | 224 | <li><input type="checkbox" name="hardcode_url" value="no"<?php echo (($hardcode_url=='yes')?'':' checked="checked"');?>/> Update the contributor homepage when the feed link changes</li> |
| 230 | 225 | </ul></td></tr> |
| 231 | 226 | </table> |
| 232 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 233 | -<?php fwp_option_box_closer(); ?> | |
| 227 | +<div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div> | |
| 228 | +</fieldset> | |
| 234 | 229 | |
| 235 | -<?php | |
| 236 | - fwp_option_box_opener(__('Syndicated Posts'), 'syndicatedpostsdiv'); | |
| 237 | -?> | |
| 230 | +<fieldset class="options"> | |
| 231 | +<legend>Syndicated Posts</legend> | |
| 232 | + | |
| 233 | +<?php fwp_category_box($dogs, '<em>all syndicated posts</em>'); ?> | |
| 234 | + | |
| 238 | 235 | <table class="editform" width="75%" cellspacing="2" cellpadding="5"> |
| 239 | 236 | <tr style="vertical-align: top"><th width="44%" scope="row">Publication:</th> |
| 240 | 237 | <td width="56%"><ul style="margin: 0; padding: 0; list-style:none"> |
| 241 | 238 | <li><label><input type="radio" name="post_status" value="publish"<?php echo (!$post_status or $post_status=='publish')?' checked="checked"':''; ?> /> Publish syndicated posts immediately</label></li> |
| 242 | -<?php if (SyndicatedPost::use_api('post_status_pending')) : ?> | |
| 243 | -<li><label><input type="radio" name="post_status" value="pending"<?php echo ($post_status=='pending')?' checked="checked"':''; ?> /> Hold syndicated posts for review; mark as Pending</label></li> | |
| 244 | -<?php endif; ?> | |
| 245 | -<li><label><input type="radio" name="post_status" value="draft"<?php echo ($post_status=='draft')?' checked="checked"':''; ?> /> Save syndicated posts as drafts</label></li> | |
| 246 | -<li><label><input type="radio" name="post_status" value="private"<?php echo ($post_status=='private')?' checked="checked"':''; ?> /> Save syndicated posts as private posts</label></li> | |
| 239 | +<li><label><input type="radio" name="post_status" value="draft"<?php echo ($post_status=='draft')?' checked="checked"':''; ?> /> Hold syndicated posts as drafts</label></li> | |
| 240 | +<li><label><input type="radio" name="post_status" value="private"<?php echo ($post_status=='private')?' checked="checked"':''; ?> /> Hold syndicated posts as private posts</label></li> | |
| 247 | 241 | </ul></td></tr> |
| 248 | -<tr style="vertical-align: top"><th width="44%" scope="row">Permalinks point to:</th> | |
| 249 | -<td width="56%"><select name="munge_permalink" size="1"> | |
| 250 | -<option value="yes"<?php echo ($munge_permalink=='yes')?' selected="selected"':''; ?>>original website</option> | |
| 251 | -<option value="no"<?php echo ($munge_permalink=='no')?' selected="selected"':''; ?>>this website</option> | |
| 252 | -</select></td></tr> | |
| 253 | -</table> | |
| 254 | -<?php | |
| 255 | - fwp_option_box_closer(); | |
| 256 | - fwp_linkedit_periodic_submit(); | |
| 257 | 242 | |
| 258 | - fwp_option_box_opener(__('Categories for syndicated posts'), 'categorydiv', 'postbox'); | |
| 259 | - fwp_category_box($dogs, '<em>all syndicated posts</em>'); | |
| 260 | -?> | |
| 261 | -<table class="editform" width="75%" cellspacing="2" cellpadding="5"> | |
| 262 | -<tr style="vertical-align: top"><th width="27%" scope="row" style="vertical-align:top">Unfamiliar categories:</th> | |
| 263 | -<td><ul style="margin: 0; padding:0; list-style:none"> | |
| 264 | -<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar_category['create']; ?>/> create any categories the post is in</label></li> | |
| 265 | -<li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar_category['default']; ?>/> don't create new categories</li> | |
| 266 | -<li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar_category['filter']; ?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li> | |
| 267 | -</ul></td></tr> | |
| 268 | -</table> | |
| 269 | -<?php | |
| 270 | - fwp_option_box_closer(); | |
| 271 | - fwp_linkedit_periodic_submit(); | |
| 272 | - | |
| 273 | -if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 274 | - fwp_tags_box($tags); | |
| 275 | - fwp_linkedit_periodic_submit(); | |
| 276 | -endif; | |
| 277 | - | |
| 278 | - fwp_option_box_opener(__('Comments & Pings'), 'commentstatus', 'postbox'); | |
| 279 | -?> | |
| 280 | -<table class="editform" width="75%" cellspacing="2" cellpadding="5"> | |
| 281 | -<tr style="vertical-align: top"><th width="44%" scope="row"><?php print __('Comments') ?>:</th> | |
| 243 | +<tr style="vertical-align: top"><th width="44%" scope="row">Comments:</th> | |
| 282 | 244 | <td width="56%"><ul style="margin: 0; padding: 0; list-style:none"> |
| 283 | 245 | <li><label><input type="radio" name="comment_status" value="open"<?php echo ($comment_status=='open')?' checked="checked"':''; ?> /> Allow comments on syndicated posts</label></li> |
| 284 | 246 | <li><label><input type="radio" name="comment_status" value="closed"<?php echo ($comment_status!='open')?' checked="checked"':''; ?> /> Don't allow comments on syndicated posts</label></li> |
| 285 | 247 | </ul></td></tr> |
| 286 | 248 | |
| 287 | -<tr style="vertical-align: top"><th width="44%" scope="row"><?php print __('Pings') ?>:</th> | |
| 249 | +<tr style="vertical-align: top"><th width="44%" scope="row">Trackback and Pingback:</th> | |
| 288 | 250 | <td width="56%"><ul style="margin:0; padding: 0; list-style:none"> |
| 289 | 251 | <li><label><input type="radio" name="ping_status" value="open"<?php echo ($ping_status=='open')?' checked="checked"':''; ?> /> Accept pings on syndicated posts</label></li> |
| 290 | 252 | <li><label><input type="radio" name="ping_status" value="closed"<?php echo ($ping_status!='open')?' checked="checked"':''; ?> /> Don't accept pings on syndicated posts</label></li> |
| 291 | 253 | </ul></td></tr> |
| 254 | + | |
| 255 | +<tr style="vertical-align: top"><th width="44%" scope="row" style="vertical-align:top">Unfamiliar categories:</th> | |
| 256 | +<td width="56%"><ul style="margin: 0; padding:0; list-style:none"> | |
| 257 | +<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar_category['create']; ?>/> create any categories the post is in</label></li> | |
| 258 | +<li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar_category['default']; ?>/> don't create new categories</li> | |
| 259 | +<li><label><input type="radio" name="unfamiliar_category" value="filter"<?php echo $unfamiliar_category['filter']; ?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li> | |
| 260 | +</ul></td></tr> | |
| 261 | + | |
| 262 | +<tr style="vertical-align: top"><th width="44%" scope="row">Permalinks point to:</th> | |
| 263 | +<td width="56%"><select name="munge_permalink" size="1"> | |
| 264 | +<option value="yes"<?php echo ($munge_permalink=='yes')?' selected="selected"':''; ?>>original website</option> | |
| 265 | +<option value="no"<?php echo ($munge_permalink=='no')?' selected="selected"':''; ?>>this website</option> | |
| 266 | +</select></td></tr> | |
| 292 | 267 | </table> |
| 268 | +<div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div> | |
| 269 | +</fieldset> | |
| 270 | + | |
| 271 | +<fieldset class="options"> | |
| 272 | +<legend>Syndicated Authors</legend> | |
| 293 | 273 | <?php |
| 294 | - fwp_option_box_closer(); | |
| 295 | - fwp_linkedit_periodic_submit(); | |
| 296 | - | |
| 297 | - fwp_option_box_opener('Syndicated Authors', 'authordiv', 'postbox'); | |
| 298 | - | |
| 299 | 274 | $unfamiliar_author = FeedWordPress::on_unfamiliar('author'); |
| 300 | 275 | $authorlist = fwp_author_list(); |
| 301 | 276 | ?> |
| 277 | + | |
| 302 | 278 | <table> |
| 303 | 279 | <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by authors that haven't been syndicated before:</th></tr> |
| 304 | 280 | <tr> |
| 305 | 281 | <th style="text-align: left">Posts by new authors</th> |
| @@ -322,14 +298,14 @@ | ||
| 322 | 298 | |
| 323 | 299 | <script> |
| 324 | 300 | flip_newuser('unfamiliar-author'); |
| 325 | 301 | </script> |
| 326 | -<?php | |
| 327 | - fwp_option_box_closer(); | |
| 328 | - fwp_linkedit_periodic_submit(); | |
| 329 | - | |
| 330 | - fwp_option_box_opener('Back End', 'backenddiv', 'postbox'); | |
| 331 | -?> | |
| 302 | + | |
| 303 | +<div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div> | |
| 304 | +</fieldset> | |
| 305 | + | |
| 306 | +<fieldset class="options"> | |
| 307 | +<legend>Back-end Options</legend> | |
| 332 | 308 | <table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
| 333 | 309 | <th width="33%" scope="row">Write update notices to PHP logs:</th> |
| 334 | 310 | <td width="67%"><select name="update_logging" size="1"> |
| 335 | 311 | <option value="yes"<?php echo (($update_logging=='yes')?' selected="selected"':''); ?>>yes</option> |
| @@ -336,15 +312,11 @@ | ||
| 336 | 312 | <option value="no"<?php echo (($update_logging!='yes')?' selected="selected"':''); ?>>no</option> |
| 337 | 313 | </select></td> |
| 338 | 314 | </tr> |
| 339 | 315 | </table> |
| 340 | -<?php | |
| 341 | - fwp_option_box_closer(); | |
| 342 | - fwp_linkedit_periodic_submit(); | |
| 343 | -?> | |
| 344 | -</div> | |
| 316 | +<div class="submit"><input type="submit" name="action" value="<?php echo $caption; ?>" /></div> | |
| 317 | +</fieldset> | |
| 345 | 318 | </form> |
| 346 | -</div> | |
| 347 | 319 | </div> |
| 348 | 320 | <?php |
| 349 | 321 | } |
| 350 | 322 | |