Themes: Always include the current theme in the list, even if it is not allowed.
see #25948. git-svn-id: https://develop.svn.wordpress.org/trunk@26529 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
568ba838b7
commit
616eb91d95
@ -376,13 +376,16 @@ function themes_api( $action, $args = null ) {
|
|||||||
* @return array An associative array of theme data, sorted by name.
|
* @return array An associative array of theme data, sorted by name.
|
||||||
*/
|
*/
|
||||||
function wp_prepare_themes_for_js( $themes = null ) {
|
function wp_prepare_themes_for_js( $themes = null ) {
|
||||||
if ( null === $themes ) {
|
|
||||||
$themes = wp_get_themes( array( 'allowed' => true ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
$prepared_themes = array();
|
$prepared_themes = array();
|
||||||
$current_theme = get_stylesheet();
|
$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();
|
$updates = array();
|
||||||
if ( current_user_can( 'update_themes' ) ) {
|
if ( current_user_can( 'update_themes' ) ) {
|
||||||
$updates_transient = get_site_transient( '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 ),
|
'update' => get_theme_update_available( $theme ),
|
||||||
'actions' => array(
|
'actions' => array(
|
||||||
'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
|
'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,
|
'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user