Make WordPress Core

Changeset 4017


Ignore:
Timestamp:
07/11/2006 10:44:56 PM (19 years ago)
Author:
ryan
Message:

Tweak theme validation.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r3999 r4017  
    12551255}
    12561256
    1257 function validate_current_theme() {
    1258     $theme_loc = 'wp-content/themes';
    1259     $theme_root = ABSPATH.$theme_loc;
    1260 
    1261     $template = get_settings('template');
    1262     $stylesheet = get_settings('stylesheet');
    1263 
    1264     if (($template != 'default') && (!file_exists("$theme_root/$template/index.php"))) {
    1265         update_option('template', 'default');
    1266         update_option('stylesheet', 'default');
    1267         do_action('switch_theme', 'Default');
    1268         return false;
    1269     }
    1270 
    1271     if (($stylesheet != 'default') && (!file_exists("$theme_root/$stylesheet/style.css"))) {
    1272         update_option('template', 'default');
    1273         update_option('stylesheet', 'default');
    1274         do_action('switch_theme', 'Default');
    1275         return false;
    1276     }
    1277 
    1278     return true;
    1279 }
    1280 
    12811257function get_broken_themes() {
    12821258    global $wp_broken_themes;
  • trunk/wp-includes/theme.php

    r3730 r4017  
    2727
    2828function get_template() {
    29     $template = get_settings('template');
    30     if (!file_exists(get_theme_root() . "/$template")) { //works for dirs too
    31         update_option('template', 'default');
    32         update_option('stylesheet', 'default');
    33     }
    3429    return apply_filters('template', get_settings('template'));
    3530}
     
    375370}
    376371
     372function validate_current_theme() {
     373    if ((get_template() != 'default') && (!file_exists(get_template_directory() . '/index.php'))) {
     374        update_option('template', 'default');
     375        update_option('stylesheet', 'default');
     376        do_action('switch_theme', 'Default');
     377        return false;
     378    }
     379
     380    if ((get_stylesheet() != 'default') && (!file_exists(get_template_directory() . '/style.css'))) {
     381        update_option('template', 'default');
     382        update_option('stylesheet', 'default');
     383        do_action('switch_theme', 'Default');
     384        return false;
     385    }
     386
     387    return true;
     388}
     389
    377390?>
  • trunk/wp-settings.php

    r3985 r4017  
    201201$wp         = new WP();
    202202
     203validate_current_theme();
    203204define('TEMPLATEPATH', get_template_directory());
    204205
Note: See TracChangeset for help on using the changeset viewer.