WordPress.org

Make WordPress Core

Changeset 20156


Ignore:
Timestamp:
03/08/2012 12:50:21 PM (6 years ago)
Author:
westi
Message:

XMLRPC: Expose the extended more text to XMLRPC clients from metaWeblog.getPost(). Fixes #10933 props koke, ericmann.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r20155 r20156  
    39543954                'mt_excerpt' => $postdata['post_excerpt'],
    39553955                'mt_text_more' => $post['extended'],
     3956                'wp_more_text' => $post['more_text'],
    39563957                'mt_allow_comments' => $allow_comments,
    39573958                'mt_allow_pings' => $allow_pings,
     
    40704071                'mt_excerpt' => $entry['post_excerpt'],
    40714072                'mt_text_more' => $post['extended'],
     4073                'wp_more_text' => $post['more_text'],
    40724074                'mt_allow_comments' => $allow_comments,
    40734075                'mt_allow_pings' => $allow_pings,
  • trunk/wp-includes/post.php

    r20075 r20156  
    329329 * referenced.
    330330 *
    331  * The returned array has 'main' and 'extended' keys. Main has the text before
     331 * The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before
    332332 * the <code><!--more--></code>. The 'extended' key has the content after the
    333  * <code><!--more--></code> comment.
     333 * <code><!--more--></code> comment. The 'more_text' key has the custom "Read More" text.
    334334 *
    335335 * @since 1.0.0
    336336 *
    337337 * @param string $post Post content.
    338  * @return array Post before ('main') and after ('extended').
     338 * @return array Post before ('main'), after ('extended'), and custom readmore ('more_text').
    339339 */
    340340function get_extended($post) {
     
    342342    if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
    343343        list($main, $extended) = explode($matches[0], $post, 2);
     344        $more_text = $matches[1];
    344345    } else {
    345346        $main = $post;
    346347        $extended = '';
     348        $more_text = '';
    347349    }
    348350
     
    350352    $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
    351353    $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
    352 
    353     return array('main' => $main, 'extended' => $extended);
     354    $more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
     355
     356    return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
    354357}
    355358
Note: See TracChangeset for help on using the changeset viewer.