mirror of
https://github.com/WordPress/WordPress.git
synced 2026-06-19 07:37:07 +00:00
Admin: Change the default admin color scheme to Modern.
Rename the 'Modern' color scheme to 'Default' and the previous 'Default' scheme to 'Fresh'. Update all fallback references from 'fresh' to 'modern' across admin headers, the Customizer, the color scheme picker, the script loader, and user functions. Add an upgrade routine in `upgrade_700()` to migrate existing users with the 'fresh' admin color to 'modern'. Props fabiankaegy, audrasjb, mukesh27, westonruter, peterwilsoncc, jorbin, sabernhardt, joedolson, phpbits. Fixes #64546. Built from https://develop.svn.wordpress.org/trunk@61644 git-svn-id: http://core.svn.wordpress.org/trunk@60955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -193,7 +193,7 @@ if ( $current_screen->taxonomy ) {
|
||||
|
||||
$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
|
||||
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
|
||||
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
|
||||
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' );
|
||||
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
|
||||
|
||||
if ( wp_is_mobile() ) {
|
||||
|
||||
@@ -148,7 +148,7 @@ if ( is_rtl() ) {
|
||||
}
|
||||
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
|
||||
$admin_color = get_user_option( 'admin_color' );
|
||||
$body_class .= ' admin-color-' . sanitize_html_class( is_string( $admin_color ) ? $admin_color : '', 'fresh' );
|
||||
$body_class .= ' admin-color-' . sanitize_html_class( is_string( $admin_color ) ? $admin_color : '', 'modern' );
|
||||
|
||||
if ( wp_use_widgets_block_editor() ) {
|
||||
$body_class .= ' wp-embed-responsive';
|
||||
|
||||
@@ -1004,14 +1004,14 @@ function admin_color_scheme_picker( $user_id ) {
|
||||
|
||||
ksort( $_wp_admin_css_colors );
|
||||
|
||||
if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
|
||||
// Set Default ('fresh') and Light should go first.
|
||||
if ( isset( $_wp_admin_css_colors['modern'] ) ) {
|
||||
// Set Modern (new default), Classic ('fresh'), and Light first.
|
||||
$_wp_admin_css_colors = array_filter(
|
||||
array_merge(
|
||||
array(
|
||||
'modern' => '',
|
||||
'fresh' => '',
|
||||
'light' => '',
|
||||
'modern' => '',
|
||||
),
|
||||
$_wp_admin_css_colors
|
||||
)
|
||||
@@ -1021,7 +1021,7 @@ function admin_color_scheme_picker( $user_id ) {
|
||||
$current_color = get_user_option( 'admin_color', $user_id );
|
||||
|
||||
if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
|
||||
$current_color = 'fresh';
|
||||
$current_color = 'modern';
|
||||
}
|
||||
?>
|
||||
<fieldset id="color-picker" class="scheme-list">
|
||||
@@ -1067,13 +1067,13 @@ function wp_color_scheme_settings() {
|
||||
|
||||
// It's possible to have a color scheme set that is no longer registered.
|
||||
if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
|
||||
$color_scheme = 'fresh';
|
||||
$color_scheme = 'modern';
|
||||
}
|
||||
|
||||
if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
|
||||
$icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors;
|
||||
} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
|
||||
$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
|
||||
} elseif ( ! empty( $_wp_admin_css_colors['modern']->icon_colors ) ) {
|
||||
$icon_colors = $_wp_admin_css_colors['modern']->icon_colors;
|
||||
} else {
|
||||
// Fall back to the default set of icon colors if the default scheme is missing.
|
||||
$icon_colors = array(
|
||||
|
||||
@@ -886,6 +886,10 @@ function upgrade_all() {
|
||||
upgrade_682();
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 61644 ) {
|
||||
upgrade_700();
|
||||
}
|
||||
|
||||
maybe_disable_link_manager();
|
||||
|
||||
maybe_disable_automattic_widgets();
|
||||
@@ -2481,6 +2485,31 @@ function upgrade_682() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes changes made in WordPress 7.0.
|
||||
*
|
||||
* @ignore
|
||||
* @since 7.0.0
|
||||
*
|
||||
* @global int $wp_current_db_version The old (current) database version.
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*/
|
||||
function upgrade_700() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
// Migrate users with 'fresh' admin color to 'modern'.
|
||||
if ( $wp_current_db_version < 61644 ) {
|
||||
$wpdb->update(
|
||||
$wpdb->usermeta,
|
||||
array( 'meta_value' => 'modern' ),
|
||||
array(
|
||||
'meta_key' => 'admin_color',
|
||||
'meta_value' => 'fresh',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes network-level upgrade routines.
|
||||
*
|
||||
|
||||
@@ -134,7 +134,7 @@ function edit_user( $user_id = 0 ) {
|
||||
if ( $update ) {
|
||||
$user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' === $_POST['rich_editing'] ? 'false' : 'true';
|
||||
$user->syntax_highlighting = isset( $_POST['syntax_highlighting'] ) && 'false' === $_POST['syntax_highlighting'] ? 'false' : 'true';
|
||||
$user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh';
|
||||
$user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'modern';
|
||||
$user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
|
||||
}
|
||||
|
||||
|
||||
@@ -4892,8 +4892,20 @@ function register_admin_color_schemes() {
|
||||
$suffix .= SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
wp_admin_css_color(
|
||||
'fresh',
|
||||
'modern',
|
||||
_x( 'Default', 'admin color scheme' ),
|
||||
admin_url( "css/colors/modern/colors$suffix.css" ),
|
||||
array( '#1e1e1e', '#3858e9', '#7b90ff' ),
|
||||
array(
|
||||
'base' => '#f3f1f1',
|
||||
'focus' => '#fff',
|
||||
'current' => '#fff',
|
||||
)
|
||||
);
|
||||
|
||||
wp_admin_css_color(
|
||||
'fresh',
|
||||
_x( 'Fresh', 'admin color scheme' ),
|
||||
false,
|
||||
array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ),
|
||||
array(
|
||||
@@ -4915,18 +4927,6 @@ function register_admin_color_schemes() {
|
||||
)
|
||||
);
|
||||
|
||||
wp_admin_css_color(
|
||||
'modern',
|
||||
_x( 'Modern', 'admin color scheme' ),
|
||||
admin_url( "css/colors/modern/colors$suffix.css" ),
|
||||
array( '#1e1e1e', '#3858e9', '#7b90ff' ),
|
||||
array(
|
||||
'base' => '#f3f1f1',
|
||||
'focus' => '#fff',
|
||||
'current' => '#fff',
|
||||
)
|
||||
);
|
||||
|
||||
wp_admin_css_color(
|
||||
'blue',
|
||||
_x( 'Blue', 'admin color scheme' ),
|
||||
|
||||
@@ -2105,7 +2105,7 @@ function wp_style_loader_src( $src, $handle ) {
|
||||
$color = get_user_option( 'admin_color' );
|
||||
|
||||
if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
|
||||
$color = 'fresh';
|
||||
$color = 'modern';
|
||||
}
|
||||
|
||||
$color = $_wp_admin_css_colors[ $color ] ?? null;
|
||||
|
||||
@@ -2184,7 +2184,7 @@ function validate_username( $username ) {
|
||||
* @type string $comment_shortcuts Whether to enable comment moderation keyboard
|
||||
* shortcuts for the user. Accepts 'true' or 'false'
|
||||
* as a string literal, not boolean. Default 'false'.
|
||||
* @type string $admin_color Admin color scheme for the user. Default 'fresh'.
|
||||
* @type string $admin_color Admin color scheme for the user. Default 'modern'.
|
||||
* @type bool $use_ssl Whether the user should always access the admin over
|
||||
* https. Default false.
|
||||
* @type string $user_registered Date the user registered in UTC. Format is 'Y-m-d H:i:s'.
|
||||
@@ -2457,7 +2457,7 @@ function wp_insert_user( $userdata ) {
|
||||
|
||||
$meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true';
|
||||
|
||||
$admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color'];
|
||||
$admin_color = empty( $userdata['admin_color'] ) ? 'modern' : $userdata['admin_color'];
|
||||
$meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color );
|
||||
|
||||
$meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? '0' : '1';
|
||||
@@ -2546,7 +2546,7 @@ function wp_insert_user( $userdata ) {
|
||||
* @type string $rich_editing Whether to enable the rich-editor for the user. Default 'true'.
|
||||
* @type string $syntax_highlighting Whether to enable the rich code editor for the user. Default 'true'.
|
||||
* @type string $comment_shortcuts Whether to enable keyboard shortcuts for the user. Default 'false'.
|
||||
* @type string $admin_color The color scheme for a user's admin screen. Default 'fresh'.
|
||||
* @type string $admin_color The color scheme for a user's admin screen. Default 'modern'.
|
||||
* @type int|bool $use_ssl Whether to force SSL on the user's admin area. 0|false if SSL
|
||||
* is not forced.
|
||||
* @type string $show_admin_bar_front Whether to show the admin bar on the front end for the user.
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61643';
|
||||
$wp_version = '7.0-alpha-61644';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 60717;
|
||||
$wp_db_version = 61644;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version.
|
||||
|
||||
Reference in New Issue
Block a user