Ticket #148: 148c.diff
| File 148c.diff, 7.0 KB (added by mdawaffe, 6 years ago) |
|---|
-
wp-includes/default-filters.php
145 145 // Actions 146 146 add_action('wp_head', 'rsd_link'); 147 147 add_action('publish_future_post', 'wp_publish_post', 10, 1); 148 add_action('wp_head', 'noindex', 1); 148 if ( '0' == get_option('blog_public') ) 149 add_action('wp_head', 'noindex', 1); 149 150 add_action('wp_head', 'wp_print_scripts'); 150 151 if(!defined('DOING_CRON')) 151 152 add_action('init', 'wp_cron'); -
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 60 61 function get_the_content( $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {61 function get_the_content( $more_link_text = '(more...)', $stripteaser = 0 ) { 62 62 global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; 63 63 global $preview; 64 global $pagenow;65 64 $output = ''; 66 65 67 66 if ( !empty($post->post_password) ) { // if there's a password … … 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]) ) … … 125 119 return apply_filters('get_the_excerpt', $output); 126 120 } 127 121 128 129 122 function wp_link_pages($args = '') { 130 123 if ( is_array($args) ) 131 124 $r = &$args; … … 133 126 parse_str($args, $r); 134 127 135 128 $defaults = array('before' => '<p>' . __('Pages:'), 'after' => '</p>', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 136 'previouspagelink' => __('Previous page'), 'pagelink' => '%', ' more_file' => '', 'echo' => 1);129 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'all_page_link' => '', 'echo' => 1); 137 130 $r = array_merge($defaults, $r); 138 131 extract($r); 139 132 140 global $id, $page, $numpages, $multipage, $more, $pagenow; 141 if ( $more_file != '' ) 142 $file = $more_file; 143 else 144 $file = $pagenow; 133 global $id, $page, $numpages, $multipage, $more; 145 134 146 135 $output = ''; 147 136 if ( $multipage ) { … … 150 139 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 151 140 $j = str_replace('%',"$i",$pagelink); 152 141 $output .= ' '; 153 if ( ($i != $page) || ((!$more) && ($page==1)) ) {142 if ( $i != $page || ( !$more && 1 == $page ) ) { 154 143 if ( '' == get_option('permalink_structure') ) 155 144 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; 156 145 else 157 146 $output .= '<a href="' . trailingslashit( get_permalink() ) . $i . '/">'; 158 147 } 159 148 $output .= $j; 160 if ( ($i != $page) || ((!$more) && ($page==1)) )149 if ( $i != $page || ( !$more && 1 == $page ) ) 161 150 $output .= '</a>'; 162 151 } 163 $output .= $after; 164 } else { 165 if ( $more ) { 166 $output .= $before; 167 $i = $page - 1; 168 if ( $i && $more ) { 152 if ( $all_page_link ) { 153 $output .= ' '; 154 if ( 0 != $page ) { 169 155 if ( '' == get_option('permalink_structure') ) 170 $output .= '<a href="' . get_permalink() . '&page= ' . $i . '">'.$previouspagelink.'</a>';156 $output .= '<a href="' . get_permalink() . '&page=0" rel="nofollow">'; 171 157 else 172 $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';158 $output .= '<a href="' . trailingslashit( get_permalink() ) . '0/" rel="nofollow">'; 173 159 } 174 $i = $page + 1; 175 if ( $i <= $numpages && $more ) { 160 $output .= $all_page_link; 161 if ( 0 != $page ) 162 $output .= '</a>'; 163 } 164 $output .= $after; 165 } else if ( $more ) { 166 $output .= $before; 167 $i = $page - 1; 168 if ( 0 < $i ) { 169 if ( '' == get_option('permalink_structure') ) 170 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>'; 171 else 172 $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>'; 173 } 174 $i = $page + 1; 175 if ( $i <= $numpages ) { 176 if ( '' == get_option('permalink_structure') ) 177 $output .= '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>'; 178 else 179 $output .= '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>'; 180 } 181 if ( $all_page_link ) { 182 $output .= ' '; 183 if ( 0 != $page ) { 176 184 if ( '' == get_option('permalink_structure') ) 177 $output .= '<a href="' .get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>';185 $output .= '<a href="' . get_permalink() . '&page=0">'; 178 186 else 179 $output .= '<a href="' .get_permalink().$i.'/">'.$nextpagelink.'</a>';187 $output .= '<a href="' . trailingslashit( get_permalink() ) . '0/">'; 180 188 } 181 $output .= $after; 189 $output .= $all_page_link; 190 if ( 0 != $page ) 191 $output .= '</a>'; 182 192 } 193 $output .= $after; 183 194 } 184 195 } 185 196 -
wp-includes/query.php
581 581 $q['page'] = trim($q['page'], '/'); 582 582 $q['page'] = (int) $q['page']; 583 583 $q['page'] = abs($q['page']); 584 if ( 0 == $q['page'] ) 585 add_action('wp_head', 'noindex', 1); 584 586 } 585 587 586 588 $add_hours = intval(get_option('gmt_offset')); … … 1098 1100 $currentmonth = mysql2date('m', $post->post_date); 1099 1101 $numpages = 1; 1100 1102 $page = get_query_var('page'); 1101 if ( !$page )1103 if ( !$page && 0 !== $page ) 1102 1104 $page = 1; 1103 1105 if ( is_single() || is_page() ) 1104 1106 $more = 1; … … 1112 1114 $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content); 1113 1115 $pages = explode('<!--nextpage-->', $content); 1114 1116 $numpages = count($pages); 1117 if ( !$page ) 1118 $pages = array(join('', $pages)); 1115 1119 } else { 1116 1120 $pages[0] = $post->post_content; 1117 1121 $multipage = 0; -
wp-includes/general-template.php
728 728 } 729 729 730 730 function noindex() { 731 // If the blog is not public, tell robots to go away. 732 if ( '0' == get_option('blog_public') ) 733 echo "<meta name='robots' content='noindex,nofollow' />\n"; 731 echo "<meta name='robots' content='noindex,nofollow' />\n"; 734 732 } 735 733 736 734 /**
