Make WordPress Core

Changeset 9089


Ignore:
Timestamp:
10/06/2008 07:20:50 PM (15 years ago)
Author:
ryan
Message:

Return enclosure data in mw_getPosts(). Props Otto42. fixes #7772

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xmlrpc.php

    r8979 r9089  
    25262526                $postdata['post_status'] = 'publish';
    25272527            }
     2528           
     2529            $enclosure = array();
     2530            foreach ( (array) get_post_custom($post_ID) as $key => $val) {
     2531                if ($key == 'enclosure') {
     2532                    foreach ( (array) $val as $enc ) {
     2533                        $encdata = split("\n", $enc);
     2534                        $enclosure['url'] = trim(htmlspecialchars($encdata[0]));
     2535                        $enclosure['length'] = trim($encdata[1]);
     2536                        $enclosure['type'] = trim($encdata[2]);
     2537                        break 2;
     2538                    }
     2539                }
     2540            }
    25282541
    25292542            $resp = array(
     
    25512564                'custom_fields' => $this->get_custom_fields($post_ID)
    25522565            );
    2553 
     2566           
     2567            if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
     2568           
    25542569            return $resp;
    25552570        } else {
Note: See TracChangeset for help on using the changeset viewer.