Simplify template redirector. Collapse mutliple guard vars into one.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-09-13 08:05:30 +00:00
parent a34e77d72a
commit 37e39a2917

View File

@ -200,77 +200,70 @@ if (! empty($wp_template)) {
} }
// Template redirection // Template redirection
if ($pagenow != get_settings('blogfilename')) { if ($pagenow == get_settings('blogfilename')) {
// Noop. if (! isset($wp_did_template_redirect)) {
} else if (is_home() && (! isset($wp_did_home)) && if (is_home() &&
file_exists(ABSPATH . "wp-content/${wp_template}index.php")) { file_exists(ABSPATH . "wp-content/${wp_template}index.php")) {
$wp_did_home = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}index.php"); include(ABSPATH . "wp-content/${wp_template}index.php");
exit; exit;
} else if (is_single() && (! isset($wp_did_single)) && } else if (is_single() &&
file_exists(ABSPATH . "wp-content/${wp_template}single.php")) { file_exists(ABSPATH . "wp-content/${wp_template}single.php")) {
$wp_did_single = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}single.php"); include(ABSPATH . "wp-content/${wp_template}single.php");
exit; exit;
} else if (is_page() && (! isset($wp_did_page)) && } else if (is_page() &&
file_exists(ABSPATH . "wp-content/${wp_template}page.php")) { file_exists(ABSPATH . "wp-content/${wp_template}page.php")) {
$wp_did_page = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}page.php"); include(ABSPATH . "wp-content/${wp_template}page.php");
exit; exit;
} else if (is_category() && (! isset($wp_did_category)) && } else if (is_category() &&
file_exists(ABSPATH . "wp-content/${wp_template}category.php")) { file_exists(ABSPATH . "wp-content/${wp_template}category.php")) {
$wp_did_category = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}category.php"); include(ABSPATH . "wp-content/${wp_template}category.php");
exit; exit;
} else if (is_author() && (! isset($wp_did_author)) && } else if (is_author() &&
file_exists(ABSPATH . "wp-content/${wp_template}author.php")) { file_exists(ABSPATH . "wp-content/${wp_template}author.php")) {
$wp_did_author = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}author.php"); include(ABSPATH . "wp-content/${wp_template}author.php");
exit; exit;
} else if (is_date() && (! isset($wp_did_date)) && } else if (is_date() &&
file_exists(ABSPATH . "wp-content/${wp_template}date.php")) { file_exists(ABSPATH . "wp-content/${wp_template}date.php")) {
$wp_did_date = true; $wp_did_date = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}date.php"); include(ABSPATH . "wp-content/${wp_template}date.php");
exit; exit;
} else if (is_archive() && (! isset($wp_did_archive)) && } else if (is_archive() &&
file_exists(ABSPATH . "wp-content/${wp_template}archive.php")) { file_exists(ABSPATH . "wp-content/${wp_template}archive.php")) {
$wp_did_archive = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}archive.php"); include(ABSPATH . "wp-content/${wp_template}archive.php");
exit; exit;
} else if (is_search() && (! isset($wp_did_search)) && } else if (is_search() &&
file_exists(ABSPATH . "wp-content/${wp_template}search.php")) { file_exists(ABSPATH . "wp-content/${wp_template}search.php")) {
$wp_did_search = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}search.php"); include(ABSPATH . "wp-content/${wp_template}search.php");
exit; exit;
} else if (is_404() && (! isset($wp_did_404)) && } else if (is_404() &&
file_exists(ABSPATH . "wp-content/${wp_template}404.php")) { file_exists(ABSPATH . "wp-content/${wp_template}404.php")) {
$wp_did_404 = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}404.php"); include(ABSPATH . "wp-content/${wp_template}404.php");
exit; exit;
} else if (is_feed() && $pagenow != 'wp-feed.php') { } else if (is_feed()) {
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(dirname(__FILE__) . '/wp-feed.php'); include(dirname(__FILE__) . '/wp-feed.php');
exit; exit;
} else if ($pagenow != 'wp-trackback.php' && $tb == 1) { } else if ($tb == 1) {
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(dirname(__FILE__) . '/wp-trackback.php'); include(dirname(__FILE__) . '/wp-trackback.php');
exit; exit;
} else if ((! isset($wp_did_template_redirect)) && file_exists(ABSPATH . "wp-content/${wp_template}index.php")) } else if (file_exists(ABSPATH . "wp-content/${wp_template}index.php"))
{ {
$wp_did_home = true;
$wp_did_template_redirect = true; $wp_did_template_redirect = true;
include(ABSPATH . "wp-content/${wp_template}index.php"); include(ABSPATH . "wp-content/${wp_template}index.php");
exit; exit;
} }
}
}
if ($pagenow != 'post.php' && $pagenow != 'edit.php') { if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
if ( get_settings('gzipcompression') ) if ( get_settings('gzipcompression') )