Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short term hacks #73

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
18 changes: 16 additions & 2 deletions includes/class-syndication-wp-rss-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client
private $default_comment_status;
private $default_ping_status;
private $default_cat_status;
protected $site_id;

function __construct( $site_ID ) {

Expand All @@ -27,6 +28,8 @@ function __construct( $site_ID ) {

parent::__construct();

$this->site_id = $site_ID;

$this->set_feed_url( get_post_meta( $site_ID, 'syn_feed_url', true ) );

$this->default_post_type = get_post_meta( $site_ID, 'syn_default_post_type', true );
Expand Down Expand Up @@ -199,8 +202,19 @@ public function get_posts( $args = array() ) {
'post_category' => $taxonomy['cats'],
'tags_input' => $taxonomy['tags']
);
// This filter can be used to exclude or alter posts during a pull import
$post = apply_filters( 'syn_rss_pull_filter_post', $post, $args, $item );

/**
* Exclude or alter posts during an RSS syndication pull
*
* Return an array of post data to save this post. Return false to exclude
* this post.
*
* @param array $post The post data, as would be passed to wp_insert_post
* @param array $args
* @param SimplePie_Item $item A Simplepie item object
* @param int $this->site_id The ID of the post holding the data describing this feed
*/
$post = apply_filters( 'syn_rss_pull_filter_post', $post, $args, $item, $this->site_id );
if ( false === $post )
continue;
$posts[] = $post;
Expand Down
20 changes: 11 additions & 9 deletions includes/class-wp-push-syndication-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,25 +284,25 @@ public function display_syndicate_settings() {

<form action="options.php" method="post">

<?php settings_fields( 'push_syndicate_settings' ); ?>
<div class="syn-push-syndicate-settings"><?php settings_fields( 'push_syndicate_settings' ); ?></div>

<?php do_settings_sections( 'push_syndicate_pull_sitegroups' ); ?>
<div class="syn-push-syndicate-pull-sitegroups"><?php do_settings_sections( 'push_syndicate_pull_sitegroups' ); ?></div>

<?php do_settings_sections( 'push_syndicate_pull_options' ); ?>
<div class="syn-push-syndicate-pull-options"><?php do_settings_sections( 'push_syndicate_pull_options' ); ?></div>

<?php submit_button( ' Pull Now ' ); ?>
<div class="syn-pull-now-button"><?php submit_button( ' Pull Now ' ); ?></div>

<?php do_settings_sections( 'push_syndicate_post_types' ); ?>
<div class="syn-push-syndicate-post-types"><?php do_settings_sections( 'push_syndicate_post_types' ); ?></div>

<?php do_settings_sections( 'delete_pushed_posts' ); ?>
<div class="syn-delete-pushed-posts"><?php do_settings_sections( 'delete_pushed_posts' ); ?></div>

<?php do_settings_sections( 'api_token' ); ?>
<div class="syn-api-token-config"><?php do_settings_sections( 'api_token' ); ?></div>

<?php submit_button(); ?>
<div class="syn-submit-button"><?php submit_button(); ?></div>

</form>

<?php $this->get_api_token() ?>
<div class="syn-api-token"><?php $this->get_api_token() ?></div>

</div>

Expand Down Expand Up @@ -648,7 +648,9 @@ public function add_site_settings_metabox( $post ) {
// nonce for verification when saving
wp_nonce_field( plugin_basename( __FILE__ ), 'site_settings_noncename' );

echo '<div class="syn-transports">';
$this->display_transports( $transport_type, $transport_mode );
echo '</div>';

try {
Syndication_Client_Factory::display_client_settings( $post, $transport_type );
Expand Down