WordPress.org

Make WordPress Core

Changeset 14369


Ignore:
Timestamp:
05/03/2010 01:23:34 PM (9 years ago)
Author:
westi
Message:

Add a nag message for themes which are relying on the deprecated behaviour.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/theme.php

    r13827 r14369  
    209209}
    210210
     211/**
     212 * Check the current theme for reliance on deprecated theme compatibility
     213 *
     214 * Check to see if the current theme has all the required templates available
     215 * from itself or its parent
     216 *
     217 * @return nothing
     218 */
     219function _check_theme_deprecated_files() {
     220    $files = array( );
     221   
     222    if ( ! locate_template( array( 'header.php' ) ) )
     223        $files[] = 'header.php';
     224    if ( ! locate_template( array( 'footer.php' ) ) )
     225        $files[] = 'footer.php';
     226    if ( ! locate_template( array( 'sidebar.php' ) ) )
     227        $files[] = 'sidebar.php';
     228   
     229    // Only notify if both are missing as you can use one or the other 
     230    if ( ! ( $comment = locate_template( array( 'comments.php' ) ) ) && ! ( $comment_popup = locate_template( array( 'comments-popup.php' ) ) ) ) {
     231        $files[] = 'comments.php';
     232        $files[] = 'comments-popup.php';
     233    }   
     234       
     235    if ( ! empty( $files ) ) : ?>
     236        <div id="deprecated-files-message" class="error"><p>
     237            <?php echo sprintf( __('The current theme is incomplete as it is missing %1$s. Please update your theme to include these files as you are currently relying on deprecated behaviour.'), implode( $files, ', ') ); ?>
     238        </p></div>
     239    <?php endif;
     240}
     241
    211242?>
  • trunk/wp-admin/themes.php

    r14347 r14369  
    6060<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
    6161<?php endif; ?>
    62 
    63 <?php
     62<?php
     63_check_theme_deprecated_files();
    6464$themes = get_allowed_themes();
    6565$ct = current_theme_info();
Note: See TracChangeset for help on using the changeset viewer.