| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: FeedWordPress |
| 4 | 4 | Plugin URI: http://feedwordpress.radgeek.com/ |
| 5 | 5 | Description: simple and flexible Atom/RSS syndication for WordPress |
| 6 | -Version: 2010.0127 | |
| 6 | +Version: 2009.1112 | |
| 7 | 7 | Author: Charles Johnson |
| 8 | 8 | Author URI: http://radgeek.com/ |
| 9 | 9 | License: GPL |
| 10 | 10 | */ |
| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | # or use a cron job. |
| 28 | 28 | |
| 29 | 29 | # -- Don't change these unless you know what you're doing... |
| 30 | 30 | |
| 31 | -define ('FEEDWORDPRESS_VERSION', '2010.0127'); | |
| 31 | +define ('FEEDWORDPRESS_VERSION', '2009.1112'); | |
| 32 | 32 | define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact'); |
| 33 | 33 | |
| 34 | 34 | // Defaults |
| 35 | 35 | define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors'); |
| @@ -59,9 +59,8 @@ | ||
| 59 | 59 | define ('FWP_SCHEMA_25', 7558); // Database schema # for WP 2.5 |
| 60 | 60 | define ('FWP_SCHEMA_26', 8201); // Database schema # for WP 2.6 |
| 61 | 61 | define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7 |
| 62 | 62 | define ('FWP_SCHEMA_28', 11548); // Database schema # for WP 2.8 |
| 63 | -define ('FWP_SCHEMA_29', 12329); // Database schema # for WP 2.9 | |
| 64 | 63 | |
| 65 | 64 | if (FEEDWORDPRESS_DEBUG) : |
| 66 | 65 | // Help us to pick out errors, if any. |
| 67 | 66 | ini_set('error_reporting', E_ALL & ~E_NOTICE); |
| @@ -122,20 +121,13 @@ | ||
| 122 | 121 | else : // Something went wrong. Let's just guess. |
| 123 | 122 | $fwp_path = 'feedwordpress'; |
| 124 | 123 | endif; |
| 125 | 124 | |
| 126 | -function feedwordpress_admin_scripts () { | |
| 127 | - wp_enqueue_script('post'); // for magic tag and category boxes | |
| 128 | - wp_enqueue_script('admin-forms'); // for checkbox selection | |
| 129 | -} | |
| 130 | - | |
| 131 | 125 | // If this is a FeedWordPress admin page, queue up scripts for AJAX functions that FWP uses |
| 132 | 126 | // If it is a display page or a non-FeedWordPress admin page, don't. |
| 133 | 127 | if (is_admin() and isset($_REQUEST['page']) and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])) : |
| 134 | 128 | if (function_exists('wp_enqueue_script')) : |
| 135 | - if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : | |
| 136 | - add_action('admin_print_scripts', 'feedwordpress_admin_scripts'); | |
| 137 | - elseif (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25)) : | |
| 129 | + if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 138 | 130 | wp_enqueue_script('post'); // for magic tag and category boxes |
| 139 | 131 | wp_enqueue_script('thickbox'); // for fold-up boxes |
| 140 | 132 | wp_enqueue_script('admin-forms'); // for checkbox selection |
| 141 | 133 | else : |
| @@ -189,11 +181,8 @@ | ||
| 189 | 181 | add_action('admin_notices', 'fwp_check_debug'); |
| 190 | 182 | add_action('admin_notices', 'fwp_check_magpie'); |
| 191 | 183 | add_action('init', 'feedwordpress_check_for_magpie_fix'); |
| 192 | 184 | |
| 193 | - add_action('admin_menu', 'feedwordpress_add_post_edit_controls'); | |
| 194 | - add_action('save_post', 'feedwordpress_save_post_edit_controls'); | |
| 195 | - | |
| 196 | 185 | # Inbound XML-RPC update methods |
| 197 | 186 | add_filter('xmlrpc_methods', 'feedwordpress_xmlrpc_hook'); |
| 198 | 187 | |
| 199 | 188 | # Outbound XML-RPC ping reform |
| @@ -282,36 +271,14 @@ | ||
| 282 | 271 | endif; |
| 283 | 272 | } /* feedwordpress_auto_update () */ |
| 284 | 273 | |
| 285 | 274 | function feedwordpress_update_magic_url () { |
| 286 | - global $wpdb; | |
| 287 | - | |
| 288 | 275 | // Explicit update request in the HTTP request (e.g. from a cron job) |
| 289 | 276 | if (FeedWordPress::update_requested()) : |
| 290 | 277 | $feedwordpress =& new FeedWordPress; |
| 291 | 278 | $feedwordpress->update(FeedWordPress::update_requested_url()); |
| 292 | 279 | |
| 293 | - if (FEEDWORDPRESS_DEBUG and count($wpdb->queries) > 0) : | |
| 294 | - $mysqlTime = 0.0; | |
| 295 | - $byTime = array(); | |
| 296 | - foreach ($wpdb->queries as $query) : | |
| 297 | - $time = $query[1] * 1000000.0; | |
| 298 | - $mysqlTime += $query[1]; | |
| 299 | - if (!isset($byTime[$time])) : $byTime[$time] = array(); endif; | |
| 300 | - $byTime[$time][] = $query[0]. ' // STACK: ' . $query[2]; | |
| 301 | - endforeach; | |
| 302 | - krsort($byTime); | |
| 303 | - | |
| 304 | - foreach ($byTime as $time => $querySet) : | |
| 305 | - foreach ($querySet as $query) : | |
| 306 | - print "[".(sprintf('%4.4f', $time/1000.0)) . "ms] $query\n"; | |
| 307 | - endforeach; | |
| 308 | - endforeach; | |
| 309 | - echo "[feedwordpress] $wpdb->num_queries queries. $mysqlTime seconds in MySQL. Total of "; timer_stop(1); print " seconds."; | |
| 310 | - endif; | |
| 311 | - | |
| 312 | - | |
| 313 | - // Magic URL should return nothing but a 200 OK header packet | |
| 280 | + // Magic URL should return nothing but a 200 OK header packet | |
| 314 | 281 | // when successful. |
| 315 | 282 | exit; |
| 316 | 283 | endif; |
| 317 | 284 | } /* feedwordpress_magic_update_url () */ |
| @@ -637,9 +604,9 @@ | ||
| 637 | 604 | <?php |
| 638 | 605 | endif; |
| 639 | 606 | } /* function fwp_check_debug () */ |
| 640 | 607 | |
| 641 | -define('EXPECTED_MAGPIE_VERSION', '2010.0122'); | |
| 608 | +define('EXPECTED_MAGPIE_VERSION', '2009.0725'); | |
| 642 | 609 | function fwp_check_magpie () { |
| 643 | 610 | if (isset($_REQUEST['feedwordpress_magpie_fix'])) : |
| 644 | 611 | if ($_REQUEST['feedwordpress_magpie_fix']=='ignored') : |
| 645 | 612 | ?> |
| @@ -783,65 +750,8 @@ | ||
| 783 | 750 | endif; |
| 784 | 751 | endif; |
| 785 | 752 | } |
| 786 | 753 | |
| 787 | - function feedwordpress_add_post_edit_controls () { | |
| 788 | - add_meta_box('feedwordpress-post-controls', __('Syndication'), 'feedwordpress_post_edit_controls', 'post', 'side', 'high'); | |
| 789 | - } // function FeedWordPress::postEditControls | |
| 790 | - | |
| 791 | - function feedwordpress_post_edit_controls () { | |
| 792 | - global $post; | |
| 793 | - | |
| 794 | - $frozen_values = get_post_custom_values('_syndication_freeze_updates', $post->ID); | |
| 795 | - $frozen_post = (count($frozen_values) > 0 and 'yes' == $frozen_values[0]); | |
| 796 | - | |
| 797 | - if (is_syndicated($post->ID)) : | |
| 798 | - ?> | |
| 799 | - <p>This is a syndicated post, which originally appeared at | |
| 800 | - <cite><?php print wp_specialchars(get_syndication_source(NULL, $post->ID)); ?></cite>. | |
| 801 | - <a href="<?php print wp_specialchars(get_syndication_permalink($post->ID)); ?>">View original post</a>.</p> | |
| 802 | - | |
| 803 | - <p><input type="hidden" name="feedwordpress_noncename" id="feedwordpress_noncename" value="<?php print wp_create_nonce(plugin_basename(__FILE__)); ?>" /> | |
| 804 | - <label><input type="checkbox" name="freeze_updates" value="yes" <?php if ($frozen_post) : ?>checked="checked"<?php endif; ?> /> <strong>Manual editing.</strong> | |
| 805 | - If set, FeedWordPress will not overwrite the changes you make manually | |
| 806 | - to this post, if the syndicated content is updated on the | |
| 807 | - feed.</label></p> | |
| 808 | - <?php | |
| 809 | - else : | |
| 810 | - ?> | |
| 811 | - <p>This post was created locally at this website.</p> | |
| 812 | - <?php | |
| 813 | - endif; | |
| 814 | - } // function feedwordpress_post_edit_controls () */ | |
| 815 | - | |
| 816 | - function feedwordpress_save_post_edit_controls ( $post_id ) { | |
| 817 | - global $post; | |
| 818 | - | |
| 819 | - if (!isset($_POST['feedwordpress_noncename']) or !wp_verify_nonce($_POST['feedwordpress_noncename'], plugin_basename(__FILE__))) : | |
| 820 | - return $post_id; | |
| 821 | - endif; | |
| 822 | - | |
| 823 | - // Verify if this is an auto save routine. If it is our form has | |
| 824 | - // not been submitted, so we don't want to do anything. | |
| 825 | - if ( defined('DOING_AUTOSAVE') and DOING_AUTOSAVE ) : | |
| 826 | - return $post_id; | |
| 827 | - endif; | |
| 828 | - | |
| 829 | - // Check permissions | |
| 830 | - if ( !current_user_can( 'edit_'.$_POST['post_type'], $post_id) ) : | |
| 831 | - return $post_id; | |
| 832 | - endif; | |
| 833 | - | |
| 834 | - // OK, we're golden. Now let's save some data. | |
| 835 | - if (isset($_POST['freeze_updates'])) : | |
| 836 | - update_post_meta($post_id, '_syndication_freeze_updates', $_POST['freeze_updates']); | |
| 837 | - else : | |
| 838 | - delete_post_meta($post_id, '_syndication_freeze_updates'); | |
| 839 | - endif; | |
| 840 | - | |
| 841 | - return $_POST['freeze_updates']; | |
| 842 | - } // function feedwordpress_save_edit_controls | |
| 843 | - | |
| 844 | 754 | ################################################################################ |
| 845 | 755 | ## class FeedWordPress ######################################################### |
| 846 | 756 | ################################################################################ |
| 847 | 757 | |
| @@ -1109,10 +1019,8 @@ | ||
| 1109 | 1019 | ); |
| 1110 | 1020 | |
| 1111 | 1021 | if (is_string($override)) : |
| 1112 | 1022 | $ret = strtolower($override); |
| 1113 | - else : | |
| 1114 | - $ret = NULL; | |
| 1115 | 1023 | endif; |
| 1116 | 1024 | |
| 1117 | 1025 | if (!is_numeric($override) and !in_array($ret, $set[$what])) : |
| 1118 | 1026 | $ret = get_option('feedwordpress_unfamiliar_'.$what); |