Make WordPress Core

Ticket #7772: 7772.diff

File 7772.diff, 1.0 KB (added by Otto42, 17 years ago)

First attempt at a patch

  • xmlrpc.php

     
    25232523                        if( $postdata['post_status'] === 'future' ) {
    25242524                                $postdata['post_status'] = 'publish';
    25252525                        }
     2526                       
     2527                        $enclosure = array();
     2528                        foreach ( (array) get_post_custom($post_ID) as $key => $val) {
     2529                                if ($key == 'enclosure') {
     2530                                        foreach ( (array) $val as $enc ) {
     2531                                                $enclosure = split("\n", $enc);
     2532                                                $enclosure['url'] = trim(htmlspecialchars($enclosure[0]));
     2533                                                $enclosure['length'] = trim($enclosure[1]);
     2534                                                $enclosure['type'] = trim($enclosure[2]);
     2535                                                break 2;
     2536                                        }
     2537                                }
     2538                        }
    25262539
    25272540                        $resp = array(
    25282541                                'dateCreated' => new IXR_Date($post_date),
     
    25482561                                'post_status' => $postdata['post_status'],
    25492562                                'custom_fields' => $this->get_custom_fields($post_ID)
    25502563                        );
    2551 
     2564                       
     2565                        if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
     2566                       
    25522567                        return $resp;
    25532568                } else {
    25542569                        return new IXR_Error(404, __('Sorry, no such post.'));