-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Admin & Customizer: Fix type casting for version string and aria-pressed attribute #11206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
f7f020b
29c0508
a8ac39c
539a330
1aca616
b5c2bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -191,8 +191,16 @@ | |||||||||||||||||||||||||||||||||||||||||||
| $admin_body_class .= ' taxonomy-' . $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' ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||
| $version_without_tag = strtok( get_bloginfo( 'version' ), '-' ); | ||||||||||||||||||||||||||||||||||||||||||||
| $version_components = explode( '.', $version_without_tag ); | ||||||||||||||||||||||||||||||||||||||||||||
| $version_class = 'version-' . implode( '-', $version_components ); | ||||||||||||||||||||||||||||||||||||||||||||
| $admin_body_class .= ' ' . $version_class; | ||||||||||||||||||||||||||||||||||||||||||||
| $branch_version_components = array_slice( $version_components, 0, 2 ); | ||||||||||||||||||||||||||||||||||||||||||||
| if ( '0' === array_last( $branch_version_components ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
| array_pop( $branch_version_components ); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| $branch_class = 'branch-' . implode( '-', $branch_version_components ); | ||||||||||||||||||||||||||||||||||||||||||||
| $admin_body_class .= ' ' . $branch_class; | ||||||||||||||||||||||||||||||||||||||||||||
| $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() ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+194
to
205
|
||||||||||||||||||||||||||||||||||||||||||||
| $version_without_tag = strtok( get_bloginfo( 'version' ), '-' ); | |
| $version_components = explode( '.', $version_without_tag ); | |
| $version_class = 'version-' . implode( '-', $version_components ); | |
| $admin_body_class .= ' ' . $version_class; | |
| $branch_version_components = array_slice( $version_components, 0, 2 ); | |
| if ( '0' === array_last( $branch_version_components ) ) { | |
| array_pop( $branch_version_components ); | |
| } | |
| $branch_class = 'branch-' . implode( '-', $branch_version_components ); | |
| $admin_body_class .= ' ' . $branch_class; | |
| $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() ) ) ); | |
| $full_version = get_bloginfo( 'version' ); | |
| $version_without_tag = strtok( $full_version, '-' ); | |
| $version_components = explode( '.', $version_without_tag ); | |
| $version_class = 'version-' . implode( '-', $version_components ); | |
| $admin_body_class .= ' ' . $version_class; | |
| $branch_class = 'branch-' . str_replace( '.', '-', $full_version ); | |
| $admin_body_class .= ' ' . $branch_class; | |
| $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() ) ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strtok( get_bloginfo( 'version' ), '-' )strips the pre-release suffix (e.g.-beta3/-RC1) from the version early, so the computed admin body classes can no longer include the full version string. This contradicts the PR description/testing expectation of preserving a value like7.0-beta3in the generated class; consider building thebranch-*class from the unmodified version string (with appropriate sanitization) or otherwise retaining the suffix.