Switch to a constant for the fallback theme. See #9015.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-02-07 22:36:37 +00:00
parent 8e1a363a8d
commit 333f5b0cfa
2 changed files with 12 additions and 7 deletions

View File

@ -258,6 +258,13 @@ function wp_default_constants( $context ) {
* @since 2.1.0
*/
define('STYLESHEETPATH', get_stylesheet_directory());
/**
* Slug of the fallback theme for this install.
* Will be used as the fallback if the current theme doesn't exist.
* @since 3.0.0
*/
define( 'WP_FALLBACK_THEME', 'twentyten' );
break;
}

View File

@ -951,7 +951,7 @@ function get_attachment_template() {
function get_comments_popup_template() {
$template = locate_template(array("comments-popup.php"));
if ('' == $template)
$template = get_theme_root() . '/default/comments-popup.php';
$template = get_theme_root() . '/' . WP_FALLBACK_THEME . '/comments-popup.php';
return apply_filters('comments_popup_template', $template);
}
@ -1160,15 +1160,13 @@ function validate_current_theme() {
if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) )
return true;
$fallback = 'twentyten';
if ( get_template() != $fallback && !file_exists(get_template_directory() . '/index.php') ) {
switch_theme($fallback, $fallback);
if ( get_template() != WP_FALLBACK_THEME && !file_exists(get_template_directory() . '/index.php') ) {
switch_theme( WP_FALLBACK_THEME, WP_FALLBACK_THEME );
return false;
}
if ( get_stylesheet() != $fallback && !file_exists(get_template_directory() . '/style.css') ) {
switch_theme($fallback, $fallback);
if ( get_stylesheet() != WP_FALLBACK_THEME && !file_exists(get_template_directory() . '/style.css') ) {
switch_theme( WP_FALLBACK_THEME, WP_FALLBACK_THEME );
return false;
}