Ticket #2348: div-balance.diff

File div-balance.diff, 1.7 KB (added by skeltoac, 7 years ago)
Line 
1Index: wp-includes/template-functions-post.php
2===================================================================
3--- wp-includes/template-functions-post.php     (revision 3490)
4+++ wp-includes/template-functions-post.php     (working copy)
5@@ -79,7 +79,7 @@
6 
7        $content = $pages[$page-1];
8        $content = explode('<!--more-->', $content, 2);
9-       if ( (preg_match('/<!--noteaser-->/', $post->post_content) && ((!$multipage) || ($page==1))) )
10+       if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
11                $stripteaser = 1;
12        $teaser = $content[0];
13        if ( ($more) && ($stripteaser) )
14@@ -89,7 +89,7 @@
15                if ( $more )
16                        $output .= '<a id="more-'.$id.'"></a>'.$content[1];
17                else
18-                       $output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
19+                       $output = balanceTags($output . ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>");
20        }
21        if ( $preview ) // preview fix for javascript bug with foreign languages
22                $output =       preg_replace('/\%u([0-9A-F]{4,4})/e',   "'&#'.base_convert('\\1',16,10).';'", $output);
23Index: wp-includes/functions-formatting.php
24===================================================================
25--- wp-includes/functions-formatting.php        (revision 3490)
26+++ wp-includes/functions-formatting.php        (working copy)
27@@ -400,9 +400,9 @@
28                   Added Cleaning Hooks
29              1.0  First Version
30 */
31-function balanceTags($text, $is_comment = 0) {
32+function balanceTags($text, $is_comment = 0, $force = false) {
33       
34-       if ( get_option('use_balanceTags') == 0)
35+       if ( !$force && get_option('use_balanceTags') == 0 )
36                return $text;
37 
38        $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';