Ticket #7773: TakeTwo.diff
File TakeTwo.diff, 1.8 KB (added by , 14 years ago) |
---|
-
xmlrpc.php
2231 2231 } 2232 2232 2233 2233 // Handle enclosures 2234 $enclosure = $content_struct['enclosure']; 2235 if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 2236 add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] ); 2237 } 2234 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2238 2235 2239 2236 $this->attach_uploads( $post_ID, $post_content ); 2240 2237 … … 2243 2240 return strval($post_ID); 2244 2241 } 2245 2242 2243 function add_enclosure_if_new($post_ID, $enclosure) { 2244 if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 2245 2246 $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type']; 2247 $found = false; 2248 foreach ( (array) get_post_custom($post_ID) as $key => $val) { 2249 if ($key == 'enclosure') { 2250 foreach ( (array) $val as $enc ) { 2251 if ($enc == $encstring) { 2252 $found = true; 2253 break 2; 2254 } 2255 } 2256 } 2257 } 2258 if (!$found) { 2259 add_post_meta( $post_ID, 'enclosure', $encstring ); 2260 } 2261 } 2262 } 2263 2246 2264 /** 2247 2265 * Attach upload to a post. 2248 2266 * … … 2521 2539 } 2522 2540 2523 2541 // Handle enclosures 2524 $enclosure = $content_struct['enclosure']; 2525 if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 2526 add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] ); 2527 } 2542 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2528 2543 2529 2544 $this->attach_uploads( $ID, $post_content ); 2530 2545