From 872183bfcf9dff47f9b93b41172c114e06c61b31 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 28 Apr 2008 16:15:23 +0000 Subject: [PATCH] Handle enclosures in xmlrpc. Props josephscott. fixes #3405 git-svn-id: https://develop.svn.wordpress.org/trunk@7847 602fd350-edb4-49c9-b593-d223f7449a82 --- xmlrpc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xmlrpc.php b/xmlrpc.php index ae31440486..6ad282878d 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1337,6 +1337,12 @@ class wp_xmlrpc_server extends IXR_Server { $this->set_custom_fields($post_ID, $content_struct['custom_fields']); } + // Handle enclosures + $enclosure = $content_struct['enclosure']; + if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { + add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] ); + } + $this->attach_uploads( $post_ID, $post_content ); logIO('O', "Posted ! ID: $post_ID"); @@ -1593,6 +1599,12 @@ class wp_xmlrpc_server extends IXR_Server { $this->set_custom_fields($post_ID, $content_struct['custom_fields']); } + // Handle enclosures + $enclosure = $content_struct['enclosure']; + if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { + add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] ); + } + $this->attach_uploads( $ID, $post_content ); logIO('O',"(MW) Edited ! ID: $post_ID");