mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
a34e77d72a
commit
37e39a2917
@ -200,76 +200,69 @@ 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() &&
|
||||||
} else if (is_single() && (! isset($wp_did_single)) &&
|
file_exists(ABSPATH . "wp-content/${wp_template}single.php")) {
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}single.php")) {
|
$wp_did_template_redirect = true;
|
||||||
$wp_did_single = true;
|
include(ABSPATH . "wp-content/${wp_template}single.php");
|
||||||
$wp_did_template_redirect = true;
|
exit;
|
||||||
include(ABSPATH . "wp-content/${wp_template}single.php");
|
} else if (is_page() &&
|
||||||
exit;
|
file_exists(ABSPATH . "wp-content/${wp_template}page.php")) {
|
||||||
} else if (is_page() && (! isset($wp_did_page)) &&
|
$wp_did_template_redirect = true;
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}page.php")) {
|
include(ABSPATH . "wp-content/${wp_template}page.php");
|
||||||
$wp_did_page = true;
|
exit;
|
||||||
$wp_did_template_redirect = true;
|
} else if (is_category() &&
|
||||||
include(ABSPATH . "wp-content/${wp_template}page.php");
|
file_exists(ABSPATH . "wp-content/${wp_template}category.php")) {
|
||||||
exit;
|
$wp_did_template_redirect = true;
|
||||||
} else if (is_category() && (! isset($wp_did_category)) &&
|
include(ABSPATH . "wp-content/${wp_template}category.php");
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}category.php")) {
|
exit;
|
||||||
$wp_did_category = true;
|
} else if (is_author() &&
|
||||||
$wp_did_template_redirect = true;
|
file_exists(ABSPATH . "wp-content/${wp_template}author.php")) {
|
||||||
include(ABSPATH . "wp-content/${wp_template}category.php");
|
$wp_did_template_redirect = true;
|
||||||
exit;
|
include(ABSPATH . "wp-content/${wp_template}author.php");
|
||||||
} else if (is_author() && (! isset($wp_did_author)) &&
|
exit;
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}author.php")) {
|
} else if (is_date() &&
|
||||||
$wp_did_author = true;
|
file_exists(ABSPATH . "wp-content/${wp_template}date.php")) {
|
||||||
$wp_did_template_redirect = true;
|
$wp_did_date = true;
|
||||||
include(ABSPATH . "wp-content/${wp_template}author.php");
|
$wp_did_template_redirect = true;
|
||||||
exit;
|
include(ABSPATH . "wp-content/${wp_template}date.php");
|
||||||
} else if (is_date() && (! isset($wp_did_date)) &&
|
exit;
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}date.php")) {
|
} else if (is_archive() &&
|
||||||
$wp_did_date = true;
|
file_exists(ABSPATH . "wp-content/${wp_template}archive.php")) {
|
||||||
$wp_did_template_redirect = true;
|
$wp_did_template_redirect = true;
|
||||||
include(ABSPATH . "wp-content/${wp_template}date.php");
|
include(ABSPATH . "wp-content/${wp_template}archive.php");
|
||||||
exit;
|
exit;
|
||||||
} else if (is_archive() && (! isset($wp_did_archive)) &&
|
} else if (is_search() &&
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}archive.php")) {
|
file_exists(ABSPATH . "wp-content/${wp_template}search.php")) {
|
||||||
$wp_did_archive = 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}archive.php");
|
exit;
|
||||||
exit;
|
} else if (is_404() &&
|
||||||
} else if (is_search() && (! isset($wp_did_search)) &&
|
file_exists(ABSPATH . "wp-content/${wp_template}404.php")) {
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}search.php")) {
|
$wp_did_template_redirect = true;
|
||||||
$wp_did_search = true;
|
include(ABSPATH . "wp-content/${wp_template}404.php");
|
||||||
$wp_did_template_redirect = true;
|
exit;
|
||||||
include(ABSPATH . "wp-content/${wp_template}search.php");
|
} else if (is_feed()) {
|
||||||
exit;
|
$wp_did_template_redirect = true;
|
||||||
} else if (is_404() && (! isset($wp_did_404)) &&
|
include(dirname(__FILE__) . '/wp-feed.php');
|
||||||
file_exists(ABSPATH . "wp-content/${wp_template}404.php")) {
|
exit;
|
||||||
$wp_did_404 = true;
|
} else if ($tb == 1) {
|
||||||
$wp_did_template_redirect = true;
|
$wp_did_template_redirect = true;
|
||||||
include(ABSPATH . "wp-content/${wp_template}404.php");
|
include(dirname(__FILE__) . '/wp-trackback.php');
|
||||||
exit;
|
exit;
|
||||||
} else if (is_feed() && $pagenow != 'wp-feed.php') {
|
} else if (file_exists(ABSPATH . "wp-content/${wp_template}index.php"))
|
||||||
$wp_did_template_redirect = true;
|
{
|
||||||
include(dirname(__FILE__) . '/wp-feed.php');
|
$wp_did_template_redirect = true;
|
||||||
exit;
|
include(ABSPATH . "wp-content/${wp_template}index.php");
|
||||||
} else if ($pagenow != 'wp-trackback.php' && $tb == 1) {
|
exit;
|
||||||
$wp_did_template_redirect = true;
|
}
|
||||||
include(dirname(__FILE__) . '/wp-trackback.php');
|
}
|
||||||
exit;
|
|
||||||
} else if ((! isset($wp_did_template_redirect)) && file_exists(ABSPATH . "wp-content/${wp_template}index.php"))
|
|
||||||
{
|
|
||||||
$wp_did_home = true;
|
|
||||||
$wp_did_template_redirect = true;
|
|
||||||
include(ABSPATH . "wp-content/${wp_template}index.php");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
|
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
|
||||||
|
Loading…
Reference in New Issue
Block a user