More rewrite fixes. s/[0-9a-z_-]/[_0-9a-z-]/

git-svn-id: http://svn.automattic.com/wordpress/trunk@965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-03-09 03:55:01 +00:00
parent 06fa93c297
commit 87c74b9c6e
2 changed files with 11 additions and 9 deletions

View File

@ -105,7 +105,7 @@ if ('/' != substr($site_root, -1)) $site_root = $site_root . '/';
<textarea rows="5" style="width: 100%;">RewriteEngine On
RewriteBase <?php echo $site_root; ?>
<?php
$rewrite = rewrite_rules();
$rewrite = rewrite_rules('', $permalink_structure);
foreach ($rewrite as $match => $query) {
echo 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA]\n";
}

View File

@ -263,7 +263,7 @@ function url_to_postid($url = '') {
'([0-9]{4})?',
'([0-9]{1,2})?',
'([0-9]{1,2})?',
'([0-9a-z-]+)?',
'([_0-9a-z-]+)?',
'([0-9]+)?'
);
@ -1367,7 +1367,7 @@ function hilite($text) {
* If empty, $1, $2, $3, etc. are used.
* Returns an associate array of matches and queries.
*/
function rewrite_rules($matches = '') {
function rewrite_rules($matches = '', $permalink_structure = '') {
function preg_index($number, $matches = '') {
$match_prefix = '$';
@ -1383,10 +1383,12 @@ function rewrite_rules($matches = '') {
$rewrite = array();
$permalink_structure = get_settings('permalink_structure');
if (empty($permalink_structure)) {
return $rewrite;
$permalink_structure = get_settings('permalink_structure');
if (empty($permalink_structure)) {
return $rewrite;
}
}
$rewritecode = array(
@ -1401,7 +1403,7 @@ function rewrite_rules($matches = '') {
'([0-9]{4})?',
'([0-9]{1,2})?',
'([0-9]{1,2})?',
'([0-9a-z_-]+)?',
'([_0-9a-z-]+)?',
'([0-9]+)?'
);
@ -1456,11 +1458,11 @@ function rewrite_rules($matches = '') {
$trackbackmatch .= $trackbackregex;
// Site feed
$sitefeedmatch = 'feed/?([0-9a-z_-]+)?/?$';
$sitefeedmatch = 'feed/?([_0-9a-z-]+)?/?$';
$sitefeedquery = $site_root . 'wp-feed.php?feed=' . preg_index(1, $matches);
// Site comment feed
$sitecommentfeedmatch = 'comments/feed/?([0-9a-z_-]+)?/?$';
$sitecommentfeedmatch = 'comments/feed/?([_0-9a-z-]+)?/?$';
$sitecommentfeedquery = $site_root . 'wp-feed.php?feed=' . preg_index(1, $matches) . '&withcomments=1';
// Code for nice categories and authors, currently not very flexible