From a3688eb780d5823ea732c5ca02e58d8b203823f4 Mon Sep 17 00:00:00 2001 From: Erick Hitter <ehitter@gmail.com> Date: Mon, 5 Jan 2015 15:17:12 -0800 Subject: [PATCH] Remove unnecessary whitespace --- includes/class-syndication-wp-rest-client.php | 6 +- includes/class-syndication-wp-rss-client.php | 30 ++++---- includes/class-syndication-wp-xml-client.php | 76 +++++++++---------- .../class-syndication-wp-xmlrpc-client.php | 22 +++--- includes/class-wp-cli.php | 2 +- includes/class-wp-push-syndication-server.php | 34 ++++----- includes/interface-syndication-client.php | 2 +- 7 files changed, 86 insertions(+), 86 deletions(-) diff --git a/includes/class-syndication-wp-rest-client.php b/includes/class-syndication-wp-rest-client.php index a253847..8667fa8 100644 --- a/includes/class-syndication-wp-rest-client.php +++ b/includes/class-syndication-wp-rest-client.php @@ -25,7 +25,7 @@ class Syndication_WP_REST_Client implements Syndication_Client { public static function get_client_data() { return array( 'id' => 'WP_REST', 'modes' => array( 'push' ), 'name' => 'WordPress.com REST' ); } - + public function new_post( $post_ID ) { $post = (array)get_post( $post_ID ); @@ -34,7 +34,7 @@ class Syndication_WP_REST_Client implements Syndication_Client { $post = apply_filters( 'syn_rest_push_filter_new_post', $post, $post_ID ); if ( false === $post ) return true; - + $response = wp_remote_post( 'https://public-api.wordpress.com/rest/v1/sites/' . $this->blog_ID . '/posts/new/', array( 'timeout' => $this->timeout, 'user-agent' => $this->useragent, @@ -77,7 +77,7 @@ class Syndication_WP_REST_Client implements Syndication_Client { $post = apply_filters( 'syn_rest_push_filter_edit_post', $post, $post_ID ); if ( false === $post ) return true; - + $response = wp_remote_post( 'https://public-api.wordpress.com/rest/v1/sites/' . $this->blog_ID . '/posts/' . $ext_ID . '/', array( 'timeout' => $this->timeout, 'user-agent' => $this->useragent, diff --git a/includes/class-syndication-wp-rss-client.php b/includes/class-syndication-wp-rss-client.php index d2241cd..e71beaa 100644 --- a/includes/class-syndication-wp-rss-client.php +++ b/includes/class-syndication-wp-rss-client.php @@ -153,7 +153,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client <?php - do_action( 'syn_after_site_form', $site ); + do_action( 'syn_after_site_form', $site ); } public static function save_settings( $site_ID ) { @@ -209,7 +209,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client return $posts; } - + public function set_taxonomy( $item ) { $cats = $item->get_categories(); $ids = array( @@ -226,7 +226,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client } elseif ( $result = get_term_by( 'name', $cat->term, 'post_tag' ) ) { if ( isset( $result->term_id ) ) { $ids['tags'][] = $result->term_id; - } + } } else { // creates if not $result = wp_insert_term( $cat->term, 'category' ); @@ -239,7 +239,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client // returns array ready for post creation return $ids; } - + public static function save_meta( $result, $post, $site, $transport_type, $client ) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) { return false; @@ -247,7 +247,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client $categories = $post['post_category']; wp_set_post_terms($result, $categories, 'category', true); $metas = $post['postmeta']; - + //handle enclosures separately first $enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null; $enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null; @@ -260,16 +260,16 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client } add_post_meta($result, $enc_field, $enclosure, false); } - + // now remove them from the rest of the metadata before saving the rest unset($metas['enclosures']); } - + foreach ($metas as $meta_key => $meta_value) { add_post_meta($result, $meta_key, $meta_value, true); } } - + public static function update_meta( $result, $post, $site, $transport_type, $client ) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) { return false; @@ -277,7 +277,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client $categories = $post['post_category']; wp_set_post_terms($result, $categories, 'category', true); $metas = $post['postmeta']; - + // handle enclosures separately first $enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null; $enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null; @@ -290,17 +290,17 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client } add_post_meta($result, $enc_field, $enclosure, false); } - + // now remove them from the rest of the metadata before saving the rest unset($metas['enclosures']); } - + foreach ($metas as $meta_key => $meta_value) { update_post_meta($result, $meta_key, $meta_value); } } - - public static function save_tax( $result, $post, $site, $transport_type, $client ) { + + public static function save_tax( $result, $post, $site, $transport_type, $client ) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) { return false; } @@ -313,7 +313,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client wp_set_object_terms($result, (string)$tax_value, $tax_name, true); } } - + public static function update_tax( $result, $post, $site, $transport_type, $client ) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) { return false; @@ -328,7 +328,7 @@ class Syndication_WP_RSS_Client extends SimplePie implements Syndication_Client if ( !in_array($tax_name, $replace_tax_list ) ) { //if we haven't processed this taxonomy before, replace any terms on the post with the first new one wp_set_object_terms($result, (string)$tax_value, $tax_name ); - $replace_tax_list[] = $tax_name; + $replace_tax_list[] = $tax_name; } else { //if we've already added one term for this taxonomy, append any others wp_set_object_terms($result, (string)$tax_value, $tax_name, true); diff --git a/includes/class-syndication-wp-xml-client.php b/includes/class-syndication-wp-xml-client.php index 8a5d7c0..b646a22 100644 --- a/includes/class-syndication-wp-xml-client.php +++ b/includes/class-syndication-wp-xml-client.php @@ -63,7 +63,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { public function new_post( $post_ID ) { return false; // Not supported } - + public function edit_post( $post_ID, $ext_ID ) { return false; // Not supported } @@ -71,11 +71,11 @@ class Syndication_WP_XML_Client implements Syndication_Client { public function delete_post( $ext_ID ) { return false; // Not supported } - + public function get_post( $ext_ID ) { return false; // Not supported } - + /** * Retrieves a list of posts from a slave site. * @@ -147,7 +147,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { } $xml = simplexml_load_string( $feed, null, 0, $namespace, false ); - + if ( false === $xml ) { self::log_post( 'n/a', null, get_post( $this->site_ID ), sprintf( __( 'Failed to parse feed at: %s', 'push-syndication' ), $this->feed_url ) ); return array(); @@ -234,7 +234,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { } $meta_data = array_merge($meta_data, $abs_meta_data); $tax_data = array_merge($tax_data, $abs_tax_data); - if ( !empty( $enc_field ) ) { + if ( !empty( $enc_field ) ) { $meta_data['enc_field'] = $enc_field; } if ( !isset( $meta_data['position'] ) ) { @@ -252,9 +252,9 @@ class Syndication_WP_XML_Client implements Syndication_Client { $posts[] = $item_fields; $post_position++; - } + } return $posts; - + } /** @@ -326,7 +326,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { $default_post_status = get_post_meta( $site->ID, 'syn_default_post_status', true ); $default_comment_status = get_post_meta( $site->ID, 'syn_default_comment_status', true ); $default_ping_status = get_post_meta( $site->ID, 'syn_default_ping_status', true ); - $node_config = get_post_meta( $site->ID, 'syn_node_config', true ); + $node_config = get_post_meta( $site->ID, 'syn_node_config', true ); $id_field = get_post_meta( $site->ID, 'syn_id_field', true ); $enc_field = get_post_meta( $site->ID, 'syn_enc_field', true ); $enc_is_photo = get_post_meta( $site->ID, 'syn_enc_is_photo', true); @@ -430,7 +430,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { <p> <input type="text" name="post_root" id="post_root" value="<?php echo esc_attr($post_root); ?>" /> </p> - + <p> <label for="id_node"><?php esc_html_e( 'Enter postmeta key for unique post identifier', 'push-syndication' ); ?></label> </p> @@ -451,7 +451,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { <p> <input type="text" name="enc_field" id="enc_field" value="<?php echo esc_attr($enc_field); ?>" /> </p> - + <p> <label for="enc_is_photo"> <input type="checkbox" name="enc_is_photo" id="enc_is_photo" value="1" <?php checked( $enc_is_photo ); ?> /> @@ -466,7 +466,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { <p> <select name="categories" multiple="multiple"> <?php $site_categories = get_categories( array( 'hide_empty' => 0 ) ); - foreach ($site_categories as $category) { + foreach ($site_categories as $category) { if ( isset( $categories ) ) { $selected = in_array( $category->cat_ID, $categories ) ? 'selected="selected"' : null; } @@ -482,7 +482,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { <h2><?php _e( 'XPath-to-Data Mapping', 'push-syndication' ); ?></h2> <p><?php printf( __( '<strong>PLEASE NOTE:</strong> %s are required. If you want a link to another site, %s required. To include a static string, enclose the string as "%s(your_string_here)" -- no quotes.', 'push-syndication' ), 'post_title, post_guid, guid', 'is_permalink', 'string' ); ?></p> - + <ul class='syn-xml-client-xpath-head syn-xml-client-list-head'> <li class="text"> <label for="xpath"><?php esc_html_e( 'Xpath Expression', 'push-syndication' )?></label> @@ -503,8 +503,8 @@ class Syndication_WP_XML_Client implements Syndication_Client { <label for="item_field"><?php esc_html_e( 'Field in post', 'push-syndication' )?></label> </li> </ul> - - <?php + + <?php $rowcount = 0; if ( !empty( $custom_nodes ) ) : foreach ($custom_nodes as $key => $storage_locations) : @@ -602,10 +602,10 @@ class Syndication_WP_XML_Client implements Syndication_Client { </script> <h2><?php _e( 'Log', 'push-syndication' ); ?></h2> - + <p class="syn-xml-client-last-update"><em><?php printf( __( 'Last Update: %s', 'push-syndication' ), ( $last_update_time ? date( 'c', $last_update_time ) : __( 'n/a', 'push-syndication' ) ) ); ?></em></p> - - <?php + + <?php $syn_log = get_post_meta($site->ID, 'syn_log', true); if ( ! empty( $syn_log ) ) : ?> <ul class='syn-xml-client-xpath-log-head syn-xml-client-list-head'> @@ -628,9 +628,9 @@ class Syndication_WP_XML_Client implements Syndication_Client { ?> <ul class='syn-xml-client-log syn-xml-client-list'> <li> - <?php + <?php if ( gettype($log_row['post_id']) == 'integer' ) { - edit_post_link( $log_row['post_id'], null, null, $log_row['post_id'] ); + edit_post_link( $log_row['post_id'], null, null, $log_row['post_id'] ); } else { echo "ERROR"; } @@ -646,11 +646,11 @@ class Syndication_WP_XML_Client implements Syndication_Client { <a href="<?php echo esc_url( $view_link ); ?>"><?php _e( 'View', 'push-syndication' ); ?></a> </li> </ul> - <?php + <?php endforeach; endif; - - do_action( 'syn_after_site_form', $site ); + + do_action( 'syn_after_site_form', $site ); } /** @@ -673,7 +673,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { update_post_meta( $site_ID, 'syn_enc_field', sanitize_text_field( $_POST['enc_field'] ) ); update_post_meta( $site_ID, 'syn_enc_is_photo', isset( $_POST['enc_is_photo'] ) ? sanitize_text_field( $_POST['enc_is_photo'] ) : null ); - + $node_changes = $_POST['node']; $node_config = array(); $custom_nodes = array(); @@ -681,7 +681,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { foreach($node_changes as $row) { $row_data = array(); - //if no new has been added to the empty row at the end, ignore it + //if no new has been added to the empty row at the end, ignore it if ( ! empty( $row['xpath'] ) ) { foreach ( array( 'is_item', 'is_meta', 'is_tax', 'is_photo' ) as $field ) { @@ -707,10 +707,10 @@ class Syndication_WP_XML_Client implements Syndication_Client { $node_config['categories'] = sanitize_text_field( $_POST['categories'] ); $node_config['nodes'] = $custom_nodes; update_post_meta( $site_ID, 'syn_node_config', $node_config); - + return true; } - + public static function publish_pulled_post($result, $post, $site, $transport_type, $client) { wp_publish_post( $result ); } @@ -741,7 +741,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { } update_post_meta( $site->ID, 'syn_log', $log ); } - + public static function save_meta ($result, $post, $site, $transport_type, $client) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) { return false; @@ -749,7 +749,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { $categories = $post['post_category']; wp_set_post_terms($result, $categories, 'category', true); $metas = $post['postmeta']; - + //handle enclosures separately first $enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null; $enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null; @@ -762,16 +762,16 @@ class Syndication_WP_XML_Client implements Syndication_Client { } add_post_meta($result, $enc_field, $enclosure, false); } - + // now remove them from the rest of the metadata before saving the rest unset($metas['enclosures']); } - + foreach ($metas as $meta_key => $meta_value) { add_post_meta($result, $meta_key, $meta_value, true); } } - + public static function update_meta ($result, $post, $site, $transport_type, $client) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) { return false; @@ -779,7 +779,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { $categories = $post['post_category']; wp_set_post_terms($result, $categories, 'category', true); $metas = $post['postmeta']; - + // handle enclosures separately first $enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null; $enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null; @@ -792,17 +792,17 @@ class Syndication_WP_XML_Client implements Syndication_Client { } add_post_meta($result, $enc_field, $enclosure, false); } - + // now remove them from the rest of the metadata before saving the rest unset($metas['enclosures']); } - + foreach ($metas as $meta_key => $meta_value) { update_post_meta($result, $meta_key, $meta_value); } } - - public static function save_tax ($result, $post, $site, $transport_type, $client) { + + public static function save_tax ($result, $post, $site, $transport_type, $client) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) { return false; } @@ -815,7 +815,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { wp_set_object_terms($result, (string)$tax_value, $tax_name, true); } } - + public static function update_tax ($result, $post, $site, $transport_type, $client) { if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) { return false; @@ -830,7 +830,7 @@ class Syndication_WP_XML_Client implements Syndication_Client { if ( !in_array($tax_name, $replace_tax_list ) ) { //if we haven't processed this taxonomy before, replace any terms on the post with the first new one wp_set_object_terms($result, (string)$tax_value, $tax_name ); - $replace_tax_list[] = $tax_name; + $replace_tax_list[] = $tax_name; } else { //if we've already added one term for this taxonomy, append any others wp_set_object_terms($result, (string)$tax_value, $tax_name, true); diff --git a/includes/class-syndication-wp-xmlrpc-client.php b/includes/class-syndication-wp-xmlrpc-client.php index 8ad871c..9b73810 100644 --- a/includes/class-syndication-wp-xmlrpc-client.php +++ b/includes/class-syndication-wp-xmlrpc-client.php @@ -41,7 +41,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica function post_push_send_thumbnail( $remote_post_id, $post_id ) { - $thumbnail_meta_keys = $this->get_thumbnail_meta_keys( $post_id ); + $thumbnail_meta_keys = $this->get_thumbnail_meta_keys( $post_id ); foreach ( $thumbnail_meta_keys as $thumbnail_meta ) { $thumbnail_id = get_post_meta( $post_id, $thumbnail_meta, true ); @@ -65,7 +65,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica $thumbnail_meta ); - unset( $syndicated_thumbnails_by_site[ $this->site_ID ] ); + unset( $syndicated_thumbnails_by_site[ $this->site_ID ] ); update_post_meta( $post_id, $syn_local_meta_key, $syndicated_thumbnails_by_site ); } @@ -81,7 +81,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica //has to be this way since mw_newMediaObject doesn't allow to pass description and caption along $thumbnail_post_data = get_post( $thumbnail_id ); $thumbnail_alt_text = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); - + $result = $this->query( 'syndication.addThumbnail', '1', @@ -104,7 +104,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica public static function get_client_data() { return array( 'id' => 'WP_XMLRPC', 'modes' => array( 'push' ), 'name' => 'WordPress XMLRPC' ); } - + public function new_post( $post_ID ) { $post = (array)get_post( $post_ID ); @@ -114,7 +114,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica if ( false === $post ) { return true; } - + //Uploads all gallery images to the remote site and replaces [gallery] tags with new IDs $post['post_content'] = $this->syndicate_gallery_images( $post['post_content'] ); @@ -175,7 +175,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica // Delete existing metadata to avoid duplicates $args['custom_fields'] = array(); foreach ( $remote_post['custom_fields'] as $custom_field ) { - $args['custom_fields'][] = array( + $args['custom_fields'][] = array( 'id' => $custom_field['id'], 'meta_key_lookup' => $custom_field['key'], ); @@ -260,9 +260,9 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica $image_ids = array(); $new_image_ids = array(); - + if ( preg_match_all( '/' . $pattern . '/s', $post_content, $matches ) ) { - $count=count( $matches[3] ); + $count=count( $matches[3] ); for ( $i = 0; $i < $count; $i++ ) { $atts = shortcode_parse_atts( $matches[3][$i] ); if ( isset( $atts['ids'] ) ) { @@ -492,7 +492,7 @@ class Syndication_WP_XMLRPC_Client extends WP_HTTP_IXR_Client implements Syndica <?php - do_action( 'syn_after_site_form', $site ); + do_action( 'syn_after_site_form', $site ); } public static function save_settings( $site_ID ) { @@ -591,7 +591,7 @@ class Syndication_WP_XMLRPC_Client_Extensions { if ( ! $thumbnail_set ) return new IXR_Error( 403, __( 'Could not attach post thumbnail.' ) ); - + $args = array( $blog_id, $username, @@ -692,7 +692,7 @@ class Syndication_WP_XMLRPC_Client_Extensions { if ( empty( $thumbnail_id ) ) { return new IXR_Error( 500, __( 'Sorry, looks like the image upload failed.', 'syndication' ) ); } - + $args = array( $blog_id, $username, diff --git a/includes/class-wp-cli.php b/includes/class-wp-cli.php index 842f64c..334562a 100644 --- a/includes/class-wp-cli.php +++ b/includes/class-wp-cli.php @@ -132,7 +132,7 @@ class Syndication_CLI_Command extends WP_CLI_Command { return; $this->enabled_verbosity = true; - + add_filter( 'syn_pre_push_post_sites', function( $sites, $post_id, $slave_states ) { WP_CLI::line( sprintf( "Processing post_id #%d (%s)", $post_id, get_the_title( $post_id ) ) ); WP_CLI::line( sprintf( "-- pushing to %s sites and deleting from %s sites", number_format( count( $sites['selected_sites'] ) ), number_format( count( $sites['removed_sites'] ) ) ) ); diff --git a/includes/class-wp-push-syndication-server.php b/includes/class-wp-push-syndication-server.php index b67f2ea..bd13969 100644 --- a/includes/class-wp-push-syndication-server.php +++ b/includes/class-wp-push-syndication-server.php @@ -21,7 +21,7 @@ class WP_Push_Syndication_Server { // custom columns add_filter( 'manage_edit-syn_site_columns', array( $this, 'add_new_columns' ) ); add_action( 'manage_syn_site_posts_custom_column', array( $this, 'manage_columns' ), 10, 2); - + // submenus add_action( 'admin_menu', array( $this, 'register_syndicate_settings' ) ); @@ -64,14 +64,14 @@ class WP_Push_Syndication_Server { 'publish_posts' => $capability, 'read_private_posts' => $capability ); - + $taxonomy_capabilities = array( 'manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'edit_posts', ); - + register_post_type( 'syn_site', array( 'labels' => array( 'name' => __( 'Sites' ), @@ -179,11 +179,11 @@ class WP_Push_Syndication_Server { break; } } - + public function admin_init() { // @TODO define more parameters $name_match = '#class-syndication-(.+)-client\.php$#'; - + $full_path = __DIR__ . '/'; if ( $handle = opendir( $full_path ) ) { while ( false !== ( $entry = readdir( $handle ) ) ) { @@ -196,7 +196,7 @@ class WP_Push_Syndication_Server { continue; $client_data = call_user_func( array( $class_name, 'get_client_data' ) ); if ( is_array( $client_data ) && !empty( $client_data ) ) { - $this->push_syndicate_transports[$client_data['id']] = array( 'name' => $client_data['name'], 'modes' => $client_data['modes'] ); + $this->push_syndicate_transports[$client_data['id']] = array( 'name' => $client_data['name'], 'modes' => $client_data['modes'] ); } } } @@ -652,7 +652,7 @@ class WP_Push_Syndication_Server { // @TODO validate that type and mode are valid update_post_meta( $post->ID, 'syn_transport_type', $transport_type ); - + $site_enabled = sanitize_text_field( $_POST['site_enabled'] ); try { @@ -854,19 +854,19 @@ class WP_Push_Syndication_Server { $push_new_shortcircuit = apply_filters( 'syn_pre_push_new_post_shortcircuit', false, $post_ID, $site, $transport_type, $client, $info ); if ( true === $push_new_shortcircuit ) continue; - + $result = $client->new_post( $post_ID ); $this->validate_result_new_post( $result, $slave_post_states, $site->ID, $client ); $this->update_slave_post_states( $post_ID, $slave_post_states ); do_action( 'syn_post_push_new_post', $result, $post_ID, $site, $transport_type, $client, $info ); - + } else { // states 'success', 'edit-error' and 'remove-error' $push_edit_shortcircuit = apply_filters( 'syn_pre_push_edit_post_shortcircuit', false, $post_ID, $site, $transport_type, $client, $info ); if ( true === $push_edit_shortcircuit ) continue; - + $result = $client->edit_post( $post_ID, $info['ext_ID'] ); $this->validate_result_edit_post( $result, $info['ext_ID'], $slave_post_states, $site->ID, $client ); @@ -1110,11 +1110,11 @@ class WP_Push_Syndication_Server { $push_delete_shortcircuit = apply_filters( 'syn_pre_push_delete_post_shortcircuit', false, $ext_ID, $post_ID, $site_ID, $transport_type, $client ); if ( true === $push_delete_shortcircuit ) continue; - + $result = $client->delete_post( $ext_ID ); do_action( 'syn_post_push_delete_post', $result, $ext_ID, $post_ID, $site_ID, $transport_type, $client ); - + if( !$result ) { $delete_error_sites[ $site_ID ] = array( $ext_ID ); } @@ -1184,7 +1184,7 @@ class WP_Push_Syndication_Server { $sites = array_merge( $sites, $this->get_sites_by_sitegroup( $selected_sitegroup ) ); } - + $this->schedule_pull_content( $sites ); } @@ -1238,7 +1238,7 @@ class WP_Push_Syndication_Server { public function pull_content( $sites ) { add_filter( 'http_headers_useragent', array( $this, 'syndication_user_agent' ) ); - + if ( empty( $sites ) ) $sites = $this->pull_get_selected_sites(); @@ -1271,7 +1271,7 @@ class WP_Push_Syndication_Server { $pull_edit_shortcircuit = apply_filters( 'syn_pre_pull_edit_post_shortcircuit', false, $post, $site, $transport_type, $client ); if ( true === $pull_edit_shortcircuit ) continue; - + // if updation is disabled continue if( $this->push_syndicate_settings['update_pulled_posts'] != 'on' ) continue; @@ -1283,7 +1283,7 @@ class WP_Push_Syndication_Server { $result = wp_update_post( $post, true ); do_action( 'syn_post_pull_edit_post', $result, $post, $site, $transport_type, $client ); - + } else { $pull_new_shortcircuit = apply_filters( 'syn_pre_pull_new_post_shortcircuit', false, $post, $site, $transport_type, $client ); if ( true === $pull_new_shortcircuit ) @@ -1357,6 +1357,6 @@ class WP_Push_Syndication_Server { update_option( 'syn_version', SYNDICATION_VERSION ); } - + } diff --git a/includes/interface-syndication-client.php b/includes/interface-syndication-client.php index 5e4be26..589f944 100644 --- a/includes/interface-syndication-client.php +++ b/includes/interface-syndication-client.php @@ -7,7 +7,7 @@ interface Syndication_Client { * @return array array( 'id' => (string) $transport_name, 'modes' => array( 'push', 'pull' ), 'name' => (string) $name ); */ public static function get_client_data(); - + /** * Creates a new post in the slave site. * -- GitLab