WordPress.org

Make WordPress Core

Changeset 5481


Ignore:
Timestamp:
05/16/07 02:47:24 (7 years ago)
Author:
rob1n
Message:

Fix get_pagenum_link(). fixes #3930

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r5454 r5481  
    474474    $home_root = preg_quote( trailingslashit( $home_root ), '|' ); 
    475475     
    476     $request = preg_replace('|^'. $home_root . '|', '', $qstr); 
    477     $request = preg_replace('|^/+|', '', $qstr); 
    478      
    479     $index = $_SERVER['PHP_SELF']; 
    480     $index = preg_replace('|^'. $home_root . '|', '', $index); 
    481     $index = preg_replace('|^/+|', '', $index); 
     476    $request = preg_replace('|^'. $home_root . '|', '', $request); 
     477    $request = preg_replace('|^/+|', '', $request); 
    482478     
    483479    if ( !$wp_rewrite->using_permalinks() ) { 
     
    485481         
    486482        if ( $pagenum > 1 ) { 
    487             $result = add_query_arg( 'paged', $pagenum, $request ); 
     483            $result = add_query_arg( 'paged', $pagenum, $base . $request ); 
    488484        } else { 
    489485            $result = $base . $request; 
    490486        } 
    491487    } else { 
     488        $request = preg_replace( '|/?page/(.+)/?$|', '', $request); 
     489         
    492490        $qs_regex = '|\?.*?$|'; 
    493491        preg_match( $qs_regex, $request, $qs_match ); 
     
    500498        } 
    501499         
    502         $base = get_bloginfo( 'home' ) . '/'; 
     500        $base = trailingslashit( get_bloginfo( 'url' ) ); 
    503501         
    504502        if ( $wp_rewrite->using_index_permalinks() && $pagenum > 1 ) { 
     
    506504        } 
    507505         
    508         $request = ( $pagenum > 1 ) ? $request . user_trailingslashit( 'page/' . $pagenum, 'paged' ) : $request; 
     506        if ( $pagenum > 1 ) { 
     507            $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( 'page/' . $pagenum, 'paged' ); 
     508        } else { 
     509            $request = user_trailingslashit( $request ); 
     510        } 
     511         
    509512        $result = $base . $request . $query_string; 
    510513    } 
Note: See TracChangeset for help on using the changeset viewer.