From ff2b67e66b2be0fa29a2c4ee988932519f838d58 Mon Sep 17 00:00:00 2001
From: Mohammad Jangda <batmoo@gmail.com>
Date: Thu, 4 Apr 2013 18:28:41 -0400
Subject: [PATCH] Pull XML: enclosures get sent into our callback with the
 'enclosures' meta_key so we should use that instead of our custom field.

---
 includes/class-syndication-wp-xml-client.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/includes/class-syndication-wp-xml-client.php b/includes/class-syndication-wp-xml-client.php
index 2cc4562..6f611c9 100644
--- a/includes/class-syndication-wp-xml-client.php
+++ b/includes/class-syndication-wp-xml-client.php
@@ -709,7 +709,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 	}
 	
 	public static function save_meta ($result, $post, $site, $transport_type, $client) {
-		if ( ! isset( $result ) OR ! isset( $post['postmeta'] ) ) {
+		if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) {
 			return false;
 		}
 		$categories = $post['post_category'];
@@ -718,7 +718,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 			
 		//handle enclosures separately first
 		$enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null;
-		$enclosures = isset( $metas[$enc_field] ) ? $metas[$enc_field] : null;
+		$enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null;
 		if ( isset( $enclosures ) && isset ( $enc_field ) ) {
 			// first remove all enclosures for the post (for updates) if any
 			delete_post_meta( $result, $enc_field);
@@ -739,7 +739,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 	}
 	
 	public static function update_meta ($result, $post, $site, $transport_type, $client) {
-		if ( !isset($result) OR !isset($post['postmeta']) ) {
+		if ( ! $result || is_wp_error( $result ) || ! isset( $post['postmeta'] ) ) {
 			return false;
 		}
 		$categories = $post['post_category'];
@@ -748,7 +748,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 			
 		// handle enclosures separately first
 		$enc_field = isset( $metas['enc_field'] ) ? $metas['enc_field'] : null;
-		$enclosures = isset( $metas[$enc_field] ) ? $metas[$enc_field] : null;
+		$enclosures = isset( $metas['enclosures'] ) ? $metas['enclosures'] : null;
 		if ( isset( $enclosures ) && isset( $enc_field ) ) {
 			// first remove all enclosures for the post (for updates)
 			delete_post_meta( $result, $enc_field);
@@ -769,7 +769,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 	}
 	
 	public static function save_tax ($result, $post, $site, $transport_type, $client) { 
-		if ( !isset($result ) OR !isset( $post['tax'] ) ) {
+		if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) {
 			return false;
 		}
 		$taxonomies = $post['tax'];
@@ -783,7 +783,7 @@ class Syndication_WP_XML_Client implements Syndication_Client {
 	}
 	
 	public static function update_tax ($result, $post, $site, $transport_type, $client) {
-		if ( !isset($result ) OR ! isset( $post['tax'] ) ) {
+		if ( ! $result || is_wp_error( $result ) || ! isset( $post['tax'] ) ) {
 			return false;
 		}
 		$taxonomies = $post['tax'];
-- 
GitLab