[wp-xmlrpc] API support for post formats?

Joseph Scott joseph at josephscott.org
Fri Nov 19 05:40:55 UTC 2010


I posted an updated patch and follow comments on
http://core.trac.wordpress.org/ticket/15405

Long story short: zero is now 'default', added validation, return
default if post format is empty, tightened up code just a bit, and
adjusted style for WP coding style.

I re-ran tests against it and everything appears to work.  Hopefully
westi has a few minutes to review it, if he is fine with it then I'll
commit it to -trunk.


On Thu, Nov 18, 2010 at 7:57 PM, Eric Mann <eric at eam.me> wrote:
> OK, I've added a new patch.  As I mentioned in my note just before it, I
> haven't changed too much.  Basically, you can specify "default" as the value
> of a post format and it will be converted to "0" automatically.
> The actual, hard-coded post format array is:
>
> $strings = array(
>     '0'       => _x( 'Default', 'Post format' ),
>     'aside'   => _x( 'Aside',   'Post format' ),
>     'chat'    => _x( 'Chat',    'Post format' ),
>     'gallery' => _x( 'Gallery', 'Post format' ),
>     'link'    => _x( 'Link',    'Post format' ),
>     'image'   => _x( 'Image',   'Post format' ),
>     'quote'   => _x( 'Quote',   'Post format' ),
>     'status'  => _x( 'Status',  'Post format' ),
>     'video'   => _x( 'Video',   'Post format' )
> );
>
> So you can see a "default" post actually has a post format slug of "0,"
> which is what seemed to make no sense when we tested things.  I'm going to
> leave the method that returns an array of post formats as-is for now.  It's
> returning an accurate slug ("0") even if that seems counterintuitive.  The
> same for the methods that get posts, they'll return the set slug for post
> formats.
> However, the two methods that can set a post format (metaWeblog.newPost and
> metaWeblog.editPost) should be more flexible.  After all, we should "be
> conservative in what we send, but liberal in what we receive."  So you can
> send either "0" or "default" when setting a post format of "default," and
> the system will recognize both.
> Take a look at the new patch and let me know what you think.  I'd
> really like to get this committed ASAP ...



-- 
Joseph Scott
joseph at josephscott.org
http://josephscott.org/


More information about the wp-xmlrpc mailing list