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

git-svn-id: http://svn.automattic.com/wordpress/trunk@14369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-05-03 13:23:34 +00:00
parent 08f650de1a
commit b5e08827bc
2 changed files with 32 additions and 1 deletions

View File

@ -208,4 +208,35 @@ function _get_template_edit_filename($fullpath, $containingfolder) {
return str_replace(dirname(dirname( $containingfolder )) , '', $fullpath);
}
/**
* Check the current theme for reliance on deprecated theme compatibility
*
* Check to see if the current theme has all the required templates available
* from itself or its parent
*
* @return nothing
*/
function _check_theme_deprecated_files() {
$files = array( );
if ( ! locate_template( array( 'header.php' ) ) )
$files[] = 'header.php';
if ( ! locate_template( array( 'footer.php' ) ) )
$files[] = 'footer.php';
if ( ! locate_template( array( 'sidebar.php' ) ) )
$files[] = 'sidebar.php';
// Only notify if both are missing as you can use one or the other
if ( ! ( $comment = locate_template( array( 'comments.php' ) ) ) && ! ( $comment_popup = locate_template( array( 'comments-popup.php' ) ) ) ) {
$files[] = 'comments.php';
$files[] = 'comments-popup.php';
}
if ( ! empty( $files ) ) : ?>
<div id="deprecated-files-message" class="error"><p>
<?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, ', ') ); ?>
</p></div>
<?php endif;
}
?>

View File

@ -59,8 +59,8 @@ if ( is_multisite() && current_user_can('edit_themes') ) {
elseif ( isset($_GET['deleted']) ) : ?>
<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
<?php endif; ?>
<?php
_check_theme_deprecated_files();
$themes = get_allowed_themes();
$ct = current_theme_info();
unset($themes[$ct->name]);