Themes: Always include the current theme in the list, even if it is not allowed.

see #25948.

Built from https://develop.svn.wordpress.org/trunk@26529


git-svn-id: http://core.svn.wordpress.org/trunk@26422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-02 18:46:11 +00:00
parent 8d6aa0ab25
commit c6ddea79d1

View File

@ -376,13 +376,16 @@ function themes_api( $action, $args = null ) {
* @return array An associative array of theme data, sorted by name.
*/
function wp_prepare_themes_for_js( $themes = null ) {
if ( null === $themes ) {
$themes = wp_get_themes( array( 'allowed' => true ) );
}
$prepared_themes = array();
$current_theme = get_stylesheet();
if ( null === $themes ) {
$themes = wp_get_themes( array( 'allowed' => true ) );
if ( ! isset( $themes[ $current_theme ] ) ) {
$themes[ $current_theme ] = wp_get_theme();
}
}
$updates = array();
if ( current_user_can( 'update_themes' ) ) {
$updates_transient = get_site_transient( 'update_themes' );
@ -415,7 +418,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
'update' => get_theme_update_available( $theme ),
'actions' => array(
'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
'customize'=> current_user_can( 'edit_theme_options' ) ? admin_url( 'customize.php?theme=' . $encoded_slug ) : null,
'customize'=> current_user_can( 'edit_theme_options' ) ? wp_customize_url( $slug ) : null,
'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
),
);