mirror of
git://develop.git.wordpress.org/
synced 2025-04-21 04:31:55 +02:00
Permalinks: Revert [59966].
The original commit ignores some of the arguments that can be passed to the function, mainly `base` and `format`. Reverting for now. Props peterwilsoncc. git-svn-id: https://develop.svn.wordpress.org/trunk@60088 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6b9418647a
commit
5da6814c90
@ -4713,7 +4713,6 @@ function paginate_links( $args = '' ) {
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
}
|
||||
$link .= $args['add_fragment'];
|
||||
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
|
||||
|
||||
$page_links[] = sprintf(
|
||||
'<a class="prev page-numbers" href="%s">%s</a>',
|
||||
@ -4746,7 +4745,6 @@ function paginate_links( $args = '' ) {
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
}
|
||||
$link .= $args['add_fragment'];
|
||||
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
|
||||
|
||||
$page_links[] = sprintf(
|
||||
'<a class="page-numbers" href="%s">%s</a>',
|
||||
@ -4771,7 +4769,6 @@ function paginate_links( $args = '' ) {
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
}
|
||||
$link .= $args['add_fragment'];
|
||||
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
|
||||
|
||||
$page_links[] = sprintf(
|
||||
'<a class="next page-numbers" href="%s">%s</a>',
|
||||
|
@ -362,80 +362,4 @@ EXPECTED;
|
||||
$page_2_url = home_url() . '?foo=2';
|
||||
$this->assertContains( "<a class=\"page-numbers\" href=\"$page_2_url\">2</a>", $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 61393
|
||||
*/
|
||||
public function test_pagination_links_with_trailing_slash() {
|
||||
$this->set_permalink_structure( '/%postname%/' );
|
||||
|
||||
$args = array(
|
||||
'base' => 'http://example.org/category/test/%_%',
|
||||
'format' => 'page/%#%',
|
||||
'total' => 5,
|
||||
'current' => 2,
|
||||
'prev_next' => true,
|
||||
);
|
||||
|
||||
$links = paginate_links( $args );
|
||||
|
||||
// Test page 1 link (should have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'href="http://example.org/category/test/"',
|
||||
$links,
|
||||
'Page 1 link should have trailing slash when permalink structure has trailing slash'
|
||||
);
|
||||
|
||||
// Test page 3 link (should have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'href="http://example.org/category/test/page/3/"',
|
||||
$links,
|
||||
'Page 3 link should have trailing slash when permalink structure has trailing slash'
|
||||
);
|
||||
|
||||
// Test previous link (should have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'class="prev page-numbers" href="http://example.org/category/test/"',
|
||||
$links,
|
||||
'Previous link should have trailing slash when permalink structure has trailing slash'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 61393
|
||||
*/
|
||||
public function test_pagination_links_without_trailing_slash() {
|
||||
$this->set_permalink_structure( '/%postname%' );
|
||||
|
||||
$args = array(
|
||||
'base' => 'http://example.org/category/test/%_%',
|
||||
'format' => 'page/%#%',
|
||||
'total' => 5,
|
||||
'current' => 2,
|
||||
'prev_next' => true,
|
||||
);
|
||||
|
||||
$links = paginate_links( $args );
|
||||
|
||||
// Test page 1 link (should not have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'href="http://example.org/category/test"',
|
||||
$links,
|
||||
'Page 1 link should not have trailing slash when permalink structure has no trailing slash'
|
||||
);
|
||||
|
||||
// Test page 3 link (should not have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'href="http://example.org/category/test/page/3"',
|
||||
$links,
|
||||
'Page 3 link should not have trailing slash when permalink structure has no trailing slash'
|
||||
);
|
||||
|
||||
// Test previous link (should not have trailing slash).
|
||||
$this->assertStringContainsString(
|
||||
'class="prev page-numbers" href="http://example.org/category/test"',
|
||||
$links,
|
||||
'Previous link should not have trailing slash when permalink structure has no trailing slash'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user