Make WordPress Core

Changeset 640


Ignore:
Timestamp:
12/22/2003 11:00:45 PM (22 years ago)
Author:
emc3
Message:

Fixed %post_id% token handling. Fixed pingback link detection.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-permalink.php

    r628 r640  
    105105    '%monthnum%',
    106106    '%day%',
    107     '%postname%'
     107    '%postname%',
     108    '%post_id%'
    108109);
    109110$rewritereplace = array(
     
    111112    '([0-9]{1,2})?',
    112113    '([0-9]{1,2})?',
    113     '([0-9a-z-]+)?'
     114    '([0-9a-z-]+)?',
     115    '([0-9]+)?'
    114116);
    115117$queryreplace = array (
     
    117119    'monthnum=',
    118120    'day=',
    119     'name='
     121    'name=',
     122    'p='
    120123);
    121124
  • trunk/wp-includes/functions.php

    r638 r640  
    494494        '%monthnum%',
    495495        '%day%',
    496         '%postname%'
     496        '%postname%',
     497        '%post_id%'
    497498    );
    498499    $rewritereplace = array(
     
    500501        '([0-9]{1,2})?',
    501502        '([0-9]{1,2})?',
    502         '([0-9a-z-]+)?'
     503        '([0-9a-z-]+)?',
     504        '([0-9]+)?'
    503505    );
    504506
     
    517519        $value = $values[$i+1];
    518520
    519         // Create a variable named $year, $monthnum, $day, or $postname:
     521        // Create a variable named $year, $monthnum, $day, $postname, or $post_id:
    520522        $$name = $value;
    521523    }
    522524   
    523     // Build a WHERE clause, making the values safe along the way:
     525    // If using %post_id%, we're done:
     526    if (intval($post_id)) return intval($post_id);
     527
     528    // Otherwise, build a WHERE clause, making the values safe along the way:
    524529    if ($year) $where .= " AND YEAR(post_date) = " . intval($year);
    525530    if ($monthnum) $where .= " AND MONTH(post_date) = " . intval($monthnum);
     
    528533
    529534    // Run the query to get the post ID:
    530     return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
     535    $id = intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
     536
     537    return $id;
    531538}
    532539
  • trunk/wp-includes/template-functions.php

    r634 r640  
    420420                date('n', $unixtime),
    421421                date('j', $unixtime),
    422                 $post->post_name
     422                $post->post_name,
     423                $post->ID
    423424            );
    424425            return $siteurl . str_replace($rewritecode, $rewritereplace, get_settings('permalink_structure'));
Note: See TracChangeset for help on using the changeset viewer.