Ticket #148: 148.diff
| File 148.diff, 6.1 KB (added by mdawaffe, 6 years ago) |
|---|
-
wp-includes/post-template.php
50 50 return apply_filters('get_the_guid', $post->guid); 51 51 } 52 52 53 function the_content( $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {54 $content = get_the_content( $more_link_text, $stripteaser, $more_file);55 $content = apply_filters( 'the_content', $content);53 function the_content( $more_link_text = '(more...)', $stripteaser = 0 ) { 54 $content = get_the_content( $more_link_text, $stripteaser ); 55 $content = apply_filters( 'the_content', $content ); 56 56 $content = str_replace(']]>', ']]>', $content); 57 57 echo $content; 58 58 } 59 59 60 61 function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 60 function get_the_content( $more_link_text = '(more...)', $stripteaser = 0 ) { 62 61 global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; 63 62 global $preview; 64 63 global $pagenow; … … 71 70 } 72 71 } 73 72 74 if ( $more_file != '' )75 $file = $more_file;76 else77 $file = $pagenow; //$_SERVER['PHP_SELF'];78 79 73 if ( $page > count($pages) ) // if the requested page doesn't exist 80 74 $page = count($pages); // give them the highest numbered page that DOES exist 81 75 82 $content = $pages[$page -1];76 $content = $pages[$page ? $page - 1 : 0]; 83 77 if ( preg_match('/<!--more(.+?)?-->/', $content, $matches) ) { 84 78 $content = explode($matches[0], $content, 2); 85 79 if ( !empty($matches[1]) ) … … 135 129 if ( !isset($r['next_or_number']) ) 136 130 $r['next_or_number'] = 'number'; 137 131 if ( !isset($r['nextpagelink']) ) 138 $r['nextpagelink'] = 'Next page';132 $r['nextpagelink'] = __('Next page'); 139 133 if ( !isset($r['previouspagelink']) ) 140 $r['previouspagelink'] = 'Previous page';134 $r['previouspagelink'] = __('Previous page'); 141 135 if ( !isset($r['pagelink']) ) 142 136 $r['pagelink'] = '%'; 143 137 if ( !isset($r['more_file']) ) 144 138 $r['more_file'] = ''; 139 if ( !isset($r['all_page_link']) ) 140 $r['all_page_link'] = ''; 145 141 146 link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file'] );142 link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file'], $r['all_page_link']); 147 143 } 148 144 149 145 150 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='' ) {146 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='', $all_page_link='') { 151 147 global $id, $page, $numpages, $multipage, $more, $pagenow; 152 if ( $more_file != '' )153 $file = $more_file;154 else155 $file = $pagenow;156 148 if ( $multipage ) { 157 149 if ( 'number' == $next_or_number ) { 158 150 echo $before; 159 151 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 160 152 $j = str_replace('%',"$i",$pagelink); 161 153 echo ' '; 162 if ( ($i != $page) || ((!$more) && ($page==1)) ) {154 if ( $i != $page || ( !$more && 1 == $page ) ) { 163 155 if ( '' == get_settings('permalink_structure') ) 164 156 echo '<a href="' . get_permalink() . '&page=' . $i . '">'; 165 157 else 166 158 echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">'; 167 159 } 168 160 echo $j; 169 if ( ($i != $page) || ((!$more) && ($page==1)) )161 if ( $i != $page || ( !$more && 1 == $page ) ) 170 162 echo '</a>'; 171 163 } 172 echo $after; 173 } else { 174 if ( $more ) { 175 echo $before; 176 $i = $page - 1; 177 if ( $i && $more ) { 164 if ( '' != $all_page_link ) { 165 echo ' '; 166 if ( 0 != $page ) { 178 167 if ( '' == get_settings('permalink_structure') ) 179 echo '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>';168 echo '<a href="' . get_permalink() . '&page=' . 0 . '">'; 180 169 else 181 echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';170 echo '<a href="' . trailingslashit( get_permalink() ) . 0 . '/">'; 182 171 } 183 $i = $page + 1; 184 if ( $i <= $numpages && $more ) { 172 echo $all_page_link; 173 if ( 0 != $page ) 174 echo '</a>'; 175 } 176 echo $after; 177 } else if ( $more ) { 178 echo $before; 179 $i = $page - 1; 180 if ( $i > 0 ) { 181 if ( '' == get_settings('permalink_structure') ) 182 echo '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>'; 183 else 184 echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>'; 185 } 186 $i = $page + 1; 187 if ( $i <= $numpages ) { 188 if ( '' == get_settings('permalink_structure') ) 189 echo '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>'; 190 else 191 echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>'; 192 } 193 if ( '' != $all_page_link ) { 194 echo ' '; 195 if ( 0 != $page ) { 185 196 if ( '' == get_settings('permalink_structure') ) 186 echo '<a href="' .get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>';197 echo '<a href="' . get_permalink() . '&page=' . 0 . '">'; 187 198 else 188 echo '<a href="' .get_permalink().$i.'/">'.$nextpagelink.'</a>';199 echo '<a href="' . trailingslashit( get_permalink() ) . 0 . '/">'; 189 200 } 190 echo $after; 201 echo $all_page_link; 202 if ( 0 != $page ) 203 echo '</a>'; 191 204 } 205 echo $after; 192 206 } 193 207 } 194 208 } -
wp-includes/query.php
1098 1098 $currentmonth = mysql2date('m', $post->post_date); 1099 1099 $numpages = 1; 1100 1100 $page = get_query_var('page'); 1101 if ( !$page )1101 if ( !$page && 0 !== $page ) 1102 1102 $page = 1; 1103 1103 if ( is_single() || is_page() ) 1104 1104 $more = 1; … … 1112 1112 $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content); 1113 1113 $pages = explode('<!--nextpage-->', $content); 1114 1114 $numpages = count($pages); 1115 if ( !$page ) 1116 $pages = array(join('', $pages)); 1115 1117 } else { 1116 1118 $pages[0] = $post->post_content; 1117 1119 $multipage = 0;
