Make WordPress Core


Ignore:
Timestamp:
06/12/2012 06:39:16 PM (12 years ago)
Author:
nacin
Message:

Theme Customizer: Validate themes with more than just an existence check.

  • The current theme goes through validate_current_theme().
  • If doing a preview of a different theme, we check theme->errors().

Also:

  • Don't attach previewing hooks when previewing the current theme.

Aside from being unnecessary, this prevents issues with a theme with
the error of theme_parent_invalid.

  • Call send_origin_headers() earlier, to allow wp_die( '0' ) to properly

be returned in a domain mapping situation.

  • Fix the 'Save & Activate' message on themes.php.

fixes #20921.

File:
1 edited

Legend:

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

    r21010 r21069  
    9393?>
    9494
    95 <?php if ( ! validate_current_theme() ) : ?>
    96 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
    97 <?php elseif ( isset($_GET['activated']) ) :
    98         if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
    99 <div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
    100         } else { ?>
    101 <div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
    102         }
    103     elseif ( isset($_GET['deleted']) ) : ?>
    104 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
    105 <?php endif; ?>
    106 
    10795<div class="wrap"><?php
    10896screen_icon();
     
    115103</h2>
    116104<?php
     105if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
     106<div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
     107<?php elseif ( isset($_GET['activated']) ) :
     108        if ( isset( $_GET['previewed'] ) ) { ?>
     109        <div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>.' ), home_url( '/' ) ); ?></p></div>
     110        <?php } elseif ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) && current_user_can('edit_theme_options') ) { ?>
     111<div id="message2" class="updated"><p><?php printf( __('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings</a> screen to configure them.'), admin_url( 'widgets.php' ) ); ?></p></div><?php
     112        } else { ?>
     113<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
     114        }
     115    elseif ( isset($_GET['deleted']) ) : ?>
     116<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
     117<?php
     118endif;
    117119
    118120$ct = wp_get_theme();
Note: See TracChangeset for help on using the changeset viewer.