Fix a path info paging bug. Add using_mod_rewrite().
git-svn-id: https://develop.svn.wordpress.org/trunk@1555 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
230d603f6d
commit
a1d2b2eb86
|
@ -1163,6 +1163,23 @@ function remove_action($tag, $function_to_remove, $priority = 10) {
|
||||||
remove_filter($tag, $function_to_remove, $priority);
|
remove_filter($tag, $function_to_remove, $priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function using_mod_rewrite($permalink_structure = '') {
|
||||||
|
if (empty($permalink_structure)) {
|
||||||
|
$permalink_structure = get_settings('permalink_structure');
|
||||||
|
|
||||||
|
if (empty($permalink_structure)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the index is not in the permalink, we're using mod_rewrite.
|
||||||
|
if (! preg_match('#^/*' . get_settings('blogfilename') . '#', $permalink_structure)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function preg_index($number, $matches = '') {
|
function preg_index($number, $matches = '') {
|
||||||
$match_prefix = '$';
|
$match_prefix = '$';
|
||||||
$match_suffix = '';
|
$match_suffix = '';
|
||||||
|
@ -1251,9 +1268,9 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
|
||||||
|
|
||||||
$num_tokens = count($tokens[0]);
|
$num_tokens = count($tokens[0]);
|
||||||
|
|
||||||
$index = 'index.php';
|
$index = get_settings('blogfilename');;
|
||||||
$feedindex = 'index.php';
|
$feedindex = $index;
|
||||||
$trackbackindex = 'index.php';
|
$trackbackindex = $index;
|
||||||
for ($i = 0; $i < $num_tokens; ++$i) {
|
for ($i = 0; $i < $num_tokens; ++$i) {
|
||||||
if (0 < $i) {
|
if (0 < $i) {
|
||||||
$queries[$i] = $queries[$i - 1] . '&';
|
$queries[$i] = $queries[$i - 1] . '&';
|
||||||
|
@ -1334,7 +1351,7 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||||
$index = get_settings('blogfilename');
|
$index = get_settings('blogfilename');
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
if (preg_match('#^/*' . $index . '#', $front)) {
|
if (! using_mod_rewrite($permalink_structure)) {
|
||||||
$prefix = $index . '/';
|
$prefix = $index . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,8 +349,14 @@ function get_pagenum_link($pagenum = 1){
|
||||||
$permalink = 1;
|
$permalink = 1;
|
||||||
|
|
||||||
// If it's not a path info permalink structure, trim the index.
|
// If it's not a path info permalink structure, trim the index.
|
||||||
if ( ! preg_match('#^/*' . get_settings('blogfilename') . '#', get_settings('permalink_structure'))) {
|
if (using_mod_rewrite()) {
|
||||||
$qstr = preg_replace("#/*" . get_settings('blogfilename') . "/*#", '/', $qstr);
|
$qstr = preg_replace("#/*" . get_settings('blogfilename') . "/*#", '/', $qstr);
|
||||||
|
} else {
|
||||||
|
// If using path info style permalinks, make sure the index is in
|
||||||
|
// the URI.
|
||||||
|
if (! strstr($qstr, get_settings('blogfilename'))) {
|
||||||
|
$qstr = '/' . get_settings('blogfilename') . $qstr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
||||||
|
|
Loading…
Reference in New Issue