Make WordPress Core

Changeset 1555


Ignore:
Timestamp:
08/23/2004 11:28:14 PM (21 years ago)
Author:
rboren
Message:

Fix a path info paging bug. Add using_mod_rewrite().

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1540 r1555  
    11641164}
    11651165
     1166function using_mod_rewrite($permalink_structure = '') {
     1167    if (empty($permalink_structure)) {
     1168        $permalink_structure = get_settings('permalink_structure');
     1169   
     1170        if (empty($permalink_structure)) {
     1171            return false;
     1172        }
     1173    }
     1174
     1175    // If the index is not in the permalink, we're using mod_rewrite.
     1176    if (! preg_match('#^/*' . get_settings('blogfilename') . '#', $permalink_structure)) {
     1177      return true;
     1178    }
     1179   
     1180    return false;
     1181}
     1182
    11661183function preg_index($number, $matches = '') {
    11671184    $match_prefix = '$';
     
    12521269    $num_tokens = count($tokens[0]);
    12531270
    1254     $index = 'index.php';
    1255     $feedindex = 'index.php';
    1256     $trackbackindex = 'index.php';
     1271    $index = get_settings('blogfilename');;
     1272    $feedindex = $index;
     1273    $trackbackindex = $index;
    12571274    for ($i = 0; $i < $num_tokens; ++$i) {
    12581275             if (0 < $i) {
     
    13351352    $index = get_settings('blogfilename');
    13361353    $prefix = '';
    1337     if (preg_match('#^/*' . $index . '#', $front)) {
     1354    if (! using_mod_rewrite($permalink_structure)) {
    13381355        $prefix = $index . '/';
    13391356    }
  • trunk/wp-includes/template-functions-links.php

    r1537 r1555  
    350350
    351351     // If it's not a path info permalink structure, trim the index.
    352      if ( ! preg_match('#^/*' . get_settings('blogfilename') . '#', get_settings('permalink_structure'))) {
     352     if (using_mod_rewrite()) {
    353353       $qstr = preg_replace("#/*" . get_settings('blogfilename') . "/*#", '/', $qstr);
     354     } else {
     355       // If using path info style permalinks, make sure the index is in
     356       // the URI.
     357       if (! strstr($qstr, get_settings('blogfilename'))) {
     358         $qstr = '/' . get_settings('blogfilename') . $qstr;
     359       }
    354360     }
    355361
Note: See TracChangeset for help on using the changeset viewer.