Ticket #10933: patch-core-10933.diff

File patch-core-10933.diff, 2.1 KB (added by koke, 2 years ago)
Line 
1Index: wp-includes/post.php
2===================================================================
3--- wp-includes/post.php        (revision 17637)
4+++ wp-includes/post.php        (working copy)
5@@ -319,29 +319,32 @@
6  * 'more'. There can be text or space(s) after the word 'more', but won't be
7  * referenced.
8  *
9- * The returned array has 'main' and 'extended' keys. Main has the text before
10+ * The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before
11  * the <code><!--more--></code>. The 'extended' key has the content after the
12- * <code><!--more--></code> comment.
13+ * <code><!--more--></code> comment. The 'more_text' key has the custom "Read more text".
14  *
15  * @since 1.0.0
16  *
17  * @param string $post Post content.
18- * @return array Post before ('main') and after ('extended').
19+ * @return array Post before ('main') and after ('extended'), and custom readmore text ('more_text')
20  */
21 function get_extended($post) {
22        //Match the new style more links
23        if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
24                list($main, $extended) = explode($matches[0], $post, 2);
25+               $more_text = $matches[1];
26        } else {
27                $main = $post;
28                $extended = '';
29+               $more_text = '';
30        }
31 
32        // Strip leading and trailing whitespace
33        $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
34        $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
35+       $more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
36 
37-       return array('main' => $main, 'extended' => $extended);
38+       return array('main' => $main, 'extended' => $extended, 'more_text' => $more_text);
39 }
40 
41 /**
42Index: wp-includes/class-wp-xmlrpc-server.php
43===================================================================
44--- wp-includes/class-wp-xmlrpc-server.php      (revision 17637)
45+++ wp-includes/class-wp-xmlrpc-server.php      (working copy)
46@@ -2757,6 +2757,7 @@
47                                'categories' => $categories,
48                                'mt_excerpt' => $postdata['post_excerpt'],
49                                'mt_text_more' => $post['extended'],
50+                               'wp_more_text' => $post['more_text'],
51                                'mt_allow_comments' => $allow_comments,
52                                'mt_allow_pings' => $allow_pings,
53                                'mt_keywords' => $tagnames,