Ticket #25735: 25735.2.patch
File 25735.2.patch, 2.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/general-template.php
2027 2027 $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $prev_text . '</a>'; 2028 2028 endif; 2029 2029 for ( $n = 1; $n <= $total; $n++ ) : 2030 $n_display = number_format_i18n($n);2031 2030 if ( $n == $current ) : 2032 $page_links[] = "<span class='page-numbers current'> $n_display</span>";2031 $page_links[] = "<span class='page-numbers current'>" . number_format_i18n($n) . "</span>"; 2033 2032 $dots = true; 2034 2033 else : 2035 2034 if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : … … 2038 2037 if ( $add_args ) 2039 2038 $link = add_query_arg( $add_args, $link ); 2040 2039 $link .= $add_fragment; 2041 $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'> $n_display</a>";2040 $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . number_format_i18n($n) . "</a>"; 2042 2041 $dots = true; 2043 2042 elseif ( $dots && !$show_all ) : 2044 2043 $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; -
tests/phpunit/tests/general/template.php
1 <?php 2 3 class Tests_General_Template extends WP_UnitTestCase { 4 5 private $i18n_count = 0; 6 7 function increment_i18n_count() { 8 $this->i18n_count += 1; 9 } 10 11 /** 12 * @ticket 25735 13 */ 14 function test_paginate_links_number_format() { 15 $this->i18n_count = 0; 16 add_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) ); 17 paginate_links( array( 18 'total' => 100, 19 'current' => 50, 20 'show_all' => false, 21 'prev_next' => true, 22 'end_size' => 1, 23 'mid_size' => 1, 24 ) ); 25 // The links should be: 26 // < Previous 1 ... 49 50 51 ... 100 Next > 27 $this->assertEquals( 5, $this->i18n_count ); 28 remove_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) ); 29 } 30 31 }