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