Ticket #11282: 11282.diff
| File 11282.diff, 4.4 KB (added by westi, 3 years ago) |
|---|
-
wp-login.php
8 8 * @package WordPress 9 9 */ 10 10 11 // Note that this is the login page 12 define( 'WP_LOGIN_PAGE', true); 13 11 14 /** Make sure that the WordPress bootstrap has run before continuing. */ 12 15 require( dirname(__FILE__) . '/wp-load.php' ); 13 16 -
wp-settings.php
273 273 274 274 do_action( 'after_setup_theme' ); 275 275 276 // Check that we have a working theme to output with 277 validate_active_theme(); 278 276 279 // Load any template functions the theme supports. 277 280 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); 278 281 -
wp-admin/themes.php
48 48 } 49 49 ?> 50 50 51 <?php if ( ! validate_current_theme() ) : ?>52 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the defaulttheme.'); ?></p></div>51 <?php if ( is_wp_error( validate_current_theme() ) ) : ?> 52 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the fallback theme.'); ?></p></div> 53 53 <?php elseif ( isset($_GET['activated']) ) : 54 54 if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) ) { ?> 55 55 <div id="message2" class="updated"><p><?php printf(__('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings page</a> to configure them.'), admin_url('widgets.php') ); ?></p></div><?php -
wp-includes/load.php
577 577 return false; 578 578 } 579 579 580 function is_login() { 581 if ( defined( 'WP_LOGIN_PAGE' ) ) 582 return WP_LOGIN_PAGE; 583 return false; 584 } 585 580 586 ?> 587 No newline at end of file -
wp-includes/theme.php
1184 1184 * @since 1.5.0 1185 1185 * @see WP_FALLBACK_THEME 1186 1186 * 1187 * @return bool 1187 * @param bool $switch_if_invalid Whether or not to switch the theme to the fallback if it is invalid 1188 * @return WP_Error | bool - true if valid or WP_Error with a message if not 1188 1189 */ 1189 function validate_current_theme( ) {1190 function validate_current_theme( $switch_if_invalid = true, $check_fallback = false) { 1190 1191 // Don't validate during an install/upgrade. 1191 1192 if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) ) 1192 1193 return true; 1193 1194 1194 if ( get_template() != WP_FALLBACK_THEME && !file_exists(get_template_directory() . '/index.php') ) { 1195 $valid = true; 1196 1197 if ( ( $check_fallback || get_template() != WP_FALLBACK_THEME ) && !file_exists(get_template_directory() . '/index.php') ) 1198 $valid = new WP_Error( 'theme_missing_index', sprintf( __( 'The current theme is missing the required file index.php please <a href="%s">switch</a> to a valid theme.' ), admin_url('themes.php') ) ) ; 1199 1200 if ( ( $check_fallback || get_stylesheet() != WP_FALLBACK_THEME ) && !file_exists(get_stylesheet_directory() . '/style.css') ) 1201 $valid = new WP_Error( 'theme_missing_style', sprintf( __( 'The current theme is missing the required file style.css please <a href="%s">switch</a> to a valid theme.' ), admin_url('themes.php') ) ) ; 1202 1203 if ( $switch_if_invalid && is_wp_error($valid) ) 1195 1204 switch_theme( WP_FALLBACK_THEME, WP_FALLBACK_THEME ); 1196 return false; 1197 } 1205 1206 return $valid; 1207 } 1198 1208 1199 if ( get_stylesheet() != WP_FALLBACK_THEME && !file_exists(get_template_directory() . '/style.css') ) { 1200 switch_theme( WP_FALLBACK_THEME, WP_FALLBACK_THEME ); 1201 return false; 1209 /** 1210 * Checks that active theme files 'index.php' and 'style.css' exists. 1211 * 1212 * Will report an error if the theme is not valid 1213 * 1214 * @since 3.0.0 1215 * 1216 * @return nothing 1217 */ 1218 function validate_active_theme() { 1219 $is_valid = validate_current_theme(false, true); 1220 1221 if ( is_wp_error( $is_valid ) && !is_admin() && !is_login() ) { 1222 // Allow for a custom page to be displayed 1223 do_action( 'active_theme_invalid', $is_valid ); 1224 wp_die($is_valid); 1202 1225 } 1203 1204 return true;1205 1226 } 1206 1227 1207 1228 /**
