| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: FeedWordPress |
| 4 | 4 | Plugin URI: http://projects.radgeek.com/feedwordpress |
| 5 | 5 | Description: simple and flexible Atom/RSS syndication for WordPress |
| 6 | -Version: 0.993 | |
| 6 | +Version: 0.992 | |
| 7 | 7 | Author: Charles Johnson |
| 8 | 8 | Author URI: http://radgeek.com/ |
| 9 | 9 | License: GPL |
| 10 | -Last modified: 2008-05-08 4:48 PM PDT | |
| 10 | +Last modified: 2008-01-04 18:03 PDT | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | # This uses code derived from: |
| 14 | 14 | # - wp-rss-aggregate.php by Kellan Elliot-McCrea <kellan@protest.net> |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | # <http://www.zyx.com/blog/xmlrpc.php>), or see `update-feeds.php` |
| 27 | 27 | |
| 28 | 28 | # -- Don't change these unless you know what you're doing... |
| 29 | 29 | |
| 30 | -define ('FEEDWORDPRESS_VERSION', '0.993'); | |
| 30 | +define ('FEEDWORDPRESS_VERSION', '0.992'); | |
| 31 | 31 | define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact'); |
| 32 | 32 | define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors'); |
| 33 | 33 | |
| 34 | 34 | define ('FEEDWORDPRESS_DEBUG', false); |
| @@ -42,9 +42,8 @@ | ||
| 42 | 42 | |
| 43 | 43 | define ('FWP_SCHEMA_20', 3308); // Database schema # for WP 2.0 |
| 44 | 44 | define ('FWP_SCHEMA_21', 4772); // Database schema # for WP 2.1 |
| 45 | 45 | define ('FWP_SCHEMA_23', 5495); // Database schema # for WP 2.3 |
| 46 | -define ('FWP_SCHEMA_25', 7558); // Database schema # for WP 2.5 | |
| 47 | 46 | |
| 48 | 47 | if (FEEDWORDPRESS_DEBUG) : |
| 49 | 48 | // Help us to pick out errors, if any. |
| 50 | 49 | ini_set('error_reporting', E_ALL & ~E_NOTICE); |
| @@ -83,14 +82,9 @@ | ||
| 83 | 82 | endif; |
| 84 | 83 | endif; |
| 85 | 84 | |
| 86 | 85 | if (function_exists('wp_enqueue_script')) : |
| 87 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 88 | - wp_enqueue_script('post'); | |
| 89 | - wp_enqueue_script('thickbox'); | |
| 90 | - else : | |
| 91 | - wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box | |
| 92 | - endif; | |
| 86 | + wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box | |
| 93 | 87 | endif; |
| 94 | 88 | |
| 95 | 89 | // Magic quotes are just about the stupidest thing ever. |
| 96 | 90 | if (is_array($_POST)) : |
| @@ -96,21 +90,9 @@ | ||
| 96 | 90 | if (is_array($_POST)) : |
| 97 | 91 | $fwp_post = stripslashes_deep($_POST); |
| 98 | 92 | endif; |
| 99 | 93 | |
| 100 | -// Get the path relative to the plugins directory in which FWP is stored | |
| 101 | -preg_match ( | |
| 102 | - '|/wp-content/plugins/(.+)$|', | |
| 103 | - dirname(__FILE__), | |
| 104 | - $ref | |
| 105 | -); | |
| 106 | 94 | |
| 107 | -if (isset($ref[1])) : | |
| 108 | - $fwp_path = $ref[1]; | |
| 109 | -else : // Something went wrong. Let's just guess. | |
| 110 | - $fwp_path = 'feedwordpress'; | |
| 111 | -endif; | |
| 112 | - | |
| 113 | 95 | if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe! |
| 114 | 96 | |
| 115 | 97 | # Syndicated items are generally received in output-ready (X)HTML and |
| 116 | 98 | # should not be folded, crumpled, mutilated, or spindled by WordPress |
| @@ -165,12 +147,8 @@ | ||
| 165 | 147 | endif; |
| 166 | 148 | |
| 167 | 149 | # Cron-less auto-update. Hooray! |
| 168 | 150 | add_action('init', 'feedwordpress_auto_update'); |
| 169 | - | |
| 170 | - # Default sanitizers | |
| 171 | - add_filter('syndicated_item_content', array('SyndicatedPost', 'sanitize_content'), 0, 2); | |
| 172 | - | |
| 173 | 151 | else : |
| 174 | 152 | # Hook in the menus, which will just point to the upgrade interface |
| 175 | 153 | add_action('admin_menu', 'fwp_add_pages'); |
| 176 | 154 | endif; // if (!FeedWordPress::needs_upgrade()) |
| @@ -284,26 +262,8 @@ | ||
| 284 | 262 | |
| 285 | 263 | return $id; |
| 286 | 264 | } |
| 287 | 265 | } |
| 288 | - | |
| 289 | -function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) { | |
| 290 | - if (function_exists('wp_category_checklist')) : | |
| 291 | - wp_category_checklist($post_id, $descendents_and_self, $selected_cats); | |
| 292 | - else : | |
| 293 | - global $checked_categories; | |
| 294 | - | |
| 295 | - // selected_cats is an array of integer cat_IDs / term_ids for | |
| 296 | - // the categories that should be checked | |
| 297 | - $cats = array(); | |
| 298 | - if ($post_id) : $cats = wp_get_post_categories($post_id); | |
| 299 | - else : $cats = $selected_cats; | |
| 300 | - endif; | |
| 301 | - | |
| 302 | - $checked_categories = $cats; | |
| 303 | - dropdown_categories(); | |
| 304 | - endif; | |
| 305 | -} | |
| 306 | 266 | ################################################################################ |
| 307 | 267 | ## TEMPLATE API: functions to make your templates syndication-aware ############ |
| 308 | 268 | ################################################################################ |
| 309 | 269 | |
| @@ -438,9 +398,8 @@ | ||
| 438 | 398 | ################################################################################ |
| 439 | 399 | |
| 440 | 400 | function fwp_add_pages () { |
| 441 | 401 | global $legacy_capability_hack; |
| 442 | - global $fwp_path; | |
| 443 | 402 | |
| 444 | 403 | if ($legacy_capability_hack) : |
| 445 | 404 | // old & busted: numeric user levels |
| 446 | 405 | $manage_links = 5; |
| @@ -451,131 +410,20 @@ | ||
| 451 | 410 | $manage_options = 'manage_options'; |
| 452 | 411 | endif; |
| 453 | 412 | |
| 454 | 413 | //add_submenu_page('plugins.php', 'Akismet Configuration', 'Akismet Configuration', 'manage_options', 'syndication-manage-page', 'fwp_syndication_manage_page'); |
| 455 | - add_menu_page('Syndicated Sites', 'Syndication', $manage_links, $fwp_path.'/'.basename(__FILE__), 'fwp_syndication_manage_page'); | |
| 456 | - add_submenu_page($fwp_path.'/'.basename(__FILE__), 'Syndication Options', 'Options', $manage_options, $fwp_path.'/syndication-options.php'); | |
| 457 | - add_options_page('Syndication Options', 'Syndication', $manage_options, $fwp_path.'/syndication-options.php'); | |
| 414 | + add_menu_page('Syndicated Sites', 'Syndication', $manage_links, 'feedwordpress/'.basename(__FILE__), 'fwp_syndication_manage_page'); | |
| 415 | + add_submenu_page('feedwordpress/'.basename(__FILE__), 'Syndication Options', 'Options', $manage_options, 'feedwordpress/syndication-options.php'); | |
| 416 | + add_options_page('Syndication Options', 'Syndication', $manage_options, 'feedwordpress/syndication-options.php'); | |
| 458 | 417 | } // function fwp_add_pages () */ |
| 459 | 418 | |
| 460 | -function fwp_linkedit_single_submit ($status = NULL) { | |
| 419 | +function fwp_category_box ($checked, $object) { | |
| 461 | 420 | global $wp_db_version; |
| 462 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 463 | -?> | |
| 464 | -<div class="submitbox" id="submitlink"> | |
| 465 | -<div id="previewview"></div> | |
| 466 | -<div class="inside"> | |
| 467 | -<?php if (!is_null($status)) : ?> | |
| 468 | - <p><strong>Publication</strong></p> | |
| 469 | - <p>When a new post is syndicated from this feed...</p> | |
| 470 | - <select name="feed_post_status"> | |
| 471 | - <option value="site-default" <?php echo $status['post']['site-default']; ?>> Use | |
| 472 | - Syndication Options setting</option> | |
| 473 | - <option value="publish" <?php echo $status['post']['publish']; ?>>Publish it immediately</option> | |
| 474 | - | |
| 475 | - <?php if (SyndicatedPost::use_api('post_status_pending')) : ?> | |
| 476 | - <option value="pending" <?php echo $status['post']['pending']; ?>>Hold it Pending Review</option> | |
| 477 | - <?php endif; ?> | |
| 478 | - | |
| 479 | - <option value="draft" <?php echo $status['post']['draft']; ?>>Save it as a draft</option> | |
| 480 | - <option value="private" <?php echo $status['post']['private']; ?>>Keep it private</option> | |
| 481 | - </select> | |
| 482 | -<?php endif; ?> | |
| 483 | -</div> | |
| 484 | 421 | |
| 485 | -<p class="submit"> | |
| 486 | -<input type="submit" name="submit" value="<?php _e('Save') ?>" /> | |
| 487 | -</p> | |
| 488 | -</div> | |
| 489 | -<?php | |
| 490 | - endif; | |
| 491 | -} | |
| 492 | - | |
| 493 | -function fwp_linkedit_periodic_submit ($caption = NULL) { | |
| 494 | - global $wp_db_version; | |
| 495 | - if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) : | |
| 496 | - if (is_null($caption)) : $caption = __('Save Changes »'); endif; | |
| 422 | + if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x | |
| 497 | 423 | ?> |
| 498 | -<p class="submit"> | |
| 499 | -<input type="submit" name="submit" value="<?php print $caption; ?>" /> | |
| 500 | -</p> | |
| 501 | -<?php | |
| 502 | - endif; | |
| 503 | -} | |
| 504 | - | |
| 505 | -function fwp_option_box_opener ($legend, $id, $class = "stuffbox") { | |
| 506 | - global $wp_db_version; | |
| 507 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 508 | -?> | |
| 509 | -<div id="<?php print $id; ?>" class="<?php print $class; ?>"> | |
| 510 | -<h3><?php print htmlspecialchars($legend); ?></h3> | |
| 511 | -<div class="inside"> | |
| 512 | -<?php | |
| 513 | - else : | |
| 514 | -?> | |
| 515 | -<fieldset class="options"><legend><?php print htmlspecialchars($legend); ?></legend> | |
| 516 | -<?php | |
| 517 | - endif; | |
| 518 | -} | |
| 519 | - | |
| 520 | -function fwp_option_box_closer () { | |
| 521 | - global $wp_db_version; | |
| 522 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 523 | -?> | |
| 524 | - </div> <!-- class="inside" --> | |
| 525 | - </div> <!-- class="stuffbox" --> | |
| 526 | -<?php | |
| 527 | - else : | |
| 528 | -?> | |
| 529 | -</fieldset> | |
| 530 | -<?php | |
| 531 | - endif; | |
| 532 | -} | |
| 533 | - | |
| 534 | -function fwp_tags_box ($tags) { | |
| 535 | - if (!is_array($tags)) : $tags = array(); endif; | |
| 536 | -?> | |
| 537 | -<div id="tagsdiv" class="postbox"> | |
| 538 | - <h3><?php _e('Tags') ?></h3> | |
| 539 | - <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> | |
| 540 | - <div class="inside"> | |
| 541 | - <p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo implode(",", $tags); ?>" /></p> | |
| 542 | - <div id="tagchecklist"></div> | |
| 543 | - </div> | |
| 544 | -</div> | |
| 545 | -<?php | |
| 546 | -} | |
| 547 | - | |
| 548 | -function fwp_category_box ($checked, $object, $tags = array()) { | |
| 549 | - global $wp_db_version; | |
| 550 | - | |
| 551 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : // WordPress 2.5.x | |
| 552 | -?> | |
| 553 | -<div id="category-adder" class="wp-hidden-children"> | |
| 554 | - <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> | |
| 555 | - <p id="category-add" class="wp-hidden-child"> | |
| 556 | - <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> | |
| 557 | - <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> | |
| 558 | - <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> | |
| 559 | - <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> | |
| 560 | - <span id="category-ajax-response"></span> | |
| 561 | - </p> | |
| 562 | -</div> | |
| 563 | - | |
| 564 | -<ul id="category-tabs"> | |
| 565 | - <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a> | |
| 566 | - <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p> | |
| 567 | -</li> | |
| 568 | -</ul> | |
| 569 | - | |
| 570 | -<div id="categories-all" class="ui-tabs-panel"> | |
| 571 | - <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> | |
| 572 | - <?php fwp_category_checklist(NULL, false, $checked) ?> | |
| 573 | - </ul> | |
| 574 | -</div> | |
| 575 | -<?php | |
| 576 | - elseif (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x | |
| 577 | -?> | |
| 424 | + <div id="poststuff"> | |
| 425 | + | |
| 578 | 426 | <div id="moremeta"> |
| 579 | 427 | <div id="grabit" class="dbx-group"> |
| 580 | 428 | <fieldset id="categorydiv" class="dbx-box"> |
| 581 | 429 | <h3 class="dbx-handle"><?php _e('Categories') ?></h3> |
| @@ -581,12 +429,13 @@ | ||
| 581 | 429 | <h3 class="dbx-handle"><?php _e('Categories') ?></h3> |
| 582 | 430 | <div class="dbx-content"> |
| 583 | 431 | <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> |
| 584 | 432 | <p id="jaxcat"></p> |
| 585 | - <ul id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></ul></div> | |
| 433 | + <ul id="categorychecklist"><?php write_nested_categories($checked); ?></ul></div> | |
| 586 | 434 | </fieldset> |
| 587 | 435 | </div> |
| 588 | 436 | </div> |
| 437 | + </div> | |
| 589 | 438 | <?php |
| 590 | 439 | else : // WordPress 1.5 |
| 591 | 440 | ?> |
| 592 | 441 | <fieldset id="categorydiv" style="width: 20%; margin-right: 2em"> |
| @@ -591,9 +440,9 @@ | ||
| 591 | 440 | ?> |
| 592 | 441 | <fieldset id="categorydiv" style="width: 20%; margin-right: 2em"> |
| 593 | 442 | <legend><?php _e('Categories') ?></legend> |
| 594 | 443 | <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> |
| 595 | - <div style="height: 20em"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 444 | + <div style="height: 20em"><?php write_nested_categories($checked); ?></div> | |
| 596 | 445 | </fieldset> |
| 597 | 446 | <?php |
| 598 | 447 | endif; |
| 599 | 448 | } |
| @@ -692,9 +541,9 @@ | ||
| 692 | 541 | <?php if (!get_option('feedwordpress_automatic_updates')) : ?> |
| 693 | 542 | <p><strong>Note:</strong> Automatic updates are currently turned |
| 694 | 543 | <strong>off</strong>. New posts from your feeds will not be syndicated |
| 695 | 544 | until you manually check for them here. You can turn on automatic |
| 696 | - updates under <a href="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/syndication-options.php">Syndication | |
| 545 | + updates under <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication | |
| 697 | 546 | Options</a>.</p> |
| 698 | 547 | <?php endif; ?> |
| 699 | 548 | |
| 700 | 549 | |
| @@ -701,9 +550,9 @@ | ||
| 701 | 550 | <div class="submit"><input type="hidden" name="update_uri" value="*" /><input type="submit" name="update" value="Update" /></div> |
| 702 | 551 | </form> |
| 703 | 552 | </div> <!-- class="wrap" --> |
| 704 | 553 | |
| 705 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path']; ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 554 | + <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 706 | 555 | <div class="wrap"> |
| 707 | 556 | <h2>Syndicated Sites</h2> |
| 708 | 557 | <?php $alt_row = true; |
| 709 | 558 | if ($links): ?> |
| @@ -742,11 +591,11 @@ | ||
| 742 | 591 | feed assigned</strong></p></td> |
| 743 | 592 | <?php |
| 744 | 593 | endif; |
| 745 | 594 | ?> |
| 746 | - <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=linkedit" class="edit"><?php _e('Edit')?></a></td> | |
| 747 | - <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=feedfinder" class="edit"><?php echo $caption; ?></a></td> | |
| 748 | - <td><a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=Unsubscribe" class="delete"><?php _e('Unsubscribe'); ?></a></td> | |
| 595 | + <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=linkedit" class="edit"><?php _e('Edit')?></a></td> | |
| 596 | + <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=feedfinder" class="edit"><?php echo $caption; ?></a></td> | |
| 597 | + <td><a href="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>&link_id=<?php echo $link->link_id; ?>&action=Unsubscribe" class="delete"><?php _e('Unsubscribe'); ?></a></td> | |
| 749 | 598 | <td><input type="checkbox" name="link_ids[]" value="<?php echo $link->link_id; ?>" /></td> |
| 750 | 599 | <?php |
| 751 | 600 | echo "\n\t</tr>"; |
| 752 | 601 | endforeach; |
| @@ -764,9 +613,9 @@ | ||
| 764 | 613 | </div> <!-- class="wrap" --> |
| 765 | 614 | </form> |
| 766 | 615 | |
| 767 | 616 | <div class="wrap"> |
| 768 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 617 | + <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 769 | 618 | <h2>Add a new syndicated site:</h2> |
| 770 | 619 | <div> |
| 771 | 620 | <label for="add-uri">Website or newsfeed:</label> |
| 772 | 621 | <input type="text" name="lookup" id="add-uri" value="URI" size="64" /> |
| @@ -811,9 +660,9 @@ | ||
| 811 | 660 | if ($rss): |
| 812 | 661 | $feed_title = isset($rss->channel['title'])?$rss->channel['title']:$rss->channel['link']; |
| 813 | 662 | $feed_link = isset($rss->channel['link'])?$rss->channel['link']:''; |
| 814 | 663 | ?> |
| 815 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 664 | + <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 816 | 665 | <fieldset style="clear: both"> |
| 817 | 666 | <legend><?php echo $rss->feed_type; ?> <?php echo $rss->feed_version; ?> feed</legend> |
| 818 | 667 | |
| 819 | 668 | <?php if ($link_id===0): ?> |
| @@ -864,9 +713,9 @@ | ||
| 864 | 713 | endif; |
| 865 | 714 | ?> |
| 866 | 715 | </div> |
| 867 | 716 | |
| 868 | - <form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 717 | + <form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 869 | 718 | <div class="wrap"> |
| 870 | 719 | <h2>Use another feed</h2> |
| 871 | 720 | <div><label>Feed:</label> |
| 872 | 721 | <input type="text" name="lookup" value="URI" /> |
| @@ -919,9 +768,9 @@ | ||
| 919 | 768 | return true; // Continue |
| 920 | 769 | } |
| 921 | 770 | |
| 922 | 771 | function fwp_linkedit_page () { |
| 923 | - global $wpdb, $wp_db_version; | |
| 772 | + global $wpdb; | |
| 924 | 773 | |
| 925 | 774 | check_admin_referer(); // Make sure we arrived here from the Dashboard |
| 926 | 775 | |
| 927 | 776 | $special_settings = array ( /* Regular expression syntax is OK here */ |
| @@ -934,12 +783,10 @@ | ||
| 934 | 783 | 'post status', |
| 935 | 784 | 'comment status', |
| 936 | 785 | 'ping status', |
| 937 | 786 | 'unfamiliar author', |
| 938 | - 'unfamliar categories', /* Deprecated */ | |
| 939 | - 'unfamiliar category', | |
| 787 | + 'unfamliar categories', | |
| 940 | 788 | 'map authors', |
| 941 | - 'tags', | |
| 942 | 789 | 'update/.*', |
| 943 | 790 | 'feed/.*', |
| 944 | 791 | 'link/.*', |
| 945 | 792 | ); |
| @@ -1016,16 +863,8 @@ | ||
| 1016 | 863 | else : |
| 1017 | 864 | unset($meta['cats']); |
| 1018 | 865 | endif; |
| 1019 | 866 | |
| 1020 | - // Tags | |
| 1021 | - if (isset($GLOBALS['fwp_post']['tags_input'])) : | |
| 1022 | - $meta['tags'] = array(); | |
| 1023 | - foreach (explode(',', $GLOBALS['fwp_post']['tags_input']) as $tag) : | |
| 1024 | - $meta['tags'][] = trim($tag); | |
| 1025 | - endforeach; | |
| 1026 | - endif; | |
| 1027 | - | |
| 1028 | 867 | // Post status, comment status, ping status |
| 1029 | 868 | foreach (array('post', 'comment', 'ping') as $what) : |
| 1030 | 869 | $sfield = "feed_{$what}_status"; |
| 1031 | 870 | if (isset($GLOBALS['fwp_post'][$sfield])) : |
| @@ -1154,11 +993,8 @@ | ||
| 1154 | 993 | |
| 1155 | 994 | if (is_array($meta['cats'])) : |
| 1156 | 995 | $meta['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $meta['cats']); |
| 1157 | 996 | endif; |
| 1158 | - if (is_array($meta['tags'])) : | |
| 1159 | - $meta['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $meta['tags']); | |
| 1160 | - endif; | |
| 1161 | 997 | |
| 1162 | 998 | // Collapse the author mapping rule structure back into a flat string |
| 1163 | 999 | if (isset($meta['map authors'])) : |
| 1164 | 1000 | $ma = array(); |
| @@ -1204,12 +1040,8 @@ | ||
| 1204 | 1040 | $comment_status_global = get_option('feedwordpress_syndicated_comment_status'); |
| 1205 | 1041 | $ping_status_global = get_option('feedwordpress_syndicated_ping_status'); |
| 1206 | 1042 | |
| 1207 | 1043 | $status['post'] = array('publish' => '', 'private' => '', 'draft' => '', 'site-default' => ''); |
| 1208 | - if (SyndicatedPost::use_api('post_status_pending')) : | |
| 1209 | - $status['post']['pending'] = ''; | |
| 1210 | - endif; | |
| 1211 | - | |
| 1212 | 1044 | $status['comment'] = array('open' => '', 'closed' => '', 'site-default' => ''); |
| 1213 | 1045 | $status['ping'] = array('open' => '', 'closed' => '', 'site-default' => ''); |
| 1214 | 1046 | |
| 1215 | 1047 | foreach (array('post', 'comment', 'ping') as $what) : |
| @@ -1232,13 +1064,28 @@ | ||
| 1232 | 1064 | endif; |
| 1233 | 1065 | $unfamiliar[$what][$key] = ' checked="checked"'; |
| 1234 | 1066 | endforeach; |
| 1235 | 1067 | |
| 1236 | - if (is_array($meta['cats'])) : $cats = $meta['cats']; | |
| 1237 | - else : $cats = array(); | |
| 1068 | + $dogs = get_nested_categories(-1, 0); | |
| 1069 | + if (is_array($meta['cats'])) : | |
| 1070 | + $cats = array_map('strtolower', | |
| 1071 | + array_map('trim', | |
| 1072 | + $meta['cats'] | |
| 1073 | + )); | |
| 1074 | + else: | |
| 1075 | + $cats = array(); | |
| 1238 | 1076 | endif; |
| 1077 | + | |
| 1078 | + foreach ($dogs as $tag => $dog) : | |
| 1079 | + $found_by_name = in_array(strtolower(trim($dog['cat_name'])), $cats); | |
| 1080 | + | |
| 1081 | + if (isset($dog['cat_ID'])) : $dog['cat_id'] = $dog['cat_ID']; endif; | |
| 1082 | + $found_by_id = in_array('{#'.trim($dog['cat_id']).'}', $cats); | |
| 1239 | 1083 | |
| 1240 | - $dogs = SyndicatedPost::category_ids($cats, /*unfamiliar=*/ NULL); | |
| 1084 | + if ($found_by_name or $found_by_id) : | |
| 1085 | + $dogs[$tag]['checked'] = true; | |
| 1086 | + endif; | |
| 1087 | + endforeach; | |
| 1241 | 1088 | else : |
| 1242 | 1089 | die( __('Link not found.') ); |
| 1243 | 1090 | endif; |
| 1244 | 1091 | |
| @@ -1274,9 +1121,9 @@ | ||
| 1274 | 1121 | <?php if ($updated_link) : ?> |
| 1275 | 1122 | <div class="updated"><p>Syndicated feed settings updated.</p></div> |
| 1276 | 1123 | <?php endif; ?> |
| 1277 | 1124 | |
| 1278 | -<form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 1125 | +<form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 1279 | 1126 | <div class="wrap"> |
| 1280 | 1127 | <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" /> |
| 1281 | 1128 | <input type="hidden" name="action" value="linkedit" /> |
| 1282 | 1129 | <input type="hidden" name="save" value="link" /> |
| @@ -1281,96 +1128,92 @@ | ||
| 1281 | 1128 | <input type="hidden" name="action" value="linkedit" /> |
| 1282 | 1129 | <input type="hidden" name="save" value="link" /> |
| 1283 | 1130 | |
| 1284 | 1131 | <h2>Edit a syndicated feed:</h2> |
| 1285 | -<div id="poststuff"> | |
| 1286 | -<?php fwp_linkedit_single_submit($status); ?> | |
| 1132 | +<fieldset class="options"><legend>Basics</legend> | |
| 1133 | +<table class="editform" width="100%" cellspacing="2" cellpadding="5"> | |
| 1134 | +<tr> | |
| 1135 | +<th scope="row" width="20%"><?php _e('Feed URI:') ?></th> | |
| 1136 | +<td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a> | |
| 1137 | +(<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>" | |
| 1138 | +title="Check feed <<?php echo wp_specialchars($link_rss_uri, 'both'); ?>> for validity">validate</a>) | |
| 1139 | +</td> | |
| 1140 | +<td width="20%"><input type="submit" name="feedfinder" value="switch →" style="font-size:smaller" /></td> | |
| 1141 | +</tr> | |
| 1142 | +<tr> | |
| 1143 | +<th scope="row" width="20%"><?php _e('Link Name:') ?></th> | |
| 1144 | +<td width="60%"><input type="text" id="basics-name-edit" name="name" | |
| 1145 | +value="<?php echo $link_name; ?>" style="width: 95%" /> | |
| 1146 | +<span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span> | |
| 1147 | +</td> | |
| 1148 | +<td> | |
| 1149 | +<select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name"> | |
| 1150 | +<option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option> | |
| 1151 | +<option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option> | |
| 1152 | +</select> | |
| 1153 | +</td> | |
| 1154 | +</tr> | |
| 1155 | +<tr> | |
| 1156 | +<th scope="row" width="20%"><?php _e('Short description:') ?></th> | |
| 1157 | +<td width="60%"> | |
| 1158 | +<input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" /> | |
| 1159 | +<span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span> | |
| 1160 | +</td> | |
| 1161 | +<td> | |
| 1162 | +<select id="basics-hardcode-description" onchange="flip_hardcode('description')" | |
| 1163 | +name="hardcode_description"> | |
| 1164 | +<option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option> | |
| 1165 | +<option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option> | |
| 1166 | +</select></td> | |
| 1167 | +</tr> | |
| 1168 | +<tr> | |
| 1169 | +<th width="20%" scope="row"><?php _e('Homepage:') ?></th> | |
| 1170 | +<td width="60%"> | |
| 1171 | +<input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" /> | |
| 1172 | +<a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td> | |
| 1173 | +<td> | |
| 1174 | +<select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url"> | |
| 1175 | +<option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option> | |
| 1176 | +<option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option> | |
| 1177 | +</select></td></tr> | |
| 1287 | 1178 | |
| 1288 | -<div id="post-body"> | |
| 1289 | -<?php fwp_option_box_opener('Feed Information', 'feedinformationdiv'); ?> | |
| 1290 | - <table class="editform" width="100%" cellspacing="2" cellpadding="5"> | |
| 1291 | - <tr> | |
| 1292 | - <th scope="row" width="20%"><?php _e('Feed URI:') ?></th> | |
| 1293 | - <td width="60%"><a href="<?php echo wp_specialchars($link_rss_uri, 'both'); ?>"><?php echo $link_rss_uri; ?></a> | |
| 1294 | - (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($link_rss_uri); ?>" | |
| 1295 | - title="Check feed <<?php echo wp_specialchars($link_rss_uri, 'both'); ?>> for validity">validate</a>) | |
| 1296 | - </td> | |
| 1297 | - <td width="20%"><input type="submit" name="feedfinder" value="switch →" style="font-size:smaller" /></td> | |
| 1298 | - </tr> | |
| 1299 | - <tr> | |
| 1300 | - <th scope="row" width="20%"><?php _e('Link Name:') ?></th> | |
| 1301 | - <td width="60%"><input type="text" id="basics-name-edit" name="name" | |
| 1302 | - value="<?php echo $link_name; ?>" style="width: 95%" /> | |
| 1303 | - <span id="basics-name-view"><strong><?php echo $link_name; ?></strong></span> | |
| 1304 | - </td> | |
| 1305 | - <td> | |
| 1306 | - <select id="basics-hardcode-name" onchange="flip_hardcode('name')" name="hardcode_name"> | |
| 1307 | - <option value="no" <?php echo $link->hardcode('name')?'':'selected="selected"'; ?>>update automatically</option> | |
| 1308 | - <option value="yes" <?php echo $link->hardcode('name')?'selected="selected"':''; ?>>edit manually</option> | |
| 1309 | - </select> | |
| 1310 | - </td> | |
| 1311 | - </tr> | |
| 1312 | - <tr> | |
| 1313 | - <th scope="row" width="20%"><?php _e('Short description:') ?></th> | |
| 1314 | - <td width="60%"> | |
| 1315 | - <input id="basics-description-edit" type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" /> | |
| 1316 | - <span id="basics-description-view"><strong><?php echo $link_description; ?></strong></span> | |
| 1317 | - </td> | |
| 1318 | - <td> | |
| 1319 | - <select id="basics-hardcode-description" onchange="flip_hardcode('description')" | |
| 1320 | - name="hardcode_description"> | |
| 1321 | - <option value="no" <?php echo $link->hardcode('description')?'':'selected="selected"'; ?>>update automatically</option> | |
| 1322 | - <option value="yes" <?php echo $link->hardcode('description')?'selected="selected"':''; ?>>edit manually</option> | |
| 1323 | - </select></td> | |
| 1324 | - </tr> | |
| 1325 | - <tr> | |
| 1326 | - <th width="20%" scope="row"><?php _e('Homepage:') ?></th> | |
| 1327 | - <td width="60%"> | |
| 1328 | - <input id="basics-url-edit" type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" /> | |
| 1329 | - <a id="basics-url-view" href="<?php echo $link_url; ?>"><?php echo $link_url; ?></a></td> | |
| 1330 | - <td> | |
| 1331 | - <select id="basics-hardcode-url" onchange="flip_hardcode('url')" name="hardcode_url"> | |
| 1332 | - <option value="no"<?php echo $link->hardcode('url')?'':' selected="selected"'; ?>>update automatically</option> | |
| 1333 | - <option value="yes"<?php echo $link->hardcode('url')?' selected="selected"':''; ?>>edit manually</option> | |
| 1334 | - </select></td></tr> | |
| 1335 | - | |
| 1336 | - <tr> | |
| 1337 | - <th width="20%"><?php _e('Last update') ?>:</th> | |
| 1338 | - <td colspan="2"><?php | |
| 1339 | - if (isset($meta['update/last'])) : | |
| 1340 | - echo strftime('%x %X', $meta['update/last'])." "; | |
| 1179 | +<tr> | |
| 1180 | +<th width="20%"><?php _e('Last update') ?>:</th> | |
| 1181 | +<td colspan="2"><?php | |
| 1182 | + if (isset($meta['update/last'])) : | |
| 1183 | + echo strftime('%x %X', $meta['update/last'])." "; | |
| 1184 | + else : | |
| 1185 | + echo " none yet"; | |
| 1186 | + endif; | |
| 1187 | +?></td></tr> | |
| 1188 | +<tr><th width="20%">Next update:</th> | |
| 1189 | +<td colspan="2"><?php | |
| 1190 | + $holdem = (isset($meta['update/hold']) ? $meta['update/hold'] : 'scheduled'); | |
| 1191 | +?> | |
| 1192 | +<select name="update_schedule"> | |
| 1193 | +<option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php | |
| 1194 | + echo " ("; | |
| 1195 | + if (isset($meta['update/ttl']) and is_numeric($meta['update/ttl'])) : | |
| 1196 | + if (isset($meta['update/timed']) and $meta['update/timed']=='automatically') : | |
| 1197 | + echo 'next: '; | |
| 1198 | + $next = $meta['update/last'] + ((int) $meta['update/ttl'] * 60); | |
| 1199 | + if (strftime('%x', time()) != strftime('%x', $next)) : | |
| 1200 | + echo strftime('%x', $next)." "; | |
| 1201 | + endif; | |
| 1202 | + echo strftime('%X', $meta['update/last']+((int) $meta['update/ttl']*60)); | |
| 1341 | 1203 | else : |
| 1342 | - echo " none yet"; | |
| 1204 | + echo "every ".$meta['update/ttl']." minute".(($meta['update/ttl']!=1)?"s":""); | |
| 1343 | 1205 | endif; |
| 1344 | - ?></td></tr> | |
| 1345 | - <tr><th width="20%">Next update:</th> | |
| 1346 | - <td colspan="2"><?php | |
| 1347 | - $holdem = (isset($meta['update/hold']) ? $meta['update/hold'] : 'scheduled'); | |
| 1348 | - ?> | |
| 1349 | - <select name="update_schedule"> | |
| 1350 | - <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php | |
| 1351 | - echo " ("; | |
| 1352 | - if (isset($meta['update/ttl']) and is_numeric($meta['update/ttl'])) : | |
| 1353 | - if (isset($meta['update/timed']) and $meta['update/timed']=='automatically') : | |
| 1354 | - echo 'next: '; | |
| 1355 | - $next = $meta['update/last'] + ((int) $meta['update/ttl'] * 60); | |
| 1356 | - if (strftime('%x', time()) != strftime('%x', $next)) : | |
| 1357 | - echo strftime('%x', $next)." "; | |
| 1358 | - endif; | |
| 1359 | - echo strftime('%X', $meta['update/last']+((int) $meta['update/ttl']*60)); | |
| 1360 | - else : | |
| 1361 | - echo "every ".$meta['update/ttl']." minute".(($meta['update/ttl']!=1)?"s":""); | |
| 1362 | - endif; | |
| 1363 | - else: | |
| 1364 | - echo "next scheduled update"; | |
| 1365 | - endif; | |
| 1366 | - echo ")"; | |
| 1367 | - ?></option> | |
| 1368 | - <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option> | |
| 1369 | - <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option> | |
| 1370 | - </select></tr> | |
| 1371 | - </table> | |
| 1372 | -<?php fwp_option_box_closer(); ?> | |
| 1206 | + else: | |
| 1207 | + echo "next scheduled update"; | |
| 1208 | + endif; | |
| 1209 | + echo ")"; | |
| 1210 | +?></option> | |
| 1211 | +<option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option> | |
| 1212 | +<option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option> | |
| 1213 | +</select></tr> | |
| 1214 | +</table> | |
| 1215 | +</fieldset> | |
| 1373 | 1216 | |
| 1374 | 1217 | <script type="text/javascript"> |
| 1375 | 1218 | flip_hardcode('name'); |
| 1376 | 1219 | flip_hardcode('description'); |
| @@ -1376,99 +1219,67 @@ | ||
| 1376 | 1219 | flip_hardcode('description'); |
| 1377 | 1220 | flip_hardcode('url'); |
| 1378 | 1221 | </script> |
| 1379 | 1222 | |
| 1380 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 1223 | +<p class="submit"> | |
| 1224 | +<input type="submit" name="submit" value="<?php _e('Save Changes »') ?>" /> | |
| 1225 | +</p> | |
| 1381 | 1226 | |
| 1382 | -<?php | |
| 1383 | -if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) : | |
| 1384 | - fwp_option_box_opener('Syndicated Posts', 'syndicatedpostsdiv', 'postbox'); | |
| 1385 | -?> | |
| 1227 | +<fieldset class="options"> | |
| 1228 | +<legend>Syndicated Posts</legend> | |
| 1229 | + | |
| 1230 | +<?php fwp_category_box($dogs, 'all syndicated posts from this feed'); ?> | |
| 1231 | + | |
| 1386 | 1232 | <table class="editform" width="75%" cellspacing="2" cellpadding="5"> |
| 1387 | 1233 | <tr><th width="27%" scope="row" style="vertical-align:top">Publication:</th> |
| 1388 | 1234 | <td width="73%" style="vertical-align:top"><ul style="margin:0; list-style:none"> |
| 1389 | 1235 | <li><label><input type="radio" name="feed_post_status" value="site-default" |
| 1390 | -<?php echo $status['post']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a> | |
| 1236 | +<?php echo $status['post']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a> | |
| 1391 | 1237 | (currently: <strong><?php echo ($post_status_global ? $post_status_global : 'publish'); ?></strong>)</label></li> |
| 1392 | 1238 | <li><label><input type="radio" name="feed_post_status" value="publish" |
| 1393 | 1239 | <?php echo $status['post']['publish']; ?> /> Publish posts from this feed immediately</label></li> |
| 1394 | - | |
| 1395 | -<?php if (SyndicatedPost::use_api('post_status_pending')) : ?> | |
| 1396 | -<li><label><input type="radio" name="feed_post_status" value="pending" | |
| 1397 | -<?php echo $status['post']['pending']; ?>/> Hold posts from this feed for review; mark as Pending</label></li> | |
| 1398 | -<?php endif; ?> | |
| 1399 | - | |
| 1240 | +<li><label><input type="radio" name="feed_post_status" value="private" | |
| 1241 | +<?php echo $status['post']['private']; ?> /> Hold posts from this feed as private posts</label></li> | |
| 1400 | 1242 | <li><label><input type="radio" name="feed_post_status" value="draft" |
| 1401 | -<?php echo $status['post']['draft']; ?> /> Save posts from this feed as drafts</label></li> | |
| 1402 | -<li><label><input type="radio" name="feed_post_status" value="private" | |
| 1403 | -<?php echo $status['post']['private']; ?> /> Save posts from this feed as private posts</label></li> | |
| 1243 | +<?php echo $status['post']['draft']; ?> /> Hold posts from this feed as drafts</label></li> | |
| 1404 | 1244 | </ul></td> |
| 1405 | 1245 | </tr> |
| 1406 | -</table> | |
| 1407 | -<?php | |
| 1408 | - fwp_option_box_closer(); | |
| 1409 | - fwp_linkedit_periodic_submit(); | |
| 1410 | -endif; | |
| 1411 | 1246 | |
| 1412 | - fwp_option_box_opener(__('Categories'), 'categorydiv', 'postbox'); | |
| 1413 | - fwp_category_box($dogs, 'all syndicated posts from this feed'); | |
| 1414 | -?> | |
| 1415 | -<table> | |
| 1416 | -<tr> | |
| 1417 | -<th width="20%" scope="row" style="vertical-align:top">Unfamiliar categories:</th> | |
| 1418 | -<td width="80%"><ul style="margin: 0; list-style:none"> | |
| 1419 | -<li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['category']['site-default']; ?> /> use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a> | |
| 1420 | -(currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li> | |
| 1421 | -<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['category']['create']; ?> /> create any categories the post is in</label></li> | |
| 1422 | -<li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar['category']['default']; ?> /> don't create new categories</label></li> | |
| 1423 | -<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> | |
| 1247 | +<tr><th width="27%" scope="row" style="vertical-align:top">Comments:</th> | |
| 1248 | +<td width="73%"><ul style="margin:0; list-style:none"> | |
| 1249 | +<li><label><input type="radio" name="feed_comment_status" value="site-default" | |
| 1250 | +<?php echo $status['comment']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a> | |
| 1251 | +(currently: <strong><?php echo ($comment_status_global ? $comment_status_global : 'closed'); ?>)</strong></label></li> | |
| 1252 | +<li><label><input type="radio" name="feed_comment_status" value="open" | |
| 1253 | +<?php echo $status['comment']['open']; ?> /> Allow comments on syndicated posts from this feed</label></li> | |
| 1254 | +<li><label><input type="radio" name="feed_comment_status" value="closed" | |
| 1255 | +<?php echo $status['comment']['closed']; ?> /> Don't allow comments on syndicated posts from this feed</label></li> | |
| 1424 | 1256 | </ul></td> |
| 1425 | 1257 | </tr> |
| 1426 | 1258 | |
| 1427 | -<tr> | |
| 1428 | -<th width="20%" scope="row" style="vertical-align:top">Multiple categories:</th> | |
| 1429 | -<td width="80%"> | |
| 1430 | -<input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($meta['cat_split'])) : echo htmlspecialchars($meta['cat_split']); endif; ?>" /><br/> | |
| 1431 | -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 | |
| 1432 | -categories in a single category element. The regular expression should match | |
| 1433 | -the characters used to separate one category from the next. If the feed uses | |
| 1434 | -spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s". | |
| 1435 | -If the feed does not provide multiple categories in a single element, leave this | |
| 1436 | -blank.</td> | |
| 1259 | +<tr><th width="27%" scope="row" style="vertical-align:top">Trackback and Pingback:</th> | |
| 1260 | +<td width="73%"><ul style="margin:0; list-style:none"> | |
| 1261 | +<li><label><input type="radio" name="feed_ping_status" value="site-default" | |
| 1262 | +<?php echo $status['ping']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a> | |
| 1263 | +(currently: <strong><?php echo ($ping_status_global ? $ping_status_global : 'closed'); ?>)</strong></label></li> | |
| 1264 | +<li><label><input type="radio" name="feed_ping_status" value="open" | |
| 1265 | +<?php echo $status['ping']['open']; ?> /> Accept pings on syndicated posts from this feed</label></li> | |
| 1266 | +<li><label><input type="radio" name="feed_ping_status" value="closed" | |
| 1267 | +<?php echo $status['ping']['closed']; ?> /> Don't accept pings on syndicated posts from this feed</label></li> | |
| 1268 | +</ul></td> | |
| 1437 | 1269 | </tr> |
| 1438 | 1270 | </table> |
| 1439 | -<?php | |
| 1440 | - fwp_option_box_closer(); | |
| 1441 | - fwp_linkedit_periodic_submit(); | |
| 1442 | - | |
| 1443 | -if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 1444 | - fwp_tags_box($meta['tags']); | |
| 1445 | - fwp_linkedit_periodic_submit(); | |
| 1446 | -endif; ?> | |
| 1271 | +</fieldset> | |
| 1447 | 1272 | |
| 1448 | -<?php fwp_option_box_opener('Syndicated Authors', 'authordiv', 'postbox'); ?> | |
| 1273 | +<p class="submit"> | |
| 1274 | +<input type="submit" name="submit" value="<?php _e('Save Changes »') ?>" /> | |
| 1275 | +</p> | |
| 1276 | + | |
| 1277 | +<fieldset class="options"> | |
| 1278 | +<legend>Syndicated Authors</legend> | |
| 1449 | 1279 | <?php $authorlist = fwp_author_list(); ?> |
| 1280 | + | |
| 1450 | 1281 | <table> |
| 1451 | -<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> | |
| 1452 | -<tr> | |
| 1453 | - <th style="text-align: left">Posts by new authors</th> | |
| 1454 | - <td> | |
| 1455 | - <select id="unfamiliar-author" name="unfamiliar_author" onchange="flip_newuser('unfamiliar-author');"> | |
| 1456 | - <option value="site-default"<?php if (!isset($meta['unfamiliar author'])) : ?>selected="selected"<?php endif; ?>>are handled using site-wide settings</option> | |
| 1457 | - <option value="create"<?php if ('create'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>create a new author account</option> | |
| 1458 | - <?php foreach ($authorlist as $author_id => $author_name) : ?> | |
| 1459 | - <option value="<?php echo $author_id; ?>"<?php if ($author_id==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>are assigned to <?php echo $author_name; ?></option> | |
| 1460 | - <?php endforeach; ?> | |
| 1461 | - <option value="newuser">will be assigned to a new user...</option> | |
| 1462 | - <option value="filter"<?php if ('filter'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>get filtered out</option> | |
| 1463 | - </select> | |
| 1464 | - </td> | |
| 1465 | - <td> | |
| 1466 | - <div id="unfamiliar-author-default">Site-wide settings can be set in <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a></div> | |
| 1467 | - <div id="unfamiliar-author-newuser">named <input type="text" name="unfamiliar_author_newuser" value="" /></div> | |
| 1468 | - </td> | |
| 1469 | -</tr> | |
| 1470 | - | |
| 1471 | 1282 | <tr><th colspan="3" style="text-align: left; padding-top: 1.0em; border-bottom: 1px dotted black;">For posts by specific authors. Blank out a name to delete the rule.</th></tr> |
| 1472 | 1283 | |
| 1473 | 1284 | <?php if (isset($meta['map authors'])) : $i=0; foreach ($meta['map authors'] as $author_rules) : foreach ($author_rules as $author_name => $author_action) : $i++; ?> |
| 1474 | 1285 | <tr> |
| @@ -1501,10 +1312,30 @@ | ||
| 1501 | 1312 | </td> |
| 1502 | 1313 | <td><div id="add-author-rule-newuser">named <input type="text" name="add_author_rule_newuser" value="" /></div></td> |
| 1503 | 1314 | </tr> |
| 1504 | 1315 | |
| 1316 | +<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> | |
| 1317 | +<tr> | |
| 1318 | + <th style="text-align: left">Posts by new authors</th> | |
| 1319 | + <td> | |
| 1320 | + <select id="unfamiliar-author" name="unfamiliar_author" onchange="flip_newuser('unfamiliar-author');"> | |
| 1321 | + <option value="site-default"<?php if (!isset($meta['unfamiliar author'])) : ?>selected="selected"<?php endif; ?>>are handled using site-wide settings</option> | |
| 1322 | + <option value="create"<?php if ('create'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>create a new author account</option> | |
| 1323 | + <?php foreach ($authorlist as $author_id => $author_name) : ?> | |
| 1324 | + <option value="<?php echo $author_id; ?>"<?php if ($author_id==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>are assigned to <?php echo $author_name; ?></option> | |
| 1325 | + <?php endforeach; ?> | |
| 1326 | + <option value="newuser">will be assigned to a new user...</option> | |
| 1327 | + <option value="filter"<?php if ('filter'==$meta['unfamiliar author']) : ?>selected="selected"<?php endif; ?>>get filtered out</option> | |
| 1328 | + </select> | |
| 1329 | + </td> | |
| 1330 | + <td> | |
| 1331 | + <div id="unfamiliar-author-default">Site-wide settings can be set in <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a></div> | |
| 1332 | + <div id="unfamiliar-author-newuser">named <input type="text" name="unfamiliar_author_newuser" value="" /></div> | |
| 1333 | + </td> | |
| 1334 | +</tr> | |
| 1335 | + | |
| 1505 | 1336 | </table> |
| 1506 | -<?php fwp_option_box_closer(); ?> | |
| 1337 | +</fieldset> | |
| 1507 | 1338 | |
| 1508 | 1339 | <script> |
| 1509 | 1340 | flip_newuser('unfamiliar-author'); |
| 1510 | 1341 | <?php for ($j=1; $j<=$i; $j++) : ?> |
| @@ -1512,40 +1343,47 @@ | ||
| 1512 | 1343 | <?php endfor; ?> |
| 1513 | 1344 | flip_newuser('add-author-rule'); |
| 1514 | 1345 | </script> |
| 1515 | 1346 | |
| 1516 | -<?php | |
| 1517 | - fwp_linkedit_periodic_submit(); | |
| 1518 | - fwp_option_box_opener('Comments & Pings', 'commentstatusdiv', 'postbox'); | |
| 1519 | -?> | |
| 1520 | -<table class="editform" width="75%" cellspacing="2" cellpadding="5"> | |
| 1521 | -<tr><th width="27%" scope="row" style="vertical-align:top"><?php print __('Comments'); ?>:</th> | |
| 1522 | -<td width="73%"><ul style="margin:0; list-style:none"> | |
| 1523 | -<li><label><input type="radio" name="feed_comment_status" value="site-default" | |
| 1524 | -<?php echo $status['comment']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a> | |
| 1525 | -(currently: <strong><?php echo ($comment_status_global ? $comment_status_global : 'closed'); ?>)</strong></label></li> | |
| 1526 | -<li><label><input type="radio" name="feed_comment_status" value="open" | |
| 1527 | -<?php echo $status['comment']['open']; ?> /> Allow comments on syndicated posts from this feed</label></li> | |
| 1528 | -<li><label><input type="radio" name="feed_comment_status" value="closed" | |
| 1529 | -<?php echo $status['comment']['closed']; ?> /> Don't allow comments on syndicated posts from this feed</label></li> | |
| 1530 | -</ul></td></tr> | |
| 1347 | +<p class="submit"> | |
| 1348 | +<input type="submit" name="submit" value="<?php _e('Save Changes »') ?>" /> | |
| 1349 | +</p> | |
| 1531 | 1350 | |
| 1532 | -<tr><th width="27%" scope="row" style="vertical-align:top"><?php print __('Pings'); ?>:</th> | |
| 1533 | -<td width="73%"><ul style="margin:0; list-style:none"> | |
| 1534 | -<li><label><input type="radio" name="feed_ping_status" value="site-default" | |
| 1535 | -<?php echo $status['ping']['site-default']; ?> /> Use site-wide setting from <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/syndication-options.php">Syndication Options</a> | |
| 1536 | -(currently: <strong><?php echo ($ping_status_global ? $ping_status_global : 'closed'); ?>)</strong></label></li> | |
| 1537 | -<li><label><input type="radio" name="feed_ping_status" value="open" | |
| 1538 | -<?php echo $status['ping']['open']; ?> /> Accept pings on syndicated posts from this feed</label></li> | |
| 1539 | -<li><label><input type="radio" name="feed_ping_status" value="closed" | |
| 1540 | -<?php echo $status['ping']['closed']; ?> /> Don't accept pings on syndicated posts from this feed</label></li> | |
| 1541 | -</ul></td></tr> | |
| 1351 | +<fieldset> | |
| 1352 | +<legend>Advanced Feed Options</legend> | |
| 1353 | +<table class="editform" width="100%" cellspacing="2" cellpadding="5"> | |
| 1542 | 1354 | |
| 1355 | +<tr> | |
| 1356 | +<th width="20%" scope="row" style="vertical-align:top">Unfamiliar categories:</th> | |
| 1357 | +<td width="80%"><ul style="margin: 0; list-style:none"> | |
| 1358 | +<li><label><input type="radio" name="unfamiliar_category" value="site-default"<?php echo $unfamiliar['category']['site-default']; ?> /> use site-wide setting from <a href="admin.php?page=feedwordpress/syndication-options.php">Syndication Options</a> | |
| 1359 | +(currently <strong><?php echo FeedWordPress::on_unfamiliar('category'); ?></strong>)</label></li> | |
| 1360 | +<li><label><input type="radio" name="unfamiliar_category" value="create"<?php echo $unfamiliar['category']['create']; ?> /> create any categories the post is in</label></li> | |
| 1361 | +<li><label><input type="radio" name="unfamiliar_category" value="default"<?php echo $unfamiliar['category']['default']; ?> /> don't create new categories</label></li> | |
| 1362 | +<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> | |
| 1363 | +</ul></td> | |
| 1364 | +</tr> | |
| 1365 | + | |
| 1366 | +<tr> | |
| 1367 | +<th width="20%" scope="row" style="vertical-align:top">Multiple categories:</th> | |
| 1368 | +<td width="80%"> | |
| 1369 | +<input type="text" size="20" id="cat_split" name="cat_split" value="<?php if (isset($meta['cat_split'])) : echo htmlspecialchars($meta['cat_split']); endif; ?>" /><br/> | |
| 1370 | +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 | |
| 1371 | +categories in a single category element. The regular expression should match | |
| 1372 | +the characters used to separate one category from the next. If the feed uses | |
| 1373 | +spaces (like <a href="http://del.icio.us/">del.icio.us</a>), use the pattern "\s". | |
| 1374 | +If the feed does not provide multiple categories in a single element, leave this | |
| 1375 | +blank.</td> | |
| 1376 | +</tr> | |
| 1543 | 1377 | </table> |
| 1544 | -<?php fwp_option_box_closer(); ?> | |
| 1545 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 1378 | +</fieldset> | |
| 1546 | 1379 | |
| 1547 | -<?php fwp_option_box_opener('Custom Settings (for use in templates)', 'postcustom', 'postbox'); ?> | |
| 1380 | +<p class="submit"> | |
| 1381 | +<input type="submit" name="submit" value="<?php _e('Save Changes »') ?>" /> | |
| 1382 | +</p> | |
| 1383 | + | |
| 1384 | +<fieldset id="postcustom"> | |
| 1385 | +<legend>Custom Settings (for use in templates)</legend> | |
| 1548 | 1386 | <div id="postcustomstuff"> |
| 1549 | 1387 | <table id="meta-list" cellpadding="3"> |
| 1550 | 1388 | <tr> |
| 1551 | 1389 | <th>Key</th> |
| @@ -1577,13 +1415,14 @@ | ||
| 1577 | 1415 | <td><textarea name="notes[<?php echo $i; ?>][value]" rows="2" cols="40"></textarea></td> |
| 1578 | 1416 | <td><em>add new setting...</em><input type="hidden" name="notes[<?php echo $i; ?>][action]" value="update" /></td> |
| 1579 | 1417 | </tr> |
| 1580 | 1418 | </table> |
| 1581 | -<?php fwp_option_box_closer(); ?> | |
| 1419 | +</fieldset> | |
| 1582 | 1420 | |
| 1583 | -<?php fwp_linkedit_periodic_submit(); ?> | |
| 1584 | -</div> <!-- id="post-body" --> | |
| 1585 | -</div> <!-- id="poststuff" --> | |
| 1421 | +<p class="submit"> | |
| 1422 | +<input type="submit" name="submit" value="<?php _e('Save Changes »') ?>" /> | |
| 1423 | +</p> | |
| 1424 | + | |
| 1586 | 1425 | </div> |
| 1587 | 1426 | <?php |
| 1588 | 1427 | endif; |
| 1589 | 1428 | return false; // Don't continue |
| @@ -1692,9 +1531,9 @@ | ||
| 1692 | 1531 | SELECT * FROM $wpdb->links |
| 1693 | 1532 | WHERE link_id IN (".implode(",",$link_ids).") |
| 1694 | 1533 | "); |
| 1695 | 1534 | ?> |
| 1696 | -<form action="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php echo basename(__FILE__); ?>" method="post"> | |
| 1535 | +<form action="admin.php?page=feedwordpress/<?php echo basename(__FILE__); ?>" method="post"> | |
| 1697 | 1536 | <div class="wrap"> |
| 1698 | 1537 | <input type="hidden" name="action" value="Unsubscribe" /> |
| 1699 | 1538 | <input type="hidden" name="confirm" value="Delete" /> |
| 1700 | 1539 | |
| @@ -2229,8 +2068,13 @@ | ||
| 2229 | 2068 | |
| 2230 | 2069 | var $_freshness = null; |
| 2231 | 2070 | var $_wp_id = null; |
| 2232 | 2071 | |
| 2072 | + var $strip_attrs = array ( | |
| 2073 | + array('[a-z]+', 'style'), | |
| 2074 | + array('[a-z]+', 'target'), | |
| 2075 | + ); | |
| 2076 | + | |
| 2233 | 2077 | function SyndicatedPost ($item, $link) { |
| 2234 | 2078 | global $wpdb; |
| 2235 | 2079 | |
| 2236 | 2080 | $this->link = $link; |
| @@ -2261,14 +2105,14 @@ | ||
| 2261 | 2105 | # That's deliberate. The escaping is done at the point |
| 2262 | 2106 | # of insertion, not here, to avoid double-escaping and |
| 2263 | 2107 | # to avoid screwing with syndicated_post filters |
| 2264 | 2108 | |
| 2265 | - $this->post['post_title'] = apply_filters('syndicated_item_title', $this->item['title'], $this); | |
| 2109 | + $this->post['post_title'] = $this->item['title']; | |
| 2266 | 2110 | |
| 2267 | - // This just gives us an alphanumeric representation of | |
| 2111 | + // This just gives usan alphanumeric representation of | |
| 2268 | 2112 | // the author. We will look up (or create) the numeric |
| 2269 | 2113 | // ID for the author in SyndicatedPost::add() |
| 2270 | - $this->post['named']['author'] = apply_filters('syndicated_item_author', $this->author(), $this); | |
| 2114 | + $this->post['named']['author'] = $this->author(); | |
| 2271 | 2115 | |
| 2272 | 2116 | # Identify content and sanitize it. |
| 2273 | 2117 | # --------------------------------- |
| 2274 | 2118 | if (isset($this->item['xhtml']['body'])) : |
| @@ -2279,9 +2123,24 @@ | ||
| 2279 | 2123 | $content = $this->item['content']['encoded']; |
| 2280 | 2124 | else: |
| 2281 | 2125 | $content = $this->item['description']; |
| 2282 | 2126 | endif; |
| 2283 | - $this->post['post_content'] = apply_filters('syndicated_item_content', $content, $this); | |
| 2127 | + | |
| 2128 | + # FeedWordPress used to resolve URIs relative to the | |
| 2129 | + # feed URI. It now relies on the xml:base support | |
| 2130 | + # baked in to the MagpieRSS upgrade. So all we do here | |
| 2131 | + # now is to sanitize problematic attributes. | |
| 2132 | + # | |
| 2133 | + # This kind of sucks. I intend to replace it with | |
| 2134 | + # lib_filter sometime soon. | |
| 2135 | + foreach ($this->strip_attrs as $pair): | |
| 2136 | + list($tag,$attr) = $pair; | |
| 2137 | + $content = preg_replace ( | |
| 2138 | + ":(<$tag [^>]*)($attr=(\"[^\">]*\"|[^>\\s]+))([^>]*>):i", | |
| 2139 | + "\\1\\4", | |
| 2140 | + $content | |
| 2141 | + ); | |
| 2142 | + endforeach; | |
| 2284 | 2143 | |
| 2285 | 2144 | # Identify and sanitize excerpt |
| 2286 | 2145 | $excerpt = NULL; |
| 2287 | 2146 | if ( isset($this->item['description']) and $this->item['description'] ) : |
| @@ -2291,10 +2150,11 @@ | ||
| 2291 | 2150 | if (strlen($excerpt) > 255) : |
| 2292 | 2151 | $excerpt = substr($excerpt,0,252).'...'; |
| 2293 | 2152 | endif; |
| 2294 | 2153 | endif; |
| 2295 | - $excerpt = apply_filters('syndicated_item_excerpt', $excerpt, $this); | |
| 2296 | 2154 | |
| 2155 | + $this->post['post_content'] = $content; | |
| 2156 | + | |
| 2297 | 2157 | if (!is_null($excerpt)): |
| 2298 | 2158 | $this->post['post_excerpt'] = $excerpt; |
| 2299 | 2159 | endif; |
| 2300 | 2160 | |
| @@ -2302,11 +2162,11 @@ | ||
| 2302 | 2162 | if (!$this->use_api('wp_insert_post')) : |
| 2303 | 2163 | $this->post['post_name'] = sanitize_title($this->post['post_title']); |
| 2304 | 2164 | endif; |
| 2305 | 2165 | |
| 2306 | - $this->post['epoch']['issued'] = apply_filters('syndicated_item_published', $this->published(), $this); | |
| 2307 | - $this->post['epoch']['created'] = apply_filters('syndicated_item_created', $this->created(), $this); | |
| 2308 | - $this->post['epoch']['modified'] = apply_filters('syndicated_item_updated', $this->updated(), $this); | |
| 2166 | + $this->post['epoch']['issued'] = $this->published(); | |
| 2167 | + $this->post['epoch']['created'] = $this->created(); | |
| 2168 | + $this->post['epoch']['modified'] = $this->updated(); | |
| 2309 | 2169 | |
| 2310 | 2170 | // Dealing with timestamps in WordPress is so fucking fucked. |
| 2311 | 2171 | $offset = (int) get_option('gmt_offset') * 60 * 60; |
| 2312 | 2172 | $this->post['post_date'] = gmdate('Y-m-d H:i:s', $this->published() + $offset); |
| @@ -2319,9 +2179,9 @@ | ||
| 2319 | 2179 | $this->post['comment_status'] = $this->link->syndicated_status('comment', 'closed'); |
| 2320 | 2180 | $this->post['ping_status'] = $this->link->syndicated_status('ping', 'closed'); |
| 2321 | 2181 | |
| 2322 | 2182 | // Unique ID (hopefully a unique tag: URI); failing that, the permalink |
| 2323 | - $this->post['guid'] = apply_filters('syndicated_item_guid', $this->guid(), $this); | |
| 2183 | + $this->post['guid'] = $this->guid(); | |
| 2324 | 2184 | |
| 2325 | 2185 | // RSS 2.0 / Atom 1.0 enclosure support |
| 2326 | 2186 | if ( isset($this->item['enclosure#']) ) : |
| 2327 | 2187 | for ($i = 1; $i <= $this->item['enclosure#']; $i++) : |
| @@ -2326,28 +2186,28 @@ | ||
| 2326 | 2186 | if ( isset($this->item['enclosure#']) ) : |
| 2327 | 2187 | for ($i = 1; $i <= $this->item['enclosure#']; $i++) : |
| 2328 | 2188 | $eid = (($i > 1) ? "#{$id}" : ""); |
| 2329 | 2189 | $this->post['meta']['enclosure'][] = |
| 2330 | - apply_filters('syndicated_item_enclosure_url', $this->item["enclosure{$eid}@url"], $this)."\n". | |
| 2331 | - apply_filters('syndicated_item_enclosure_length', $this->item["enclosure{$eid}@length"], $this)."\n". | |
| 2332 | - apply_filters('syndicated_item_enclosure_type', $this->item["enclosure{$eid}@type"], $this); | |
| 2190 | + $this->item["enclosure{$eid}@url"]."\n". | |
| 2191 | + $this->item["enclosure{$eid}@length"]."\n". | |
| 2192 | + $this->item["enclosure{$eid}@type"]; | |
| 2333 | 2193 | endfor; |
| 2334 | 2194 | endif; |
| 2335 | 2195 | |
| 2336 | 2196 | // In case you want to point back to the blog this was syndicated from |
| 2337 | 2197 | if (isset($this->feed->channel['title'])) : |
| 2338 | - $this->post['meta']['syndication_source'] = apply_filters('syndicated_item_source_title', $this->feed->channel['title'], $this); | |
| 2198 | + $this->post['meta']['syndication_source'] = $this->feed->channel['title']; | |
| 2339 | 2199 | endif; |
| 2340 | 2200 | if (isset($this->feed->channel['link'])) : |
| 2341 | - $this->post['meta']['syndication_source_uri'] = apply_filters('syndicated_item_source_link', $this->feed->channel['link'], $this); | |
| 2201 | + $this->post['meta']['syndication_source_uri'] = $this->feed->channel['link']; | |
| 2342 | 2202 | endif; |
| 2343 | 2203 | |
| 2344 | 2204 | // Store information on human-readable and machine-readable comment URIs |
| 2345 | 2205 | if (isset($this->item['comments'])) : |
| 2346 | - $this->post['meta']['rss:comments'] = apply_filters('syndicated_item_comments', $this->item['comments']); | |
| 2206 | + $this->post['meta']['rss:comments'] = $this->item['comments']; | |
| 2347 | 2207 | endif; |
| 2348 | 2208 | if (isset($this->item['wfw']['commentrss'])) : |
| 2349 | - $this->post['meta']['wfw:commentRSS'] = apply_filters('syndicated_item_commentrss', $this->item['wfw']['commentrss']); | |
| 2209 | + $this->post['meta']['wfw:commentRSS'] = $this->item['wfw']['commentrss']; | |
| 2350 | 2210 | endif; |
| 2351 | 2211 | |
| 2352 | 2212 | // Store information to identify the feed that this came from |
| 2353 | 2213 | $this->post['meta']['syndication_feed'] = $this->feedmeta['link/uri']; |
| @@ -2353,13 +2213,13 @@ | ||
| 2353 | 2213 | $this->post['meta']['syndication_feed'] = $this->feedmeta['link/uri']; |
| 2354 | 2214 | $this->post['meta']['syndication_feed_id'] = $this->feedmeta['link/id']; |
| 2355 | 2215 | |
| 2356 | 2216 | // In case you want to know the external permalink... |
| 2357 | - $this->post['meta']['syndication_permalink'] = apply_filters('syndicated_item_link', $this->item['link']); | |
| 2217 | + $this->post['meta']['syndication_permalink'] = $this->item['link']; | |
| 2358 | 2218 | |
| 2359 | 2219 | // Feed-by-feed options for author and category creation |
| 2360 | 2220 | $this->post['named']['unfamiliar']['author'] = $this->feedmeta['unfamiliar author']; |
| 2361 | - $this->post['named']['unfamiliar']['category'] = $this->feedmeta['unfamiliar category']; | |
| 2221 | + $this->post['named']['unfamiliar']['category'] = $this->feedmeta['unfamiliar categories']; | |
| 2362 | 2222 | |
| 2363 | 2223 | // Categories: start with default categories, if any |
| 2364 | 2224 | $fc = get_option("feedwordpress_syndication_cats"); |
| 2365 | 2225 | if ($fc) : |
| @@ -2386,21 +2246,8 @@ | ||
| 2386 | 2246 | $this->post['named']['category'][] = $cat; |
| 2387 | 2247 | endif; |
| 2388 | 2248 | endfor; |
| 2389 | 2249 | endif; |
| 2390 | - $this->post['named']['category'] = apply_filters('syndicated_item_categories', $this->post['named']['category'], $this); | |
| 2391 | - | |
| 2392 | - // Tags: start with default tags, if any | |
| 2393 | - $ft = get_option("feedwordpress_syndication_tags"); | |
| 2394 | - if ($ft) : | |
| 2395 | - $this->post['tags_input'] = explode('FEEDWORDPRESS_CAT_SEPARATOR', $ft); | |
| 2396 | - else : | |
| 2397 | - $this->post['tags_input'] = array(); | |
| 2398 | - endif; | |
| 2399 | - | |
| 2400 | - if (is_array($this->feedmeta['tags'])) : | |
| 2401 | - $this->post['tags_input'] = array_merge($this->post['tags_input'], $this->feedmeta['tags']); | |
| 2402 | - endif; | |
| 2403 | 2250 | endif; |
| 2404 | 2251 | } // SyndicatedPost::SyndicatedPost() |
| 2405 | 2252 | |
| 2406 | 2253 | function filtered () { |
| @@ -2530,17 +2377,8 @@ | ||
| 2530 | 2377 | $dbpost[$key] = $value; |
| 2531 | 2378 | endif; |
| 2532 | 2379 | endforeach; |
| 2533 | 2380 | |
| 2534 | - if (strlen($dbpost['post_title'].$dbpost['post_content'].$dbpost['post_excerpt']) == 0) : | |
| 2535 | - // FIXME: Option for filtering out empty posts | |
| 2536 | - endif; | |
| 2537 | - if (strlen($dbpost['post_title'])==0) : | |
| 2538 | - $dbpost['post_title'] = $this->post['meta']['syndication_source'] | |
| 2539 | - .' '.gmdate('Y-m-d H:i:s', $this->published() + $offset); | |
| 2540 | - // FIXME: Option for what to fill a blank title with... | |
| 2541 | - endif; | |
| 2542 | - | |
| 2543 | 2381 | if ($this->use_api('wp_insert_post')) : |
| 2544 | 2382 | $dbpost['post_pingback'] = false; // Tell WP 2.1 and 2.2 not to process for pingbacks |
| 2545 | 2383 | $this->_wp_id = wp_insert_post($dbpost); |
| 2546 | 2384 | |
| @@ -2545,9 +2383,9 @@ | ||
| 2545 | 2383 | $this->_wp_id = wp_insert_post($dbpost); |
| 2546 | 2384 | |
| 2547 | 2385 | // This should never happen. |
| 2548 | 2386 | if (!is_numeric($this->_wp_id) or ($this->_wp_id == 0)) : |
| 2549 | - FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', array($dbpost, $this), __LINE__); | |
| 2387 | + FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', $this, __LINE__); | |
| 2550 | 2388 | endif; |
| 2551 | 2389 | |
| 2552 | 2390 | // Unfortunately, as of WordPress 2.3, wp_insert_post() |
| 2553 | 2391 | // *still* offers no way to use a guid of your choice, |
| @@ -2941,18 +2779,13 @@ | ||
| 2941 | 2779 | } // function SyndicatedPost::category_ids () |
| 2942 | 2780 | |
| 2943 | 2781 | function use_api ($tag) { |
| 2944 | 2782 | global $wp_db_version; |
| 2945 | - switch ($tag) : | |
| 2946 | - case 'wp_insert_post': | |
| 2783 | + if ('wp_insert_post'==$tag) : | |
| 2947 | 2784 | // Before 2.2, wp_insert_post does too much of the wrong stuff to use it |
| 2948 | 2785 | // In 1.5 it was such a resource hog it would make PHP segfault on big updates |
| 2949 | 2786 | $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_21); |
| 2950 | - break; | |
| 2951 | - case 'post_status_pending': | |
| 2952 | - $ret = (isset($wp_db_version) and $wp_db_version > FWP_SCHEMA_23); | |
| 2953 | - break; | |
| 2954 | - endswitch; | |
| 2787 | + endif; | |
| 2955 | 2788 | return $ret; |
| 2956 | 2789 | } // function SyndicatedPost::use_api () |
| 2957 | 2790 | |
| 2958 | 2791 | #### EXTRACT DATA FROM FEED ITEM #### |
| @@ -3109,31 +2942,8 @@ | ||
| 3109 | 2942 | endif; |
| 3110 | 2943 | |
| 3111 | 2944 | return $author; |
| 3112 | 2945 | } // SyndicatedPost::author() |
| 3113 | - | |
| 3114 | - var $strip_attrs = array ( | |
| 3115 | - array('[a-z]+', 'style'), | |
| 3116 | - array('[a-z]+', 'target'), | |
| 3117 | - ); | |
| 3118 | - function sanitize_content ($content, $obj) { | |
| 3119 | - # FeedWordPress used to resolve URIs relative to the | |
| 3120 | - # feed URI. It now relies on the xml:base support | |
| 3121 | - # baked in to the MagpieRSS upgrade. So all we do here | |
| 3122 | - # now is to sanitize problematic attributes. | |
| 3123 | - # | |
| 3124 | - # This kind of sucks. I intend to replace it with | |
| 3125 | - # lib_filter sometime soon. | |
| 3126 | - foreach ($obj->strip_attrs as $pair): | |
| 3127 | - list($tag,$attr) = $pair; | |
| 3128 | - $content = preg_replace ( | |
| 3129 | - ":(<$tag [^>]*)($attr=(\"[^\">]*\"|[^>\\s]+))([^>]*>):i", | |
| 3130 | - "\\1\\4", | |
| 3131 | - $content | |
| 3132 | - ); | |
| 3133 | - endforeach; | |
| 3134 | - return $content; | |
| 3135 | - } | |
| 3136 | 2946 | } // class SyndicatedPost |
| 3137 | 2947 | |
| 3138 | 2948 | # class SyndicatedLink: represents a syndication feed stored within the |
| 3139 | 2949 | # WordPress database |
| @@ -3211,26 +3021,18 @@ | ||
| 3211 | 3021 | $this->settings['link/uri'] = $this->link->link_rss; |
| 3212 | 3022 | $this->settings['link/name'] = $this->link->link_name; |
| 3213 | 3023 | $this->settings['link/id'] = $this->link->link_id; |
| 3214 | 3024 | |
| 3215 | - // `hardcode categories` and `unfamiliar categories` are deprecated in favor of `unfamiliar category` | |
| 3025 | + // `hardcode categories` is deprecated in favor of `unfamiliar categories` | |
| 3216 | 3026 | if ( |
| 3217 | - isset($this->settings['unfamiliar categories']) | |
| 3218 | - and !isset($this->settings['unfamiliar category']) | |
| 3219 | - ) : | |
| 3220 | - $this->settings['unfamiliar category'] = $this->settings['unfamiliar categories']; | |
| 3221 | - endif; | |
| 3222 | - if ( | |
| 3223 | 3027 | FeedWordPress::affirmative($this->settings, 'hardcode categories') |
| 3224 | - and !isset($this->settings['unfamiliar category']) | |
| 3028 | + and !isset($this->settings['unfamiliar categories']) | |
| 3225 | 3029 | ) : |
| 3226 | - $this->settings['unfamiliar category'] = 'default'; | |
| 3030 | + $this->settings['unfamiliar categories'] = 'default'; | |
| 3227 | 3031 | endif; |
| 3228 | - | |
| 3032 | + | |
| 3229 | 3033 | // Set this up automagically for del.icio.us |
| 3230 | - $bits = parse_url($this->link->link_rss); | |
| 3231 | - $tagspacers = array('del.icio.us', 'feeds.delicious.com'); | |
| 3232 | - if (!isset($this->settings['cat_split']) and in_array($bits['host'], $tagspacers)) : | |
| 3034 | + if (!isset($this->settings['cat_split']) and false !== strpos($this->link->link_rss, 'del.icio.us')) : | |
| 3233 | 3035 | $this->settings['cat_split'] = '\s'; // Whitespace separates multiple tags in del.icio.us RSS feeds |
| 3234 | 3036 | endif; |
| 3235 | 3037 | |
| 3236 | 3038 | if (isset($this->settings['cats'])): |
| @@ -3235,11 +3037,8 @@ | ||
| 3235 | 3037 | |
| 3236 | 3038 | if (isset($this->settings['cats'])): |
| 3237 | 3039 | $this->settings['cats'] = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $this->settings['cats']); |
| 3238 | 3040 | endif; |
| 3239 | - if (isset($this->settings['tags'])): | |
| 3240 | - $this->settings['tags'] = preg_split(FEEDWORDPRESS_CAT_SEPARATOR_PATTERN, $this->settings['tags']); | |
| 3241 | - endif; | |
| 3242 | 3041 | |
| 3243 | 3042 | if (isset($this->settings['map authors'])) : |
| 3244 | 3043 | $author_rules = explode("\n\n", $this->settings['map authors']); |
| 3245 | 3044 | $ma = array(); |
| @@ -3331,11 +3130,8 @@ | ||
| 3331 | 3130 | |
| 3332 | 3131 | if (is_array($to_notes['cats'])) : |
| 3333 | 3132 | $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']); |
| 3334 | 3133 | endif; |
| 3335 | - if (is_array($to_notes['tags'])) : | |
| 3336 | - $to_notes['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['tags']); | |
| 3337 | - endif; | |
| 3338 | 3134 | |
| 3339 | 3135 | if (isset($to_notes['map authors'])) : |
| 3340 | 3136 | $ma = array(); |
| 3341 | 3137 | foreach ($to_notes['map authors'] as $rule_type => $author_rules) : |
| @@ -3348,9 +3144,8 @@ | ||
| 3348 | 3144 | |
| 3349 | 3145 | unset($to_notes['link/id']); unset($to_notes['link/uri']); |
| 3350 | 3146 | unset($to_notes['link/name']); |
| 3351 | 3147 | unset($to_notes['hardcode categories']); // Deprecated |
| 3352 | - unset($to_notes['unfamiliar categories']); // Deprecated | |
| 3353 | 3148 | |
| 3354 | 3149 | $notes = ''; |
| 3355 | 3150 | foreach ($to_notes as $key => $value) : |
| 3356 | 3151 | $notes .= $key . ": ". addcslashes($value, "\0..\37".'\\') . "\n"; |
| @@ -3382,11 +3177,8 @@ | ||
| 3382 | 3177 | |
| 3383 | 3178 | if (is_array($to_notes['cats'])) : |
| 3384 | 3179 | $to_notes['cats'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['cats']); |
| 3385 | 3180 | endif; |
| 3386 | - if (is_array($to_notes['tags'])) : | |
| 3387 | - $to_notes['tags'] = implode(FEEDWORDPRESS_CAT_SEPARATOR, $to_notes['tags']); | |
| 3388 | - endif; | |
| 3389 | 3181 | |
| 3390 | 3182 | if (isset($to_notes['map authors'])) : |
| 3391 | 3183 | $ma = array(); |
| 3392 | 3184 | foreach ($to_notes['map authors'] as $rule_type => $author_rules) : |
| @@ -3399,9 +3191,8 @@ | ||
| 3399 | 3191 | |
| 3400 | 3192 | unset($to_notes['link/id']); unset($to_notes['link/uri']); |
| 3401 | 3193 | unset($to_notes['link/name']); |
| 3402 | 3194 | unset($to_notes['hardcode categories']); // Deprecated |
| 3403 | - unset($to_notes['unfamiliar categories']); // Deprecated | |
| 3404 | 3195 | |
| 3405 | 3196 | $notes = ''; |
| 3406 | 3197 | foreach ($to_notes as $key => $value) : |
| 3407 | 3198 | $notes .= $key . ": ". addcslashes($value, "\0..\37".'\\') . "\n"; |