Ticket #13578: 13578.diff
| File 13578.diff, 4.7 KB (added by , 13 years ago) |
|---|
-
wp-includes/post-template.php
602 602 * Quicktag one or more times). This tag must be within The Loop. 603 603 * 604 604 * The defaults for overwriting are: 605 * 'next_or_number' - Default is 'number' (string). Indicates whether page606 * numbers should be used. Valid values are number and next.607 * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page.608 * of the bookmark.609 * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to610 * previous page, if available.611 * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in612 * the parameter string will be replaced with the page number, so Page %613 * generates "Page 1", "Page 2", etc. Defaults to %, just the page number.614 605 * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to 615 606 * each bookmarks. 616 607 * 'after' - Default is '</p>' (string). The html or text to append to each … … 621 612 * 'link_after' - Default is '' (string). The html or text to append to each 622 613 * Pages link inside the <a> tag. Also appended to the current item, which 623 614 * is not linked. 615 * 'next_or_number' - Default is 'number' (string). Indicates whether page 616 * numbers should be used. Valid values are number and next. 617 * 'separator' - Default is ' ' (string). Text used only between numbers. 618 * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. 619 * of the bookmark. 620 * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to 621 * previous page, if available. 622 * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in 623 * the parameter string will be replaced with the page number, so Page % 624 * generates "Page 1", "Page 2", etc. Defaults to %, just the page number. 625 * 'echo' - Default is 1 (integer). When not 0, this triggers the HTML to be 626 * echoed and then returned. 624 627 * 625 628 * @since 1.2.0 626 * @access private627 629 * 628 630 * @param string|array $args Optional. Overwrite the defaults. 629 631 * @return string Formatted output in HTML. 630 632 */ 631 function wp_link_pages( $args = '') {633 function wp_link_pages( $args = '' ) { 632 634 $defaults = array( 633 'before' => '<p>' . __('Pages:'), 'after' => '</p>', 634 'link_before' => '', 'link_after' => '', 635 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 636 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 637 'echo' => 1 635 'before' => '<p>' . __( 'Pages:' ), 636 'after' => '</p>', 637 'link_before' => '', 638 'link_after' => '', 639 'next_or_number' => 'number', 640 'separator' => ' ', 641 'nextpagelink' => __( 'Next page' ), 642 'previouspagelink' => __( 'Previous page' ), 643 'pagelink' => '%', 644 'echo' => 1 638 645 ); 639 646 640 647 $r = wp_parse_args( $args, $defaults ); … … 647 654 if ( $multipage ) { 648 655 if ( 'number' == $next_or_number ) { 649 656 $output .= $before; 650 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 651 $j = str_replace('%',$i,$pagelink); 652 $output .= ' '; 653 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 654 $output .= _wp_link_page($i); 657 for ( $i = 1; $i <= $numpages; $i++ ) { 658 $link = $link_before . str_replace( '%', $i, $pagelink ) . $link_after; 659 if ( ( $i != $page ) || ( ( !$more ) && ( 1 == $page ) ) ) { 660 $link = _wp_link_page( $i ) . $link . '</a>'; 655 661 } 656 $output .= $link_before . $j . $link_after; 657 if ( ($i != $page) || ((!$more) && ($page==1)) ) 658 $output .= '</a>'; 662 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 663 $output .= $separator . $link; 659 664 } 660 665 $output .= $after; 661 666 } else { … … 663 668 $output .= $before; 664 669 $i = $page - 1; 665 670 if ( $i && $more ) { 666 $ output .= _wp_link_page($i);667 $output .= $link_before. $previouspagelink . $link_after . '</a>';671 $link = _wp_link_page( $i ) . $link_before . $previouspagelink . $link_after . '</a>'; 672 $output .= apply_filters( 'wp_link_pages_link', $link, $i ); 668 673 } 669 674 $i = $page + 1; 670 675 if ( $i <= $numpages && $more ) { 671 $output .= _wp_link_page($i); 672 $output .= $link_before. $nextpagelink . $link_after . '</a>'; 676 $link = _wp_link_page( $i ) . $link_before . $nextpagelink . $link_after . '</a>'; 677 // Only add the separator when we have a previous link 678 if ( strpos( $output, $previouspagelink ) ) 679 $output .= $separator; 680 $output .= apply_filters( 'wp_link_pages_link', $link, $i ); 673 681 } 674 682 $output .= $after; 675 683 } 676 684 } 677 685 } 678 686 687 $output = apply_filters( 'wp_link_pages', $output, $args ); 688 679 689 if ( $echo ) 680 690 echo $output; 681 691