Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.