Skip to content

Commit

Permalink
Rename using_mod_rewrite() to using_index_permalinks(). Start removin…
Browse files Browse the repository at this point in the history
…g blogfilename references.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
rboren committed Sep 18, 2004
1 parent a88c2a9 commit 76d4882
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 7 additions & 8 deletions wp-includes/functions.php
Expand Up @@ -1066,7 +1066,7 @@ function remove_action($tag, $function_to_remove, $priority = 10) {
remove_filter($tag, $function_to_remove, $priority);
}

function using_mod_rewrite($permalink_structure = '') {
function using_index_permalinks($permalink_structure = '') {
if (empty($permalink_structure)) {
$permalink_structure = get_settings('permalink_structure');

Expand All @@ -1076,7 +1076,7 @@ function using_mod_rewrite($permalink_structure = '') {
}

// If the index is not in the permalink, we're using mod_rewrite.
if (! preg_match('#^/*' . get_settings('blogfilename') . '#', $permalink_structure)) {
if (preg_match('#^/*index.php#', $permalink_structure)) {
return true;
}

Expand All @@ -1103,10 +1103,9 @@ function page_permastruct() {
return '';
}

$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
$index = get_settings('blogfilename');
$index = 'index.php';
$prefix = '';
if (preg_match('#^/*' . $index . '#', $front)) {
if (using_index_permalinks()) {
$prefix = $index . '/';
}

Expand Down Expand Up @@ -1171,7 +1170,7 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {

$num_tokens = count($tokens[0]);

$index = get_settings('blogfilename');;
$index = 'index.php';
$feedindex = $index;
$trackbackindex = $index;
for ($i = 0; $i < $num_tokens; ++$i) {
Expand Down Expand Up @@ -1253,9 +1252,9 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';
$pageregex = 'page/?([0-9]{1,})/?$';
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
$index = get_settings('blogfilename');
$index = 'index.php';
$prefix = '';
if (! using_mod_rewrite($permalink_structure)) {
if (using_index_permalinks($permalink_structure)) {
$prefix = $index . '/';
}

Expand Down
15 changes: 8 additions & 7 deletions wp-includes/template-functions-links.php
Expand Up @@ -153,9 +153,9 @@ function get_feed_link($feed='rss2') {
if ('' != $permalink) {
$do_perma = 1;
$feed_url = get_settings('home');
$index = get_settings('blogfilename');
$index = 'index.php';
$prefix = '';
if (preg_match('#^/*' . $index . '#', $permalink)) {
if (using_index_permalinks()) {
$feed_url .= '/' . $index;
}

Expand Down Expand Up @@ -418,6 +418,7 @@ function get_pagenum_link($pagenum = 1){
$page_modstring = "page/";
$page_modregex = "page/?";
$permalink = 0;
$index = 'index.php';

$home_root = parse_url(get_settings('home'));
$home_root = $home_root['path'];
Expand Down Expand Up @@ -448,19 +449,19 @@ function get_pagenum_link($pagenum = 1){
$permalink = 1;

// If it's not a path info permalink structure, trim the index.
if (using_mod_rewrite()) {
$qstr = preg_replace("#/*" . get_settings('blogfilename') . "/*#", '/', $qstr);
if (! using_index_permalinks()) {
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
} else {
// If using path info style permalinks, make sure the index is in
// the URI.
if (strpos($qstr, get_settings('blogfilename')) === false) {
$qstr = '/' . get_settings('blogfilename') . $qstr;
if (strpos($qstr, $index) === false) {
$qstr = '/' . $index . $qstr;
}
}

$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
} else {
$qstr = get_settings('blogfilename') . $querystring_start.$page_querystring.$querystring_equal.$pagenum;
$qstr = $index . $querystring_start.$page_querystring.$querystring_equal.$pagenum;
}
}

Expand Down

0 comments on commit 76d4882

Please sign in to comment.