| @@ -16,13 +16,10 @@ | ||
| 16 | 16 | $link = $page->link; |
| 17 | 17 | $unfamiliar = array ('create' => '','default' => '','filter' => ''); |
| 18 | 18 | |
| 19 | 19 | if ($page->for_feed_settings()) : |
| 20 | - if (is_string($link->settings["unfamiliar author"])) : | |
| 21 | - $key = $link->settings["unfamiliar author"]; | |
| 22 | - else: | |
| 23 | - $key = 'site-default'; | |
| 24 | - endif; | |
| 20 | + $key = $link->setting('unfamiliar author', NULL, 'site-default'); | |
| 21 | + $unfamiliar['site-default'] = ''; | |
| 25 | 22 | else : |
| 26 | 23 | $key = FeedWordPress::on_unfamiliar('author'); |
| 27 | 24 | endif; |
| 28 | 25 | $unfamiliar[$key] = ' selected="selected"'; |
| @@ -40,11 +37,11 @@ | ||
| 40 | 37 | <select style="max-width: 27.0em" id="unfamiliar-author" name="unfamiliar_author" onchange="contextual_appearance('unfamiliar-author', 'unfamiliar-author-newuser', 'unfamiliar-author-default', 'newuser', 'inline');"> |
| 41 | 38 | <?php if ($page->for_feed_settings()) : ?> |
| 42 | 39 | <option value="site-default"<?php print $unfamiliar['site-default']; ?>>are handled according to the default for all feeds</option> |
| 43 | 40 | <?php endif; ?> |
| 44 | - <option value="create"<?php $unfamiliar['create']; ?>>will have a new author account created for them</option> | |
| 41 | + <option value="create"<?php print $unfamiliar['create']; ?>>will have a new author account created for them</option> | |
| 45 | 42 | <?php foreach ($page->authorlist as $author_id => $author_name) : ?> |
| 46 | - <option value="<?php echo $author_id; ?>"<?php print $unfamiliar[$author_id]; ?>>will have their posts attributed to <?php echo $author_name; ?></option> | |
| 43 | + <option value="<?php echo $author_id; ?>"<?php print (isset($unfamiliar[$author_id]) ? $unfamiliar[$author_id] : ''); ?>>will have their posts attributed to <?php echo $author_name; ?></option> | |
| 47 | 44 | <?php endforeach; ?> |
| 48 | 45 | <option value="newuser">will have their posts attributed to a new user...</option> |
| 49 | 46 | <option value="filter"<?php print $unfamiliar['filter'] ?>>get filtered out</option> |
| 50 | 47 | </select> |
| @@ -166,9 +163,8 @@ | ||
| 166 | 163 | |
| 167 | 164 | FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_author_settings', /*capability=*/ 'manage_links'); |
| 168 | 165 | |
| 169 | 166 | $link = FeedWordPressAdminPage::submitted_link(); |
| 170 | - $link_id = $link->id; | |
| 171 | 167 | $authorsPage = new FeedWordPressAuthorsPage($link); |
| 172 | 168 | |
| 173 | 169 | $mesg = null; |
| 174 | 170 | |
| @@ -206,9 +202,9 @@ | ||
| 206 | 202 | SELECT {$wpdb->posts}.id |
| 207 | 203 | FROM {$wpdb->posts}, {$wpdb->postmeta} |
| 208 | 204 | WHERE ({$wpdb->posts}.id = {$wpdb->postmeta}.post_id) |
| 209 | 205 | AND {$wpdb->postmeta}.meta_key = 'syndication_feed_id' |
| 210 | - AND {$wpdb->postmeta}.meta_value = '{$link_id}' | |
| 206 | + AND {$wpdb->postmeta}.meta_value = '{$link->id}' | |
| 211 | 207 | AND {$wpdb->posts}.post_author = '{$fix_mismatch_from_id}' |
| 212 | 208 | "); |
| 213 | 209 | |
| 214 | 210 | if (count($post_ids) > 0) : |
| @@ -288,26 +284,17 @@ | ||
| 288 | 284 | $link->settings['map authors']['name'][$name] = $author_action; |
| 289 | 285 | endif; |
| 290 | 286 | endif; |
| 291 | 287 | endif; |
| 292 | - | |
| 293 | - $alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'"; | |
| 294 | - | |
| 295 | - $alter_set = implode(", ", $alter); | |
| 296 | - | |
| 297 | - // issue update query | |
| 298 | - $result = $wpdb->query(" | |
| 299 | - UPDATE $wpdb->links | |
| 300 | - SET $alter_set | |
| 301 | - WHERE link_id='$link_id' | |
| 302 | - "); | |
| 288 | + | |
| 289 | + // Save settings | |
| 290 | + $link->save_settings(/*reload=*/ true); | |
| 303 | 291 | $updated_link = true; |
| 304 | - | |
| 305 | - // reload link information from DB | |
| 306 | - if (function_exists('clean_bookmark_cache')) : | |
| 307 | - clean_bookmark_cache($link_id); | |
| 308 | - endif; | |
| 309 | - $link =& new SyndicatedLink($link_id); | |
| 292 | + | |
| 293 | + // Reset, reload | |
| 294 | + $link_id = $link->id; | |
| 295 | + unset($link); | |
| 296 | + $link = new SyndicatedLink($link_id); | |
| 310 | 297 | else : |
| 311 | 298 | if ('newuser'==$GLOBALS['fwp_post']['unfamiliar_author']) : |
| 312 | 299 | $newuser_name = trim($GLOBALS['fwp_post']['unfamiliar_author_newuser']); |
| 313 | 300 | if (strlen($newuser_name) > 0) : |
| @@ -360,9 +347,9 @@ | ||
| 360 | 347 | if ($updated_link) : |
| 361 | 348 | ?> |
| 362 | 349 | <div class="updated"><p>Syndicated author settings updated.</p></div> |
| 363 | 350 | <?php elseif (!is_null($mesg)) : ?> |
| 364 | -<div class="updated"><p><?php print wp_specialchars($mesg, 1); ?></p></div> | |
| 351 | +<div class="updated"><p><?php print esc_html($mesg); ?></p></div> | |
| 365 | 352 | <?php endif; |
| 366 | 353 | |
| 367 | 354 | if (function_exists('add_meta_box')) : |
| 368 | 355 | add_action( |