Make WordPress Core


Ignore:
Timestamp:
12/03/2004 02:38:11 AM (22 years ago)
Author:
rboren
Message:

Move rewrite and permalink functions into WP_Rewrite class.

File:
1 edited

Legend:

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

    r1868 r1908  
    8585
    8686function get_page_link($id = false) {
    87         global $post;
     87        global $post, $wp_rewrite;
    8888
    8989        if (! $id) {
    … …  
    9595        if ('' != $permalink) {
    9696                $link = get_page_uri($id);
    97                 if (using_index_permalinks()) {
     97                if ($wp_rewrite->using_index_permalinks()) {
    9898                        $link = 'index.php/' . $link;
    9999                }
    … …  
    107107
    108108function get_year_link($year) {
    109     global $querystring_start, $querystring_equal;
     109        global $querystring_start, $querystring_equal, $wp_rewrite;
    110110    if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
    111                 $yearlink = get_year_permastruct();
     111                $yearlink = $wp_rewrite->get_year_permastruct();
    112112    if (!empty($yearlink)) {
    113113        $yearlink = str_replace('%year%', $year, $yearlink);
    114         return get_settings('home') . $yearlink;
     114        return get_settings('home') . trailingslashit($yearlink);
    115115    } else {
    116116        return get_settings('home') .'/'. get_settings('blogfilename') .$querystring_start.'m'.$querystring_equal.$year;
    … …  
    119119
    120120function get_month_link($year, $month) {
    121     global $querystring_start, $querystring_equal;
     121    global $querystring_start, $querystring_equal, $wp_rewrite;
    122122    if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
    123123    if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
    124                 $monthlink = get_month_permastruct();
     124                $monthlink = $wp_rewrite->get_month_permastruct();
    125125    if (!empty($monthlink)) {
    126126        $monthlink = str_replace('%year%', $year, $monthlink);
    127127        $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
    128         return get_settings('home') . $monthlink;
     128        return get_settings('home') . trailingslashit($monthlink);
    129129    } else {
    130130        return get_settings('home') .'/'. get_settings('blogfilename') .$querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2);
    … …  
    133133
    134134function get_day_link($year, $month, $day) {
    135     global $querystring_start, $querystring_equal;
     135    global $querystring_start, $querystring_equal, $wp_rewrite;
    136136    if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
    137137    if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
    138138    if (!$day) $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600));
    139139
    140                 $daylink = get_day_permastruct();
     140                $daylink = $wp_rewrite->get_day_permastruct();
    141141    if (!empty($daylink)) {
    142142        $daylink = str_replace('%year%', $year, $daylink);
    143143        $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
    144144        $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
    145         return get_settings('home') . $daylink;
     145        return get_settings('home') . trailingslashit($daylink);
    146146    } else {
    147147        return get_settings('home') .'/'. get_settings('blogfilename') .$querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2).zeroise($day, 2);
    … …  
    150150
    151151function get_feed_link($feed='rss2') {
     152        global $wp_rewrite;
    152153    $do_perma = 0;
    153154    $feed_url = get_settings('siteurl');
    … …  
    160161        $index = 'index.php';
    161162        $prefix = '';
    162         if (using_index_permalinks()) {
     163        if ($wp_rewrite->using_index_permalinks()) {
    163164            $feed_url .= '/' . $index;
    164165        }
    … …  
    417418
    418419function get_pagenum_link($pagenum = 1){
     420        global $wp_rewrite;
     421
    419422   $qstr = $_SERVER['REQUEST_URI'];
    420423
    … …  
    454457
    455458         // If it's not a path info permalink structure, trim the index.
    456          if (! using_index_permalinks()) {
     459         if (! $wp_rewrite->using_index_permalinks()) {
    457460           $qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
    458461         } else {
Note: See TracChangeset for help on using the changeset viewer.