WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/16/2004 06:09:32 PM (17 years ago)
Author:
rboren
Message:

Revert to default theme if active theme is broken.

File:
1 edited

Legend:

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

    r1655 r1675  
    676676}
    677677
     678function validate_current_theme() {
     679    $theme_loc = 'wp-content/themes';
     680    $theme_root = ABSPATH . $theme_loc;
     681
     682    $template = get_settings('template');
     683    $stylesheet = get_settings('stylesheet');
     684
     685    if (($template != 'default') && (! file_exists("$theme_root/$template/index.php"))) {
     686        update_option('template', 'default');
     687        update_option('stylesheet', 'default');
     688        return false;
     689    }
     690
     691    if (($stylesheet != 'default') && (! file_exists("$theme_root/$stylesheet/style.css"))) {
     692        update_option('template', 'default');
     693        update_option('stylesheet', 'default');
     694        return false;
     695    }
     696
     697    return true;
     698}
     699
    678700?>
Note: See TracChangeset for help on using the changeset viewer.