Version Description
Download this release
Release Info
Developer | radgeek |
Plugin | FeedWordPress |
Version | 2010.0127 |
Comparing to | |
See all releases |
Code changes from version 2009.1112 to 2010.0127
- MagpieRSS-upgrade/rss.php +3 -3
- admin-ui.php +31 -3
- categories-page.php +0 -13
- feeds-page.php +36 -17
- feedwordpress.php +97 -5
- posts-page.php +161 -96
- readme.txt +2 -2
- syndicatedlink.class.php +25 -0
- syndicatedpost.class.php +51 -27
- updatedpostscontrol.class.php +53 -0
MagpieRSS-upgrade/rss.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Author: Kellan Elliot-McCrea <kellan@protest.net>
|
5 |
* WordPress development team <http://www.wordpress.org/>
|
6 |
* Charles Johnson <technophilia@radgeek.com>
|
7 |
-
* Version:
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
@@ -95,7 +95,7 @@ define('ATOM', 'Atom');
|
|
95 |
|
96 |
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version . '(+http://www.wordpress.org)');
|
97 |
|
98 |
-
$wp_encoding =
|
99 |
define('MAGPIE_OUTPUT_ENCODING', ($wp_encoding?$wp_encoding:'ISO-8859-1'));
|
100 |
|
101 |
################################################################################
|
@@ -1207,7 +1207,7 @@ endif;
|
|
1207 |
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
1208 |
\*=======================================================================*/
|
1209 |
|
1210 |
-
define('MAGPIE_VERSION', '
|
1211 |
|
1212 |
$MAGPIE_ERROR = "";
|
1213 |
|
4 |
* Author: Kellan Elliot-McCrea <kellan@protest.net>
|
5 |
* WordPress development team <http://www.wordpress.org/>
|
6 |
* Charles Johnson <technophilia@radgeek.com>
|
7 |
+
* Version: 2010.0122
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
95 |
|
96 |
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version . '(+http://www.wordpress.org)');
|
97 |
|
98 |
+
$wp_encoding = get_option('blog_charset', /*default=*/ 'ISO-8859-1');
|
99 |
define('MAGPIE_OUTPUT_ENCODING', ($wp_encoding?$wp_encoding:'ISO-8859-1'));
|
100 |
|
101 |
################################################################################
|
1207 |
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
1208 |
\*=======================================================================*/
|
1209 |
|
1210 |
+
define('MAGPIE_VERSION', '2010.0122');
|
1211 |
|
1212 |
$MAGPIE_ERROR = "";
|
1213 |
|
admin-ui.php
CHANGED
@@ -389,10 +389,33 @@ function fwp_tags_box ($tags, $object) {
|
|
389 |
|
390 |
$desc = "<p style=\"font-size:smaller;font-style:bold;margin:0\">Tag $object as...</p>";
|
391 |
|
392 |
-
if (fwp_test_wp_version(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
?>
|
394 |
-
|
395 |
-
|
396 |
<div class="jaxtag">
|
397 |
<div class="nojs-tags hide-if-js">
|
398 |
<p><?php _e('Add or remove tags'); ?></p>
|
@@ -581,6 +604,11 @@ settings page to set up how new posts <?php print $from_this_feed; ?> are assign
|
|
581 |
?>
|
582 |
<script type="text/javascript">
|
583 |
jQuery(document).ready( function($) {
|
|
|
|
|
|
|
|
|
|
|
584 |
<?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
|
585 |
// In case someone got here first...
|
586 |
jQuery('.postbox h3').unbind('click');
|
389 |
|
390 |
$desc = "<p style=\"font-size:smaller;font-style:bold;margin:0\">Tag $object as...</p>";
|
391 |
|
392 |
+
if (fwp_test_wp_version(FWP_SCHEMA_29)) : // WordPress 2.9+
|
393 |
+
print $desc;
|
394 |
+
$tax_name = 'post_tag';
|
395 |
+
$helps = __('Separate tags with commas.');
|
396 |
+
$box['title'] = __('Tags');
|
397 |
+
?>
|
398 |
+
<div class="tagsdiv" id="<?php echo $tax_name; ?>">
|
399 |
+
<div class="jaxtag">
|
400 |
+
<div class="nojs-tags hide-if-js">
|
401 |
+
<p><?php _e('Add or remove tags'); ?></p>
|
402 |
+
<textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(implode(",", $tags)); ?></textarea></div>
|
403 |
+
|
404 |
+
<div class="ajaxtag hide-if-no-js">
|
405 |
+
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
|
406 |
+
<div class="taghint"><?php _e('Add new tag'); ?></div>
|
407 |
+
<input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
|
408 |
+
<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
|
409 |
+
</div></div>
|
410 |
+
<p class="howto"><?php echo $helps; ?></p>
|
411 |
+
<div class="tagchecklist"></div>
|
412 |
+
</div>
|
413 |
+
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
|
414 |
+
<?php
|
415 |
+
elseif (fwp_test_wp_version(FWP_SCHEMA_28)) : // WordPress 2.8+
|
416 |
?>
|
417 |
+
<?php print $desc; ?>
|
418 |
+
<div class="tagsdiv" id="post_tag">
|
419 |
<div class="jaxtag">
|
420 |
<div class="nojs-tags hide-if-js">
|
421 |
<p><?php _e('Add or remove tags'); ?></p>
|
604 |
?>
|
605 |
<script type="text/javascript">
|
606 |
jQuery(document).ready( function($) {
|
607 |
+
<?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_29)) : ?>
|
608 |
+
if ( $('#post_tag').length ) {
|
609 |
+
tagBox.init();
|
610 |
+
}
|
611 |
+
<?php endif; ?>
|
612 |
<?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : ?>
|
613 |
// In case someone got here first...
|
614 |
jQuery('.postbox h3').unbind('click');
|
categories-page.php
CHANGED
@@ -260,19 +260,6 @@ function fwp_categories_page () {
|
|
260 |
</div> <!-- class="metabox-holder" -->
|
261 |
</div> <!-- id="post-body" -->
|
262 |
<?php $catsPage->close_sheet(); ?>
|
263 |
-
|
264 |
-
<script type="text/javascript">
|
265 |
-
contextual_appearance('unfamiliar-author', 'unfamiliar-author-newuser', 'unfamiliar-author-default', 'newuser', 'inline');
|
266 |
-
<?php if (is_object($link) and $link->found()) : ?>
|
267 |
-
<?php for ($j=1; $j<=$i; $j++) : ?>
|
268 |
-
contextual_appearance('author-rules-<?php echo $j; ?>', 'author-rules-<?php echo $j; ?>-newuser', 'author-rules-<?php echo $j; ?>-default', 'newuser', 'inline');
|
269 |
-
<?php endfor; ?>
|
270 |
-
contextual_appearance('add-author-rule', 'add-author-rule-newuser', 'add-author-rule-default', 'newuser', 'inline');
|
271 |
-
contextual_appearance('fix-mismatch-to', 'fix-mismatch-to-newuser', null, 'newuser', 'inline');
|
272 |
-
<?php else : ?>
|
273 |
-
contextual_appearance('match-author-by-email', 'unless-null-email', null, 'yes', 'block', /*checkbox=*/ true);
|
274 |
-
<?php endif; ?>
|
275 |
-
</script>
|
276 |
<?php
|
277 |
} /* function fwp_categories_page () */
|
278 |
|
260 |
</div> <!-- class="metabox-holder" -->
|
261 |
</div> <!-- id="post-body" -->
|
262 |
<?php $catsPage->close_sheet(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
<?php
|
264 |
} /* function fwp_categories_page () */
|
265 |
|
feeds-page.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
3 |
require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
|
4 |
require_once(dirname(__FILE__) . '/feedfinder.class.php');
|
|
|
5 |
|
6 |
class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
7 |
var $HTTPStatusMessages = array (
|
@@ -44,6 +45,7 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
|
44 |
504 => 'Gateway Timeout',
|
45 |
505 => 'HTTP Version Not Supported',
|
46 |
);
|
|
|
47 |
|
48 |
/**
|
49 |
* Constructs the Feeds page object
|
@@ -59,6 +61,7 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
|
59 |
|
60 |
$this->dispatch = get_class($this);
|
61 |
$this->filename = __FILE__;
|
|
|
62 |
} /* FeedWordPressFeedsPage constructor */
|
63 |
|
64 |
var $special_settings = array ( /* Regular expression syntax is OK here */
|
@@ -77,6 +80,8 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
|
77 |
'map authors',
|
78 |
'tags',
|
79 |
'postmeta',
|
|
|
|
|
80 |
'update/.*',
|
81 |
'feed/.*',
|
82 |
'link/.*',
|
@@ -130,6 +135,7 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
|
130 |
$boxes_by_methods = array(
|
131 |
'feed_information_box' => __('Feed Information'),
|
132 |
'global_feeds_box' => __('Update Scheduling'),
|
|
|
133 |
'posts_box' => __('Syndicated Posts, Links, Comments & Pings'),
|
134 |
'authors_box' => __('Syndicated Authors'),
|
135 |
'categories_box' => __('Categories'.FEEDWORDPRESS_AND_TAGS),
|
@@ -184,6 +190,14 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
|
184 |
return false; // Don't continue
|
185 |
} /* FeedWordPressFeedsPage::display() */
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
/*static*/ function global_feeds_box ($page, $box = NULL) {
|
188 |
global $wpdb;
|
189 |
|
@@ -695,6 +709,7 @@ contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
|
|
695 |
|
696 |
// User mashed a Save Changes button
|
697 |
if (isset($post['save']) or isset($post['submit'])) :
|
|
|
698 |
if ($this->for_feed_settings()) :
|
699 |
$alter = array ();
|
700 |
|
@@ -742,23 +757,6 @@ contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
|
|
742 |
endif;
|
743 |
endif;
|
744 |
|
745 |
-
$alter[] = "link_notes = '".$wpdb->escape($this->link->settings_to_notes())."'";
|
746 |
-
|
747 |
-
$alter_set = implode(", ", $alter);
|
748 |
-
|
749 |
-
// issue update query
|
750 |
-
$result = $wpdb->query("
|
751 |
-
UPDATE $wpdb->links
|
752 |
-
SET $alter_set
|
753 |
-
WHERE link_id='{$this->link->id}'
|
754 |
-
");
|
755 |
-
$this->updated = true;
|
756 |
-
|
757 |
-
// reload link information from DB
|
758 |
-
if (function_exists('clean_bookmark_cache')) :
|
759 |
-
clean_bookmark_cache($this->link->id);
|
760 |
-
endif;
|
761 |
-
$this->link = new SyndicatedLink($this->link->id);
|
762 |
else :
|
763 |
// Global
|
764 |
update_option('feedwordpress_cat_id', $post['syndication_category']);
|
@@ -786,6 +784,27 @@ contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
|
|
786 |
|
787 |
$this->updated = true;
|
788 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
|
790 |
// Probably a "Go" button for the drop-down
|
791 |
else :
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
3 |
require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
|
4 |
require_once(dirname(__FILE__) . '/feedfinder.class.php');
|
5 |
+
require_once(dirname(__FILE__) . '/updatedpostscontrol.class.php');
|
6 |
|
7 |
class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
|
8 |
var $HTTPStatusMessages = array (
|
45 |
504 => 'Gateway Timeout',
|
46 |
505 => 'HTTP Version Not Supported',
|
47 |
);
|
48 |
+
var $updatedPosts = NULL;
|
49 |
|
50 |
/**
|
51 |
* Constructs the Feeds page object
|
61 |
|
62 |
$this->dispatch = get_class($this);
|
63 |
$this->filename = __FILE__;
|
64 |
+
$this->updatedPosts = new UpdatedPostsControl($this);
|
65 |
} /* FeedWordPressFeedsPage constructor */
|
66 |
|
67 |
var $special_settings = array ( /* Regular expression syntax is OK here */
|
80 |
'map authors',
|
81 |
'tags',
|
82 |
'postmeta',
|
83 |
+
'resolve relative',
|
84 |
+
'freeze updates',
|
85 |
'update/.*',
|
86 |
'feed/.*',
|
87 |
'link/.*',
|
135 |
$boxes_by_methods = array(
|
136 |
'feed_information_box' => __('Feed Information'),
|
137 |
'global_feeds_box' => __('Update Scheduling'),
|
138 |
+
'updated_posts_box' => __('Updated Posts'),
|
139 |
'posts_box' => __('Syndicated Posts, Links, Comments & Pings'),
|
140 |
'authors_box' => __('Syndicated Authors'),
|
141 |
'categories_box' => __('Categories'.FEEDWORDPRESS_AND_TAGS),
|
190 |
return false; // Don't continue
|
191 |
} /* FeedWordPressFeedsPage::display() */
|
192 |
|
193 |
+
/*static*/ function updated_posts_box ($page, $box = NULL) {
|
194 |
+
?>
|
195 |
+
<table class="edit-form">
|
196 |
+
<?php $page->updatedPosts->display(); ?>
|
197 |
+
</table>
|
198 |
+
<?php
|
199 |
+
} /* FeedWordPressFeedsPage::updated_posts_box() */
|
200 |
+
|
201 |
/*static*/ function global_feeds_box ($page, $box = NULL) {
|
202 |
global $wpdb;
|
203 |
|
709 |
|
710 |
// User mashed a Save Changes button
|
711 |
if (isset($post['save']) or isset($post['submit'])) :
|
712 |
+
|
713 |
if ($this->for_feed_settings()) :
|
714 |
$alter = array ();
|
715 |
|
757 |
endif;
|
758 |
endif;
|
759 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
760 |
else :
|
761 |
// Global
|
762 |
update_option('feedwordpress_cat_id', $post['syndication_category']);
|
784 |
|
785 |
$this->updated = true;
|
786 |
endif;
|
787 |
+
$this->updatedPosts->accept_POST($post);
|
788 |
+
|
789 |
+
if ($this->for_feed_settings()) :
|
790 |
+
$alter[] = "link_notes = '".$wpdb->escape($this->link->settings_to_notes())."'";
|
791 |
+
|
792 |
+
$alter_set = implode(", ", $alter);
|
793 |
+
|
794 |
+
// issue update query
|
795 |
+
$result = $wpdb->query("
|
796 |
+
UPDATE $wpdb->links
|
797 |
+
SET $alter_set
|
798 |
+
WHERE link_id='{$this->link->id}'
|
799 |
+
");
|
800 |
+
$this->updated = true;
|
801 |
+
|
802 |
+
// reload link information from DB
|
803 |
+
if (function_exists('clean_bookmark_cache')) :
|
804 |
+
clean_bookmark_cache($this->link->id);
|
805 |
+
endif;
|
806 |
+
$this->link = new SyndicatedLink($this->link->id);
|
807 |
+
endif;
|
808 |
|
809 |
// Probably a "Go" button for the drop-down
|
810 |
else :
|
feedwordpress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://feedwordpress.radgeek.com/
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
-
Version:
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
@@ -28,7 +28,7 @@ License: GPL
|
|
28 |
|
29 |
# -- Don't change these unless you know what you're doing...
|
30 |
|
31 |
-
define ('FEEDWORDPRESS_VERSION', '
|
32 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
33 |
|
34 |
// Defaults
|
@@ -60,6 +60,7 @@ define ('FWP_SCHEMA_25', 7558); // Database schema # for WP 2.5
|
|
60 |
define ('FWP_SCHEMA_26', 8201); // Database schema # for WP 2.6
|
61 |
define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7
|
62 |
define ('FWP_SCHEMA_28', 11548); // Database schema # for WP 2.8
|
|
|
63 |
|
64 |
if (FEEDWORDPRESS_DEBUG) :
|
65 |
// Help us to pick out errors, if any.
|
@@ -122,11 +123,18 @@ else : // Something went wrong. Let's just guess.
|
|
122 |
$fwp_path = 'feedwordpress';
|
123 |
endif;
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
// If this is a FeedWordPress admin page, queue up scripts for AJAX functions that FWP uses
|
126 |
// If it is a display page or a non-FeedWordPress admin page, don't.
|
127 |
if (is_admin() and isset($_REQUEST['page']) and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])) :
|
128 |
if (function_exists('wp_enqueue_script')) :
|
129 |
-
if (
|
|
|
|
|
130 |
wp_enqueue_script('post'); // for magic tag and category boxes
|
131 |
wp_enqueue_script('thickbox'); // for fold-up boxes
|
132 |
wp_enqueue_script('admin-forms'); // for checkbox selection
|
@@ -182,6 +190,9 @@ if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
|
|
182 |
add_action('admin_notices', 'fwp_check_magpie');
|
183 |
add_action('init', 'feedwordpress_check_for_magpie_fix');
|
184 |
|
|
|
|
|
|
|
185 |
# Inbound XML-RPC update methods
|
186 |
add_filter('xmlrpc_methods', 'feedwordpress_xmlrpc_hook');
|
187 |
|
@@ -272,12 +283,34 @@ function feedwordpress_auto_update () {
|
|
272 |
} /* feedwordpress_auto_update () */
|
273 |
|
274 |
function feedwordpress_update_magic_url () {
|
|
|
|
|
275 |
// Explicit update request in the HTTP request (e.g. from a cron job)
|
276 |
if (FeedWordPress::update_requested()) :
|
277 |
$feedwordpress =& new FeedWordPress;
|
278 |
$feedwordpress->update(FeedWordPress::update_requested_url());
|
279 |
|
280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
// when successful.
|
282 |
exit;
|
283 |
endif;
|
@@ -605,7 +638,7 @@ for a production server.</p>
|
|
605 |
endif;
|
606 |
} /* function fwp_check_debug () */
|
607 |
|
608 |
-
define('EXPECTED_MAGPIE_VERSION', '
|
609 |
function fwp_check_magpie () {
|
610 |
if (isset($_REQUEST['feedwordpress_magpie_fix'])) :
|
611 |
if ($_REQUEST['feedwordpress_magpie_fix']=='ignored') :
|
@@ -751,6 +784,63 @@ function fwp_publish_post_hook ($post_id) {
|
|
751 |
endif;
|
752 |
}
|
753 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
################################################################################
|
755 |
## class FeedWordPress #########################################################
|
756 |
################################################################################
|
@@ -1020,6 +1110,8 @@ class FeedWordPress {
|
|
1020 |
|
1021 |
if (is_string($override)) :
|
1022 |
$ret = strtolower($override);
|
|
|
|
|
1023 |
endif;
|
1024 |
|
1025 |
if (!is_numeric($override) and !in_array($ret, $set[$what])) :
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://feedwordpress.radgeek.com/
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
+
Version: 2010.0127
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
28 |
|
29 |
# -- Don't change these unless you know what you're doing...
|
30 |
|
31 |
+
define ('FEEDWORDPRESS_VERSION', '2010.0127');
|
32 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
33 |
|
34 |
// Defaults
|
60 |
define ('FWP_SCHEMA_26', 8201); // Database schema # for WP 2.6
|
61 |
define ('FWP_SCHEMA_27', 9872); // Database schema # for WP 2.7
|
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 |
|
65 |
if (FEEDWORDPRESS_DEBUG) :
|
66 |
// Help us to pick out errors, if any.
|
123 |
$fwp_path = 'feedwordpress';
|
124 |
endif;
|
125 |
|
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 |
// If this is a FeedWordPress admin page, queue up scripts for AJAX functions that FWP uses
|
132 |
// If it is a display page or a non-FeedWordPress admin page, don't.
|
133 |
if (is_admin() and isset($_REQUEST['page']) and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])) :
|
134 |
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)) :
|
138 |
wp_enqueue_script('post'); // for magic tag and category boxes
|
139 |
wp_enqueue_script('thickbox'); // for fold-up boxes
|
140 |
wp_enqueue_script('admin-forms'); // for checkbox selection
|
190 |
add_action('admin_notices', 'fwp_check_magpie');
|
191 |
add_action('init', 'feedwordpress_check_for_magpie_fix');
|
192 |
|
193 |
+
add_action('admin_menu', 'feedwordpress_add_post_edit_controls');
|
194 |
+
add_action('save_post', 'feedwordpress_save_post_edit_controls');
|
195 |
+
|
196 |
# Inbound XML-RPC update methods
|
197 |
add_filter('xmlrpc_methods', 'feedwordpress_xmlrpc_hook');
|
198 |
|
283 |
} /* feedwordpress_auto_update () */
|
284 |
|
285 |
function feedwordpress_update_magic_url () {
|
286 |
+
global $wpdb;
|
287 |
+
|
288 |
// Explicit update request in the HTTP request (e.g. from a cron job)
|
289 |
if (FeedWordPress::update_requested()) :
|
290 |
$feedwordpress =& new FeedWordPress;
|
291 |
$feedwordpress->update(FeedWordPress::update_requested_url());
|
292 |
|
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
|
314 |
// when successful.
|
315 |
exit;
|
316 |
endif;
|
638 |
endif;
|
639 |
} /* function fwp_check_debug () */
|
640 |
|
641 |
+
define('EXPECTED_MAGPIE_VERSION', '2010.0122');
|
642 |
function fwp_check_magpie () {
|
643 |
if (isset($_REQUEST['feedwordpress_magpie_fix'])) :
|
644 |
if ($_REQUEST['feedwordpress_magpie_fix']=='ignored') :
|
784 |
endif;
|
785 |
}
|
786 |
|
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 |
################################################################################
|
845 |
## class FeedWordPress #########################################################
|
846 |
################################################################################
|
1110 |
|
1111 |
if (is_string($override)) :
|
1112 |
$ret = strtolower($override);
|
1113 |
+
else :
|
1114 |
+
$ret = NULL;
|
1115 |
endif;
|
1116 |
|
1117 |
if (!is_numeric($override) and !in_array($ret, $set[$what])) :
|
posts-page.php
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
<?php
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
|
|
3 |
|
4 |
class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
5 |
var $link = NULL;
|
|
|
6 |
|
7 |
/**
|
8 |
* Construct the posts page object.
|
@@ -13,8 +15,104 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
13 |
FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresspostspage', $link);
|
14 |
$this->dispatch = 'feedwordpress_posts_settings';
|
15 |
$this->filename = __FILE__;
|
|
|
16 |
} /* FeedWordPressPostsPage constructor */
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Outputs "Publication" settings box.
|
20 |
*
|
@@ -45,6 +143,8 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
45 |
if (SyndicatedPost::use_api('post_status_pending')) :
|
46 |
$setting['pending'] = array('label' => "Hold %s for review; mark as Pending", 'checked' => '');
|
47 |
endif;
|
|
|
|
|
48 |
if ($page->for_feed_settings()) :
|
49 |
$href = $fwp_path.'/'.basename(__FILE__);
|
50 |
$currently = str_replace('%s', '', strtolower(strtok($setting[$post_status_global]['label'], ';')));
|
@@ -80,7 +180,7 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
80 |
</style>
|
81 |
|
82 |
<table id="syndicated-publication-form" class="form-table" cellspacing="2" cellpadding="5">
|
83 |
-
<tr><th scope="row"
|
84 |
<td><ul class="options">
|
85 |
<?php foreach ($selector as $code => $li) : ?>
|
86 |
<li><label><input type="radio" name="feed_post_status"
|
@@ -89,6 +189,8 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
89 |
<?php endforeach; ?>
|
90 |
</ul></td>
|
91 |
</tr>
|
|
|
|
|
92 |
</table>
|
93 |
|
94 |
<?php
|
@@ -106,19 +208,57 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
106 |
* @uses fwp_option_box_closer()
|
107 |
*/
|
108 |
function formatting_box ($page, $box = NULL) {
|
109 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
?>
|
111 |
<table class="form-table" cellspacing="2" cellpadding="5">
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
</td></tr>
|
|
|
122 |
</table>
|
123 |
<?php
|
124 |
} /* FeedWordPressPostsPage::formatting_box() */
|
@@ -307,12 +447,14 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
|
307 |
|
308 |
function fwp_posts_page () {
|
309 |
global $wpdb, $wp_db_version;
|
310 |
-
|
|
|
311 |
if (FeedWordPress::needs_upgrade()) :
|
312 |
fwp_upgrade_page();
|
313 |
return;
|
314 |
endif;
|
315 |
|
|
|
316 |
FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_posts_settings', /*capability=*/ 'manage_links');
|
317 |
|
318 |
$link = FeedWordPressAdminPage::submitted_link();
|
@@ -322,92 +464,16 @@ function fwp_posts_page () {
|
|
322 |
$mesg = null;
|
323 |
|
324 |
////////////////////////////////////////////////
|
325 |
-
// Process POST request, if any
|
326 |
////////////////////////////////////////////////
|
327 |
-
if (
|
328 |
-
|
329 |
-
|
330 |
-
$mn['key0'] = trim($mn['key0']);
|
331 |
-
$mn['key1'] = trim($mn['key1']);
|
332 |
-
|
333 |
-
if (strlen($mn['key0']) > 0) :
|
334 |
-
unset($custom_settings[$mn['key0']]); // out with the old
|
335 |
-
endif;
|
336 |
-
|
337 |
-
if (($mn['action']=='update') and (strlen($mn['key1']) > 0)) :
|
338 |
-
$custom_settings[$mn['key1']] = $mn['value']; // in with the new
|
339 |
-
endif;
|
340 |
-
endforeach;
|
341 |
-
|
342 |
-
if (is_object($link) and $link->found()) :
|
343 |
-
$alter = array ();
|
344 |
-
|
345 |
-
$link->settings['postmeta'] = serialize($custom_settings);
|
346 |
-
|
347 |
-
// Post status, comment status, ping status
|
348 |
-
foreach (array('post', 'comment', 'ping') as $what) :
|
349 |
-
$sfield = "feed_{$what}_status";
|
350 |
-
if (isset($GLOBALS['fwp_post'][$sfield])) :
|
351 |
-
if ($GLOBALS['fwp_post'][$sfield]=='site-default') :
|
352 |
-
unset($link->settings["{$what} status"]);
|
353 |
-
else :
|
354 |
-
$link->settings["{$what} status"] = $GLOBALS['fwp_post'][$sfield];
|
355 |
-
endif;
|
356 |
-
endif;
|
357 |
-
endforeach;
|
358 |
-
|
359 |
-
$alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'";
|
360 |
-
|
361 |
-
$alter_set = implode(", ", $alter);
|
362 |
-
|
363 |
-
// issue update query
|
364 |
-
$result = $wpdb->query("
|
365 |
-
UPDATE $wpdb->links
|
366 |
-
SET $alter_set
|
367 |
-
WHERE link_id='$link_id'
|
368 |
-
");
|
369 |
-
$updated_link = true;
|
370 |
-
|
371 |
-
// reload link information from DB
|
372 |
-
if (function_exists('clean_bookmark_cache')) :
|
373 |
-
clean_bookmark_cache($link_id);
|
374 |
-
endif;
|
375 |
-
$link =& new SyndicatedLink($link_id);
|
376 |
-
else :
|
377 |
-
// update_option ...
|
378 |
-
if (isset($GLOBALS['fwp_post']['feed_post_status'])) :
|
379 |
-
update_option('feedwordpress_syndicated_post_status', $GLOBALS['fwp_post']['feed_post_status']);
|
380 |
-
endif;
|
381 |
-
|
382 |
-
update_option('feedwordpress_custom_settings', serialize($custom_settings));
|
383 |
-
|
384 |
-
update_option('feedwordpress_munge_permalink', $_REQUEST['munge_permalink']);
|
385 |
-
update_option('feedwordpress_use_aggregator_source_data', $_REQUEST['use_aggregator_source_data']);
|
386 |
-
update_option('feedwordpress_formatting_filters', $_REQUEST['formatting_filters']);
|
387 |
-
|
388 |
-
if (isset($_REQUEST['feed_comment_status']) and ($_REQUEST['feed_comment_status'] == 'open')) :
|
389 |
-
update_option('feedwordpress_syndicated_comment_status', 'open');
|
390 |
-
else :
|
391 |
-
update_option('feedwordpress_syndicated_comment_status', 'closed');
|
392 |
-
endif;
|
393 |
-
|
394 |
-
if (isset($_REQUEST['feed_ping_status']) and ($_REQUEST['feed_ping_status'] == 'open')) :
|
395 |
-
update_option('feedwordpress_syndicated_ping_status', 'open');
|
396 |
-
else :
|
397 |
-
update_option('feedwordpress_syndicated_ping_status', 'closed');
|
398 |
-
endif;
|
399 |
-
|
400 |
-
$updated_link = true;
|
401 |
-
endif;
|
402 |
-
|
403 |
-
do_action('feedwordpress_admin_page_posts_save', $GLOBALS['fwp_post'], $postsPage);
|
404 |
-
else :
|
405 |
-
$updated_link = false;
|
406 |
endif;
|
407 |
|
408 |
$postsPage->ajax_interface_js();
|
409 |
|
410 |
-
if ($
|
411 |
<div class="updated"><p>Syndicated posts settings updated.</p></div>
|
412 |
<?php elseif (!is_null($mesg)) : ?>
|
413 |
<div class="updated"><p><?php print wp_specialchars($mesg, 1); ?></p></div>
|
@@ -425,16 +491,15 @@ function fwp_posts_page () {
|
|
425 |
<div id="post-body">
|
426 |
<?php
|
427 |
$boxes_by_methods = array(
|
428 |
-
'publication_box' => __('
|
429 |
-
'formatting_box' => __('Formatting'),
|
430 |
'links_box' => __('Links'),
|
|
|
431 |
'comments_and_pings_box' => __('Comments & Pings'),
|
432 |
'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'),
|
433 |
);
|
434 |
|
435 |
// Feed-level settings don't exist for these.
|
436 |
if ($postsPage->for_feed_settings()) :
|
437 |
-
unset($boxes_by_methods['formatting_box']);
|
438 |
unset($boxes_by_methods['links_box']);
|
439 |
endif;
|
440 |
|
1 |
<?php
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
3 |
+
require_once(dirname(__FILE__) . '/updatedpostscontrol.class.php');
|
4 |
|
5 |
class FeedWordPressPostsPage extends FeedWordPressAdminPage {
|
6 |
var $link = NULL;
|
7 |
+
var $updatedPosts = NULL;
|
8 |
|
9 |
/**
|
10 |
* Construct the posts page object.
|
15 |
FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresspostspage', $link);
|
16 |
$this->dispatch = 'feedwordpress_posts_settings';
|
17 |
$this->filename = __FILE__;
|
18 |
+
$this->updatedPosts = new UpdatedPostsControl($this);
|
19 |
} /* FeedWordPressPostsPage constructor */
|
20 |
|
21 |
+
function accept_POST ($post) {
|
22 |
+
global $wpdb;
|
23 |
+
|
24 |
+
$link_id = $this->link->id;
|
25 |
+
|
26 |
+
// User mashed a Save Changes button
|
27 |
+
if (isset($post['save']) or isset($post['submit'])) :
|
28 |
+
// custom post settings
|
29 |
+
foreach ($post['notes'] as $mn) :
|
30 |
+
$mn['key0'] = trim($mn['key0']);
|
31 |
+
$mn['key1'] = trim($mn['key1']);
|
32 |
+
|
33 |
+
if (strlen($mn['key0']) > 0) :
|
34 |
+
unset($custom_settings[$mn['key0']]); // out with the old
|
35 |
+
endif;
|
36 |
+
|
37 |
+
if (($mn['action']=='update') and (strlen($mn['key1']) > 0)) :
|
38 |
+
$custom_settings[$mn['key1']] = $mn['value']; // in with the new
|
39 |
+
endif;
|
40 |
+
endforeach;
|
41 |
+
|
42 |
+
$this->updatedPosts->accept_POST($post);
|
43 |
+
if ($this->for_feed_settings()) :
|
44 |
+
$alter = array ();
|
45 |
+
|
46 |
+
$this->link->settings['postmeta'] = serialize($custom_settings);
|
47 |
+
|
48 |
+
if (isset($post['resolve_relative'])) :
|
49 |
+
$this->link->settings['resolve relative'] = $post['resolve_relative'];
|
50 |
+
endif;
|
51 |
+
|
52 |
+
// Post status, comment status, ping status
|
53 |
+
foreach (array('post', 'comment', 'ping') as $what) :
|
54 |
+
$sfield = "feed_{$what}_status";
|
55 |
+
if (isset($post[$sfield])) :
|
56 |
+
if ($post[$sfield]=='site-default') :
|
57 |
+
unset($this->link->settings["{$what} status"]);
|
58 |
+
else :
|
59 |
+
$this->link->settings["{$what} status"] = $post[$sfield];
|
60 |
+
endif;
|
61 |
+
endif;
|
62 |
+
endforeach;
|
63 |
+
|
64 |
+
$alter[] = "link_notes = '".$wpdb->escape($this->link->settings_to_notes())."'";
|
65 |
+
$alter_set = implode(", ", $alter);
|
66 |
+
|
67 |
+
// issue update query
|
68 |
+
$result = $wpdb->query("
|
69 |
+
UPDATE $wpdb->links
|
70 |
+
SET $alter_set
|
71 |
+
WHERE link_id='$link_id'
|
72 |
+
");
|
73 |
+
$this->updated = true;
|
74 |
+
|
75 |
+
// reload link information from DB
|
76 |
+
if (function_exists('clean_bookmark_cache')) :
|
77 |
+
clean_bookmark_cache($link_id);
|
78 |
+
endif;
|
79 |
+
$link =& new SyndicatedLink($link_id);
|
80 |
+
else :
|
81 |
+
// update_option ...
|
82 |
+
if (isset($post['feed_post_status'])) :
|
83 |
+
update_option('feedwordpress_syndicated_post_status', $post['feed_post_status']);
|
84 |
+
endif;
|
85 |
+
|
86 |
+
update_option('feedwordpress_custom_settings', serialize($custom_settings));
|
87 |
+
|
88 |
+
update_option('feedwordpress_munge_permalink', $_REQUEST['munge_permalink']);
|
89 |
+
update_option('feedwordpress_use_aggregator_source_data', $_REQUEST['use_aggregator_source_data']);
|
90 |
+
update_option('feedwordpress_formatting_filters', $_REQUEST['formatting_filters']);
|
91 |
+
|
92 |
+
if (isset($post['resolve_relative'])) :
|
93 |
+
update_option('feedwordpress_resolve_relative', $post['resolve_relative']);
|
94 |
+
endif;
|
95 |
+
if (isset($_REQUEST['feed_comment_status']) and ($_REQUEST['feed_comment_status'] == 'open')) :
|
96 |
+
update_option('feedwordpress_syndicated_comment_status', 'open');
|
97 |
+
else :
|
98 |
+
update_option('feedwordpress_syndicated_comment_status', 'closed');
|
99 |
+
endif;
|
100 |
+
|
101 |
+
if (isset($_REQUEST['feed_ping_status']) and ($_REQUEST['feed_ping_status'] == 'open')) :
|
102 |
+
update_option('feedwordpress_syndicated_ping_status', 'open');
|
103 |
+
else :
|
104 |
+
update_option('feedwordpress_syndicated_ping_status', 'closed');
|
105 |
+
endif;
|
106 |
+
|
107 |
+
$this->updated = true;
|
108 |
+
endif;
|
109 |
+
|
110 |
+
// Probably a "Go" button for the drop-down
|
111 |
+
else :
|
112 |
+
$this->updated = false;
|
113 |
+
endif;
|
114 |
+
}
|
115 |
+
|
116 |
/**
|
117 |
* Outputs "Publication" settings box.
|
118 |
*
|
143 |
if (SyndicatedPost::use_api('post_status_pending')) :
|
144 |
$setting['pending'] = array('label' => "Hold %s for review; mark as Pending", 'checked' => '');
|
145 |
endif;
|
146 |
+
|
147 |
+
|
148 |
if ($page->for_feed_settings()) :
|
149 |
$href = $fwp_path.'/'.basename(__FILE__);
|
150 |
$currently = str_replace('%s', '', strtolower(strtok($setting[$post_status_global]['label'], ';')));
|
180 |
</style>
|
181 |
|
182 |
<table id="syndicated-publication-form" class="form-table" cellspacing="2" cellpadding="5">
|
183 |
+
<tr><th scope="row"><?php _e('New posts:'); ?></th>
|
184 |
<td><ul class="options">
|
185 |
<?php foreach ($selector as $code => $li) : ?>
|
186 |
<li><label><input type="radio" name="feed_post_status"
|
189 |
<?php endforeach; ?>
|
190 |
</ul></td>
|
191 |
</tr>
|
192 |
+
|
193 |
+
<?php $page->updatedPosts->display(); ?>
|
194 |
</table>
|
195 |
|
196 |
<?php
|
208 |
* @uses fwp_option_box_closer()
|
209 |
*/
|
210 |
function formatting_box ($page, $box = NULL) {
|
211 |
+
global $fwp_path;
|
212 |
+
$thesePosts = $page->these_posts_phrase();
|
213 |
+
$global_resolve_relative = get_option('feedwordpress_resolve_relative', 'yes');
|
214 |
+
if ($page->for_feed_settings()) :
|
215 |
+
$formatting_filters = null;
|
216 |
+
$resolve_relative = $page->link->setting('resolve relative', NULL, 'default');
|
217 |
+
$url = preg_replace('|/+$|', '', $page->link->homepage());
|
218 |
+
$setting = array(
|
219 |
+
'yes' => __('resolve relative URIs'),
|
220 |
+
'no' => __('leave relative URIs unresolved'),
|
221 |
+
);
|
222 |
+
$href = $fwp_path.'/'.basename(__FILE__);
|
223 |
+
else :
|
224 |
+
$formatting_filters = get_option('feedwordpress_formatting_filters', 'no');
|
225 |
+
$resolve_relative = $global_resolve_relative;
|
226 |
+
$url = 'http://example.com';
|
227 |
+
endif;
|
228 |
?>
|
229 |
<table class="form-table" cellspacing="2" cellpadding="5">
|
230 |
+
<?php if (!is_null($formatting_filters)) : ?>
|
231 |
+
|
232 |
+
<tr><th scope="row">Formatting filters:</th>
|
233 |
+
<td><select name="formatting_filters" size="1">
|
234 |
+
<option value="no"<?php echo ($formatting_filters!='yes')?' selected="selected"':''; ?>>Protect syndicated posts from formatting filters</option>
|
235 |
+
<option value="yes"<?php echo ($formatting_filters=='yes')?' selected="selected"':''; ?>>Expose syndicated posts to formatting filters</option>
|
236 |
+
</select>
|
237 |
+
<p class="setting-description">If you have trouble getting plugins to work that are supposed to insert
|
238 |
+
elements after posts (like relevant links or a social networking
|
239 |
+
<q>Share This</q> button), try changing this option to see if it fixes your
|
240 |
+
problem.</p>
|
241 |
+
</td></tr>
|
242 |
+
|
243 |
+
<?php endif; ?>
|
244 |
+
|
245 |
+
<tr><th scope="row">Relative URIs:</th>
|
246 |
+
<td>If link or image in a syndicated post from <code><?php print $url; ?></code>
|
247 |
+
refers to a partial URI like <code>/about</code>, where should
|
248 |
+
the syndicated copy point to?</p>
|
249 |
+
|
250 |
+
<ul>
|
251 |
+
<?php if ($page->for_feed_settings()) : ?>
|
252 |
+
<li><p><label><input type="radio" name="resolve_relative" value='default' <?php echo ($resolve_relative=='default')?' checked="checked"':''; ?>/> Use <a href="admin.php?page=<?php print $href; ?>">site-wide setting</a><br/>
|
253 |
+
<small style="margin-left: 2.0em;">Currently: <strong><?php print $setting[$global_resolve_relative]; ?></strong></small></label></p></li>
|
254 |
+
<?php endif; ?>
|
255 |
+
<li><p><label><input type="radio" name="resolve_relative" value="yes"<?php echo ($resolve_relative!='no' and $resolve_relative!='default')?' checked="checked"':''; ?>/> Resolve the URI so it points to <code><?php print $url; ?></code><br/>
|
256 |
+
<small style="margin-left: 2.0em;"><code>/contact</code> is rewritten as <code><?php print $url; ?>/contact</code></label></small></p></li>
|
257 |
+
<li><p><label><input type="radio" name="resolve_relative" value="no"<?php echo ($resolve_relative=='no')?' checked="checked"':''; ?>/> Leave relative URIs unchanged, so they point to this site<br/>
|
258 |
+
<small style="margin-left: 2.0em;"><code>/contact</code> is left as <code>/contact</code></small></label></li>
|
259 |
+
</ul>
|
260 |
</td></tr>
|
261 |
+
|
262 |
</table>
|
263 |
<?php
|
264 |
} /* FeedWordPressPostsPage::formatting_box() */
|
447 |
|
448 |
function fwp_posts_page () {
|
449 |
global $wpdb, $wp_db_version;
|
450 |
+
global $fwp_post;
|
451 |
+
|
452 |
if (FeedWordPress::needs_upgrade()) :
|
453 |
fwp_upgrade_page();
|
454 |
return;
|
455 |
endif;
|
456 |
|
457 |
+
// If this is a POST, validate source and user credentials
|
458 |
FeedWordPressCompatibility::validate_http_request(/*action=*/ 'feedwordpress_posts_settings', /*capability=*/ 'manage_links');
|
459 |
|
460 |
$link = FeedWordPressAdminPage::submitted_link();
|
464 |
$mesg = null;
|
465 |
|
466 |
////////////////////////////////////////////////
|
467 |
+
// Process POST request, if any ////////////////
|
468 |
////////////////////////////////////////////////
|
469 |
+
if (strtoupper($_SERVER['REQUEST_METHOD'])=='POST') :
|
470 |
+
$postsPage->accept_POST($fwp_post);
|
471 |
+
do_action('feedwordpress_admin_page_posts_save', $fwp_post, $postsPage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
endif;
|
473 |
|
474 |
$postsPage->ajax_interface_js();
|
475 |
|
476 |
+
if ($postsPage->updated) : ?>
|
477 |
<div class="updated"><p>Syndicated posts settings updated.</p></div>
|
478 |
<?php elseif (!is_null($mesg)) : ?>
|
479 |
<div class="updated"><p><?php print wp_specialchars($mesg, 1); ?></p></div>
|
491 |
<div id="post-body">
|
492 |
<?php
|
493 |
$boxes_by_methods = array(
|
494 |
+
'publication_box' => __('Syndicated Posts'),
|
|
|
495 |
'links_box' => __('Links'),
|
496 |
+
'formatting_box' => __('Formatting'),
|
497 |
'comments_and_pings_box' => __('Comments & Pings'),
|
498 |
'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'),
|
499 |
);
|
500 |
|
501 |
// Feed-level settings don't exist for these.
|
502 |
if ($postsPage->for_feed_settings()) :
|
|
|
503 |
unset($boxes_by_methods['links_box']);
|
504 |
endif;
|
505 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Charles Johnson
|
|
3 |
Donate link: http://feedwordpress.radgeek.com/
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 1.5
|
6 |
-
Tested up to: 2.
|
7 |
-
Stable tag:
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
3 |
Donate link: http://feedwordpress.radgeek.com/
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 1.5
|
6 |
+
Tested up to: 2.9.1
|
7 |
+
Stable tag: 2010.0127
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
syndicatedlink.class.php
CHANGED
@@ -382,6 +382,31 @@ class SyndicatedLink {
|
|
382 |
endif;
|
383 |
} /* SyndicatedLink::save_settings () */
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
function uri () {
|
386 |
return (is_object($this->link) ? $this->link->link_rss : NULL);
|
387 |
} /* SyndicatedLink::uri () */
|
382 |
endif;
|
383 |
} /* SyndicatedLink::save_settings () */
|
384 |
|
385 |
+
/**
|
386 |
+
* Retrieves the value of a setting, allowing for a global setting to be
|
387 |
+
* used as a fallback, or a constant value, or both.
|
388 |
+
*
|
389 |
+
* @param string $name The link setting key
|
390 |
+
* @param mixed $fallback_global If the link setting is nonexistent or marked as a use-default value, fall back to the value of this global setting.
|
391 |
+
* @param mixed $fallback_value If the link setting and the global setting are nonexistent or marked as a use-default value, fall back to this constant value.
|
392 |
+
* @return bool TRUE on success, FALSE on failure.
|
393 |
+
*/
|
394 |
+
function setting ($name, $fallback_global = NULL, $fallback_value = NULL) {
|
395 |
+
$ret = NULL;
|
396 |
+
if (isset($this->settings[$name])) :
|
397 |
+
$ret = $this->settings[$name];
|
398 |
+
endif;
|
399 |
+
|
400 |
+
if ((is_null($ret) or strtolower($ret)=='default') and !is_null($fallback_global)) :
|
401 |
+
$ret = get_option('feedwordpress_'.$fallback_global, /*default=*/ NULL);
|
402 |
+
endif;
|
403 |
+
|
404 |
+
if ((is_null($ret) or strtolower($ret)=='default') and !is_null($fallback_value)) :
|
405 |
+
$ret = $fallback_value;
|
406 |
+
endif;
|
407 |
+
return $ret;
|
408 |
+
} /* SyndicatedLink::setting () */
|
409 |
+
|
410 |
function uri () {
|
411 |
return (is_object($this->link) ? $this->link->link_rss : NULL);
|
412 |
} /* SyndicatedLink::uri () */
|
syndicatedpost.class.php
CHANGED
@@ -180,8 +180,12 @@ class SyndicatedPost {
|
|
180 |
endif;
|
181 |
|
182 |
// Store information to identify the feed that this came from
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
185 |
|
186 |
if (isset($this->item['source_link_self'])) :
|
187 |
$this->post['meta']['syndication_feed_original'] = $this->item['source_link_self'];
|
@@ -285,11 +289,28 @@ class SyndicatedPost {
|
|
285 |
|
286 |
$last_rev_ts = gmmktime($backref[4], $backref[5], $backref[6], $backref[2], $backref[3], $backref[1]);
|
287 |
$updated_ts = $this->updated(/*fallback=*/ true, /*default=*/ NULL);
|
288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
!is_null($updated_ts)
|
290 |
and ($updated_ts > $last_rev_ts)
|
291 |
-
)
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
if ($updated) :
|
294 |
$this->_freshness = 1; // Updated content
|
295 |
$this->_wp_id = $result->id;
|
@@ -371,14 +392,14 @@ class SyndicatedPost {
|
|
371 |
// The item has not yet been added. So let's add it.
|
372 |
$this->insert_new();
|
373 |
$this->add_rss_meta();
|
374 |
-
do_action('post_syndicated_item', $this->wp_id());
|
375 |
|
376 |
$ret = 'new';
|
377 |
elseif (!$this->filtered() and $freshness == 1) :
|
378 |
$this->post['ID'] = $this->wp_id();
|
379 |
$this->update_existing();
|
380 |
$this->add_rss_meta();
|
381 |
-
do_action('update_syndicated_item', $this->wp_id());
|
382 |
|
383 |
$ret = 'updated';
|
384 |
else :
|
@@ -723,8 +744,8 @@ class SyndicatedPost {
|
|
723 |
|
724 |
$a = $this->author();
|
725 |
$author = $a['name'];
|
726 |
-
$email = $a['email'];
|
727 |
-
$url = $a['uri'];
|
728 |
|
729 |
$match_author_by_email = !('yes' == get_option("feedwordpress_do_not_match_author_by_email"));
|
730 |
if ($match_author_by_email and !FeedWordPress::is_null_email($email)) :
|
@@ -1227,24 +1248,27 @@ class SyndicatedPost {
|
|
1227 |
} /* function SyndicatedPost::resolve_single_relative_uri() */
|
1228 |
|
1229 |
function resolve_relative_uris ($content, $obj) {
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
$pattern,
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
|
|
|
|
|
|
1248 |
return $content;
|
1249 |
} /* function SyndicatedPost::resolve_relative_uris () */
|
1250 |
|
180 |
endif;
|
181 |
|
182 |
// Store information to identify the feed that this came from
|
183 |
+
if (isset($this->feedmeta['link/uri'])) :
|
184 |
+
$this->post['meta']['syndication_feed'] = $this->feedmeta['link/uri'];
|
185 |
+
endif;
|
186 |
+
if (isset($this->feedmeta['link/id'])) :
|
187 |
+
$this->post['meta']['syndication_feed_id'] = $this->feedmeta['link/id'];
|
188 |
+
endif;
|
189 |
|
190 |
if (isset($this->item['source_link_self'])) :
|
191 |
$this->post['meta']['syndication_feed_original'] = $this->item['source_link_self'];
|
289 |
|
290 |
$last_rev_ts = gmmktime($backref[4], $backref[5], $backref[6], $backref[2], $backref[3], $backref[1]);
|
291 |
$updated_ts = $this->updated(/*fallback=*/ true, /*default=*/ NULL);
|
292 |
+
|
293 |
+
$frozen_values = get_post_custom_values('_syndication_freeze_updates', $result->id);
|
294 |
+
$frozen_post = (count($frozen_values) > 0 and 'yes' == $frozen_values[0]);
|
295 |
+
$frozen_feed = ('yes' == $this->link->setting('freeze updates', 'freeze_updates', NULL));
|
296 |
+
|
297 |
+
// Check timestamps...
|
298 |
+
$updated = (
|
299 |
!is_null($updated_ts)
|
300 |
and ($updated_ts > $last_rev_ts)
|
301 |
+
);
|
302 |
+
|
303 |
+
|
304 |
+
// Or the hash...
|
305 |
+
$updated = ($updated or $update_hash_changed);
|
306 |
+
|
307 |
+
// But only if the post is not frozen.
|
308 |
+
$updated = (
|
309 |
+
$updated
|
310 |
+
and !$frozen_post
|
311 |
+
and !$frozen_feed
|
312 |
+
);
|
313 |
+
|
314 |
if ($updated) :
|
315 |
$this->_freshness = 1; // Updated content
|
316 |
$this->_wp_id = $result->id;
|
392 |
// The item has not yet been added. So let's add it.
|
393 |
$this->insert_new();
|
394 |
$this->add_rss_meta();
|
395 |
+
do_action('post_syndicated_item', $this->wp_id(), $this);
|
396 |
|
397 |
$ret = 'new';
|
398 |
elseif (!$this->filtered() and $freshness == 1) :
|
399 |
$this->post['ID'] = $this->wp_id();
|
400 |
$this->update_existing();
|
401 |
$this->add_rss_meta();
|
402 |
+
do_action('update_syndicated_item', $this->wp_id(), $this);
|
403 |
|
404 |
$ret = 'updated';
|
405 |
else :
|
744 |
|
745 |
$a = $this->author();
|
746 |
$author = $a['name'];
|
747 |
+
$email = (isset($a['email']) ? $a['email'] : NULL);
|
748 |
+
$url = (isset($a['uri']) ? $a['uri'] : NULL);
|
749 |
|
750 |
$match_author_by_email = !('yes' == get_option("feedwordpress_do_not_match_author_by_email"));
|
751 |
if ($match_author_by_email and !FeedWordPress::is_null_email($email)) :
|
1248 |
} /* function SyndicatedPost::resolve_single_relative_uri() */
|
1249 |
|
1250 |
function resolve_relative_uris ($content, $obj) {
|
1251 |
+
$set = $obj->link->setting('resolve relative', 'resolve_relative', 'yes');
|
1252 |
+
if ($set and $set != 'no') :
|
1253 |
+
# The MagpieRSS upgrade has some `xml:base` support baked in.
|
1254 |
+
# However, sometimes people do silly things, like putting
|
1255 |
+
# relative URIs out on a production RSS 2.0 feed or other feeds
|
1256 |
+
# with no good support for `xml:base`. So we'll do our best to
|
1257 |
+
# try to catch any remaining relative URIs and resolve them as
|
1258 |
+
# best we can.
|
1259 |
+
$obj->_base = $obj->item['link']; // Reset the base for resolving relative URIs
|
1260 |
+
|
1261 |
+
foreach ($obj->uri_attrs as $pair) :
|
1262 |
+
list($tag, $attr) = $pair;
|
1263 |
+
$pattern = FeedWordPressHTML::attributeRegex($tag, $attr);
|
1264 |
+
$content = preg_replace_callback (
|
1265 |
+
$pattern,
|
1266 |
+
array(&$obj, 'resolve_single_relative_uri'),
|
1267 |
+
$content
|
1268 |
+
);
|
1269 |
+
endforeach;
|
1270 |
+
endif;
|
1271 |
+
|
1272 |
return $content;
|
1273 |
} /* function SyndicatedPost::resolve_relative_uris () */
|
1274 |
|
updatedpostscontrol.class.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class UpdatedPostsControl {
|
3 |
+
var $page;
|
4 |
+
function UpdatedPostsControl ($page) {
|
5 |
+
$this->page =& $page;
|
6 |
+
} /* UpdatedPostsControl constructor */
|
7 |
+
|
8 |
+
function display () {
|
9 |
+
$setting = array(
|
10 |
+
'yes' => 'leave unmodified',
|
11 |
+
'no' => 'update to match',
|
12 |
+
);
|
13 |
+
|
14 |
+
$global_freeze_updates = get_option('feedwordpress_freeze_updates', 'no');
|
15 |
+
if ($this->page->for_feed_settings()) :
|
16 |
+
$aFeed = 'this feed';
|
17 |
+
$freeze_updates = $this->page->link->setting('freeze updates', NULL, 'default');
|
18 |
+
else :
|
19 |
+
$aFeed = 'a syndicated feed';
|
20 |
+
$freeze_updates = $global_freeze_updates;
|
21 |
+
endif;
|
22 |
+
?>
|
23 |
+
<tr>
|
24 |
+
<th scope="row"><?php _e('Updated posts:') ?></th>
|
25 |
+
<td><p>When <?php print $aFeed; ?> includes updated content for
|
26 |
+
a post that was already syndicated, should the syndicated copy
|
27 |
+
of the post be updated to match the revised version?</p>
|
28 |
+
<ul>
|
29 |
+
<?php if ($this->page->for_feed_settings()) : ?>
|
30 |
+
<li><label><input type="radio" name="freeze_updates" value="default" <?php print ($freeze_updates=='default') ? 'checked="checked"':'' ?> /> Use the <a href="admin.php?page=<?php print $GLOBALS['fwp_path'] ?>/<?php print basename(__FILE__); ?>">site-wide setting</a> (currently: <strong><?php print $setting[$global_freeze_updates]; ?></strong>)</label></li>
|
31 |
+
<?php endif; ?>
|
32 |
+
<li><label><input type="radio" name="freeze_updates" value="no" <?php print ($freeze_updates!='yes' and $freeze_updates!='default') ? 'checked="checked"':'' ?> /> Yes, update the syndicated copy to match</label></li>
|
33 |
+
<li><label><input type="radio" name="freeze_updates" value="yes" <?php print ($freeze_updates=='yes') ? 'checked="checked"':'' ?> /> No, leave the syndicated copy unmodified</label></li>
|
34 |
+
</ul></td>
|
35 |
+
</tr>
|
36 |
+
<?php
|
37 |
+
} /* UpdatedPostsControl::display() */
|
38 |
+
|
39 |
+
function accept_POST ($post) {
|
40 |
+
if ($this->page->for_feed_settings()) :
|
41 |
+
if (isset($post['freeze_updates'])) :
|
42 |
+
$this->page->link->settings['freeze updates'] = $post['freeze_updates'];
|
43 |
+
endif;
|
44 |
+
else :
|
45 |
+
// Updated posts
|
46 |
+
if (isset($post['freeze_updates'])) :
|
47 |
+
update_option('feedwordpress_freeze_updates', $post['freeze_updates']);
|
48 |
+
endif;
|
49 |
+
endif;
|
50 |
+
} /* UpdatedPostsControl::accept_POST() */
|
51 |
+
} /* class UpdatedPostsControl */
|
52 |
+
|
53 |
+
|