WordPress.org

Make WordPress Core

Ticket #10933: patch-core-10933.diff

File patch-core-10933.diff, 2.1 KB (added by koke, 7 years ago)
  • wp-includes/post.php

     
    319319 * 'more'. There can be text or space(s) after the word 'more', but won't be
    320320 * referenced.
    321321 *
    322  * The returned array has 'main' and 'extended' keys. Main has the text before
     322 * The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before
    323323 * the <code><!--more--></code>. The 'extended' key has the content after the
    324  * <code><!--more--></code> comment.
     324 * <code><!--more--></code> comment. The 'more_text' key has the custom "Read more text".
    325325 *
    326326 * @since 1.0.0
    327327 *
    328328 * @param string $post Post content.
    329  * @return array Post before ('main') and after ('extended').
     329 * @return array Post before ('main') and after ('extended'), and custom readmore text ('more_text')
    330330 */
    331331function get_extended($post) {
    332332        //Match the new style more links
    333333        if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
    334334                list($main, $extended) = explode($matches[0], $post, 2);
     335                $more_text = $matches[1];
    335336        } else {
    336337                $main = $post;
    337338                $extended = '';
     339                $more_text = '';
    338340        }
    339341
    340342        // Strip leading and trailing whitespace
    341343        $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
    342344        $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
     345        $more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
    343346
    344         return array('main' => $main, 'extended' => $extended);
     347        return array('main' => $main, 'extended' => $extended, 'more_text' => $more_text);
    345348}
    346349
    347350/**
  • wp-includes/class-wp-xmlrpc-server.php

     
    27572757                                'categories' => $categories,
    27582758                                'mt_excerpt' => $postdata['post_excerpt'],
    27592759                                'mt_text_more' => $post['extended'],
     2760                                'wp_more_text' => $post['more_text'],
    27602761                                'mt_allow_comments' => $allow_comments,
    27612762                                'mt_allow_pings' => $allow_pings,
    27622763                                'mt_keywords' => $tagnames,