Themes: Account for uppercase chars when managing themes.

Fixes a bug where the UI wasn't updated after deleting/updating a theme.

Also introduces unit tests for theme management ajax handlers. For now they're
focused on `wp_ajax_update_theme()` but they can include tests for other
handlers as well.

Props chrisjean for initial patch.
Fixes #37924.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@38710 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland
2016-10-03 18:12:57 +00:00
parent 395823c9cd
commit ab087dadfc
4 changed files with 185 additions and 2 deletions

View File

@@ -3405,7 +3405,7 @@ function wp_ajax_update_theme() {
) );
}
$stylesheet = sanitize_key( wp_unslash( $_POST['slug'] ) );
$stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) );
$status = array(
'update' => 'theme',
'slug' => $stylesheet,
@@ -3490,7 +3490,7 @@ function wp_ajax_delete_theme() {
) );
}
$stylesheet = sanitize_key( wp_unslash( $_POST['slug'] ) );
$stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) );
$status = array(
'delete' => 'theme',
'slug' => $stylesheet,