submitted_link(); endif; parent::__construct('feedwordpresspostspage', $link); $this->dispatch = 'feedwordpress_admin_page_posts'; $this->filename = __FILE__; $this->updatedPosts = new UpdatedPostsControl($this); $this->pagenames = array( 'default' => 'Posts', 'settings-update' => 'Syndicated posts', 'open-sheet' => 'Syndicated Posts & Links', ); } /* FeedWordPressPostsPage constructor */ function save_settings () { // custom post settings $custom_settings = $this->custom_post_settings(); $posted_notes = FeedWordPress::post( 'notes', array(), 'text' ); foreach ( $posted_notes as $mn ) : if ( isset( $mn['key0'] ) ) : $mn['key0'] = trim( $mn['key0'] ); if ( strlen( $mn['key0'] ) > 0 ) : unset( $custom_settings[ $mn['key0'] ] ); // out with the old endif; endif; if ( isset( $mn['key1'] ) ) : $mn['key1'] = trim( $mn['key1'] ); if ( ( $mn['action']=='update' ) and ( strlen( $mn['key1'] ) > 0 ) ) : $custom_settings[ $mn['key1'] ] = $mn['value']; // in with the new endif; endif; endforeach; $this->updatedPosts->accept_POST(); if ($this->for_feed_settings()) : // $alter = array(); // this appears elsewhere, too, also unused, and possibly removed as well (gwyneth 20230920) $this->link->settings['postmeta'] = serialize($custom_settings); if ( ! is_null( FeedWordPress::post( 'resolve_relative', null ) ) ) : $this->link->settings['resolve relative'] = FeedWordPress::post( 'resolve_relative', null, 'text' ); endif; if ( ! is_null( FeedWordPress::post('munge_permalink', null, 'text' ) ) ) : $this->link->settings['munge permalink'] = FeedWordPress::post( 'munge_permalink', null, 'text' ); endif; if ( ! is_null( FeedWordPress::post('munge_comments_feed_links', null, 'text' ) ) ) : $this->link->settings['munge comments feed links'] = FeedWordPress::post( 'munge_comments_feed_links', null, 'text' ); endif; // Post status, comment status, ping status foreach (array('post', 'comment', 'ping') as $what) : $sfield = "feed_{$what}_status"; if ( ! is_null( FeedWordPress::post( $sfield, null, 'text' ) ) ) : $afield = sprintf( '%s status', $what ); if ( FeedWordPress::post( $sfield, null, 'text' ) == 'site-default' ) : unset($this->link->settings[ $afield ]); else : $this->link->settings[ $afield ] = FeedWordPress::post( $sfield, null, 'text' ); endif; endif; endforeach; if ( ! is_null( FeedWordPress::post('syndicated_post_type', null, 'text' ) ) ) : if ( FeedWordPress::post( 'syndicated_post_type', null, 'text' ) == 'default' ) : unset($this->link->settings['syndicated post type']); else : $this->link->settings['syndicated post type'] = FeedWordPress::post( 'syndicated_post_type', null, 'text' ); endif; endif; else : // update_option ... if ( ! is_null( FeedWordPress::post( 'feed_post_status', null ) ) ) : update_option('feedwordpress_syndicated_post_status', FeedWordPress::post( 'feed_post_status', null, 'text' ) ); endif; update_option('feedwordpress_custom_settings', serialize($custom_settings)); $sMungePermalink = FeedWordPress::post('munge_permalink', null, 'text' ); $sUseAggregatorSourceData = FeedWordPress::post( 'use_aggregator_source_data', null, 'text' ); $sFormattingFilters = FeedWordPress::post('formatting_filters', null, 'text' ); $sFeedCommentStatus = FeedWordPress::post( 'feed_comment_status', '', 'text' ); $sFeedPingStatus = FeedWordPress::post( 'feed_ping_status', '', 'text' ); $sResolveRelative = FeedWordPress::post( 'resolve_relative', null, 'text' ); $sMungeCommentsFeedLinks = FeedWordPress::post( 'munge_comments_feed_links', null, 'text' ); $sSyndicatedPostType = FeedWordPress::post( 'syndicated_post_type', null, 'text' ); update_option('feedwordpress_munge_permalink', $sMungePermalink); update_option('feedwordpress_use_aggregator_source_data', $sUseAggregatorSourceData); update_option('feedwordpress_formatting_filters', $sFormattingFilters); if ( ! is_null( $sResolveRelative ) ) : update_option('feedwordpress_resolve_relative', $sResolveRelative ); endif; if ( ! is_null( $sMungeCommentsFeedLinks ) ) : update_option('feedwordpress_munge_comments_feed_links', $sMungeCommentsFeedLinks ); endif; if ( $sFeedCommentStatus == 'open' ) : update_option('feedwordpress_syndicated_comment_status', 'open'); else : update_option('feedwordpress_syndicated_comment_status', 'closed'); endif; if ( $sFeedPingStatus == 'open' ) : update_option('feedwordpress_syndicated_ping_status', 'open'); else : update_option('feedwordpress_syndicated_ping_status', 'closed'); endif; if ( ! is_null( $sSyndicatedPostType ) ) : update_option('feedwordpress_syndicated_post_type', $sSyndicatedPostType ); endif; endif; $boilerplate = FeedWordPress::post( 'boilerplate', array(), 'raw' ); if ( count($boilerplate) > 0 ) : foreach ( $boilerplate as $index => $line) : if ( 0 == strlen( trim( $line['template'] ) ) ) : unset( $boilerplate[$index] ); endif; endforeach; // Convert indexes to 0..(N-1) to avoid possible collisions $boilerplate = array_values( $boilerplate ); if ($this->for_feed_settings()) : $this->link->settings['boilerplate rules'] = serialize( $boilerplate ); $this->link->save_settings(/*reload=*/ true); else : update_option( 'feedwordpress_boilerplate', $boilerplate ); endif; endif; $boilerplate_hook_order = FeedWordPress::post( 'boilerplate_hook_order', 10, 'text' ); $this->update_setting('boilerplate hook order', intval( $boilerplate_hook_order ) ); parent::save_settings(); } /** * publication_box: Outputs "Publication" settings box. * * @since 2009.0713 * @param object $page of class FeedWordPressPostsPage tells us whether this is * a page for one feed's settings or for global defaults * @param array $box * * @uses FeedWordPressPostsPage::these_posts_phrase() * @uses FeedWordPress::syndicated_status() * @uses SyndicatedLink::syndicated_status() */ /*static*/ function publication_box ($page, $box = NULL) { $thesePosts = $page->these_posts_phrase(); $postSelector = array( 'publish' => "Publish %s immediately", 'pending' => "Hold %s for review; mark as Pending", 'draft' => "Save %s as drafts", 'private' => "Save %s as private posts", ); $labels = array(); foreach ($postSelector as $index => $value) : $postSelector[$index] = sprintf(__($value), $thesePosts); $labels[$index] = __(str_replace(' %s', '', strtolower(strtok($value, ';')))); endforeach; $params = array( 'input-name' => 'feed_post_status', 'setting-default' => NULL, 'global-setting-default' => 'publish', 'labels' => $labels, ); // Hey ho, let's go... ?> updatedPosts->display(); ?>
setting_radio_control( 'post status', 'syndicated_post_status', $postSelector, $params ); ?>
these_posts_phrase(); // result unused, why? (gwyneth 20230920) if ($page->for_feed_settings()) : $formatting_filters = null; $url = preg_replace('|/+$|', '', $page->link->homepage()); else : $formatting_filters = get_option('feedwordpress_formatting_filters', 'no'); $url = 'http://example.com'; endif; ?>
Formatting filters:

If you have trouble getting plugins to work that are supposed to insert elements after posts (like relevant links or a social networking Share This button), try changing this option to see if it fixes your problem.

Relative URIs:

If link or image in a syndicated post from refers to a partial URI like /about, where should the syndicated copy point to?

'Resolve the URI so it points to '.$url.'
/contact is rewritten as '.$url.'/contact', 'no' => 'Leave relative URIs unchanged, so they point to this site
/contact is left as /contact', ); $params = array( 'setting-default' => 'default', 'global-setting-default' => 'yes', 'labels' => array( 'yes' => __('resolve relative URIs'), 'no' => __('leave relative URIs unresolved'), ), 'default-input-value' => 'default', ); $this->setting_radio_control( 'resolve relative', 'resolve_relative', $options, $params ); ?>
array( 'yes' => __('The copy on the original website'), 'no' => __('The local copy on this website'), ), ); if ( ! $page->for_feed_settings()) : $use_aggregator_source_data = get_option('feedwordpress_use_aggregator_source_data'); endif; ?> for_feed_settings()) : ?>
Permalinks point to: 'default', 'global-setting-default' => 'yes', 'default-input-value' => 'default', ); $this->setting_radio_control( 'munge permalink', 'munge_permalink', $setting['munge_permalink'], $params ); ?>
Posts from aggregator feeds:

Some feeds (for example, those produced by FeedWordPress) aggregate content from several different sources, and include information about the original source of the post. This setting controls what FeedWordPress will give as the source of posts from such an aggregator feed.

array('label' => __('Comments'), 'accept' => 'Allow comments'), 'ping' => array('label' => __('Pings'), 'accept' => 'Accept pings'), ); $onThesePosts = 'on '.$page->these_posts_phrase(); $mcflSettings = array( "yes" => __('Point to comment feeds from the original website (when provided by the syndicated feed)'), "no" => __('Point to local comment feeds on this website'), ); $mcflParams = array( 'setting-default' => 'default', 'global-setting-default' => 'yes', 'labels' => array( 'yes' => __('comment feeds from the original website'), 'no' => __('local comment feeds on this website') ), 'default-input-value' => 'default', ); $settings = array(); $params = array(); foreach ($whatsits as $what => $how) : $whatsits[$what]['default'] = FeedWordPress::syndicated_status($what, /*default=*/ 'closed'); // Set up array for selector $settings[$what] = array( 'open' => sprintf(__("{$how['accept']} %s"), __($onThesePosts)), 'closed' => sprintf(__("Don't ".strtolower($how['accept'])." %s"), __($onThesePosts)), ); $params[$what] = array( 'input-name' => "feed_{$what}_status", 'setting-default' => NULL, 'global-setting-default' => FeedWordPress::syndicated_status($what, /*default=*/ 'closed'), 'labels' => array( 'open' => strtolower(__($how['accept'])), 'closed' => strtolower(__("Don't ".$how['accept'])), ), ); endforeach; // Hey ho, let's go... ?> $how) : ?>
: setting_radio_control( "$what status", "syndicated_{$what}_status", $settings[$what], $params[$what] ); ?>

When WordPress feeds and templates link to comments feeds for these_posts_phrase()); ?>, the URLs for the feeds should...

setting_radio_control( "munge comments feed links", "munge_comments_feed_links", $mcflSettings, $mcflParams ); ?>
for_feed_settings()) : $custom_settings = $page->link->setting("postmeta", NULL, array()); else : $custom_settings = get_option('feedwordpress_custom_settings'); endif; if ($custom_settings and !is_array($custom_settings)) : $custom_settings = unserialize($custom_settings); endif; if ( !is_array($custom_settings)) : $custom_settings = array(); endif; return $custom_settings; } /* FeedWordPressPostsPage::custom_post_settings() */ /*static*/ function custom_post_settings_box_tester_button ( $id, $page, $box = NULL ) { ?>

Custom fields can be used to add extra metadata to a post that you can use in your theme.

$value) : ?>
Key Value Action

Enter a text value, or a path to a data element from the syndicated item.
For data elements, you can use an XPath-like syntax wrapped in $( ... ).
hello = the text value hello
$(author/email) = the contents of <author><email>...</email></author>
$(media:content/@url) = the contents of <media:content url="...">...</media:content>

add new setting...
'default' // Get all custom post types $post_types = get_post_types(array( '_builtin' => false, ), 'objects'); $ul = array(); $ul['post'] = __('Normal WordPress posts'); foreach ($post_types as $post_type) : $ul[$post_type->name] = __($post_type->labels->name); endforeach; $params = array( 'global-setting-default' => 'post', 'default-input-value' => 'default', ); // Hey, ho, let's go... ?>

Incoming syndicated posts should be stored in the posts database as...

setting_radio_control( 'syndicated post type', 'syndicated_post_type', $ul, $params ); ?>
for_feed_settings()) : $attrib = isset($page->link->settings['boilerplate rules']) ? unserialize($page->link->settings['boilerplate rules']) : []; $syndicatedPosts = 'this feed\'s posts'; else : $attrib = get_option('feedwordpress_boilerplate'); $syndicatedPosts = 'syndicated posts'; endif; $hookOrder = intval($page->setting('boilerplate hook order', FEEDWORDPRESS_BOILERPLATE_DEFAULT_HOOK_ORDER)); ?>

To remove boilerplate, just blank out the text box and leave it empty.

Use shortcodes to include information about your source:

[source]
A link to the source you syndicated the post from
[source-name]
Name of the source you syndicated the post from
[source-url]
URL of the source you syndicated the post from
[original-link]text[/original-link]
A link to the original post back on the source website, using text as the link text.
[original-url]
URL of the original post back on the source website
[author]
A link with the name of the author who wrote the post, linking to other posts by the same author
[author-name]
Name of the author who wrote the post
[feed-setting key="setting-name"]
Value of a custom feed setting (named setting-name) for the feed
\n"; if ( !is_array($attrib)) : $attrib = array(); endif; print ''; // In AJAX environment, this is a dummy rule that stays hidden. In a // non-AJAX environment, this provides a blank rule that we can fill in. $attrib['new'] = array( 'class' => array('hide-if-js'), 'placement' => 'before', 'element' => 'post', 'template' => '', ); foreach ($attrib as $index => $line) : if (isset($line['template'])) : $selected['before'] = (($line['placement']=='before') ? ' selected="selected"' : ''); $selected['after'] = (($line['placement']=='after') ? ' selected="selected"' : ''); $selected['title'] = (($line['element']=='title') ? ' selected="selected"' : ''); $selected['post'] = (($line['element']=='post') ? ' selected="selected"' : ''); $selected['excerpt'] = (($line['element']=='excerpt') ? ' selected="selected"' : ''); if ( !isset($line['class'])) : $line['class'] = array(); endif; $line['class'][] = 'boilerplate-li'; ?>
  • » Add the of :

  • for_default_settings()) : ?>

    Advanced Settings

    boxes_by_methods = array( 'publication_box' => __('Syndicated Posts'), 'links_box' => __('Links'), 'formatting_box' => __('Formatting'), 'boilerplate_box' => ('Boilerplate / Credits'), 'comments_and_pings_box' => __('Comments & Pings'), 'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'), 'custom_post_types_box' => ('Custom Post Types (advanced database settings)'), ); parent::display(); } /* FeedWordPressPostsPage::display () */ } $postsPage = new FeedWordPressPostsPage; $postsPage->display();