Changeset 10383
- Timestamp:
- 01/19/2009 10:19:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r10382 r10383 2232 2232 2233 2233 // Handle enclosures 2234 $enclosure = $content_struct['enclosure']; 2234 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2235 2236 $this->attach_uploads( $post_ID, $post_content ); 2237 2238 logIO('O', "Posted ! ID: $post_ID"); 2239 2240 return strval($post_ID); 2241 } 2242 2243 function add_enclosure_if_new($post_ID, $enclosure) { 2235 2244 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 } 2238 2239 $this->attach_uploads( $post_ID, $post_content ); 2240 2241 logIO('O', "Posted ! ID: $post_ID"); 2242 2243 return strval($post_ID); 2244 } 2245 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. … … 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 );
Note: See TracChangeset
for help on using the changeset viewer.