mirror of
https://github.com/WordPress/WordPress.git
synced 2026-06-19 07:37:07 +00:00
Toolbar: Revert add CSS from admin color scheme on front-end.
The implementation issues a server-side HTTP request on every front-end page load and extracts the toolbar CSS via fragile substring matching. Alternatives are too large to land this late in the release cycle, so the fix is deferred to a future release. Reverts [62025]. Props desrosj, jorbin, mukesh27, sabernhardt, wildworks. See #64762. Built from https://develop.svn.wordpress.org/trunk@62349 git-svn-id: http://core.svn.wordpress.org/trunk@61630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1466,49 +1466,3 @@ function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
|
||||
|
||||
return 'true' === $pref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds CSS from the administration color scheme stylesheet on the front end.
|
||||
*
|
||||
* @since 7.0.0
|
||||
*
|
||||
* @global array $_wp_admin_css_colors Registered administration color schemes.
|
||||
*/
|
||||
function wp_admin_bar_add_color_scheme_to_front_end() {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $_wp_admin_css_colors;
|
||||
|
||||
if ( empty( $_wp_admin_css_colors ) ) {
|
||||
register_admin_color_schemes();
|
||||
}
|
||||
|
||||
$color_scheme = get_user_option( 'admin_color' );
|
||||
|
||||
if ( empty( $color_scheme ) || ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {
|
||||
$color_scheme = 'modern';
|
||||
}
|
||||
|
||||
$color = $_wp_admin_css_colors[ $color_scheme ] ?? null;
|
||||
$url = $color->url ?? '';
|
||||
|
||||
if ( $url ) {
|
||||
$response = wp_remote_get( $url );
|
||||
if ( ! is_wp_error( $response ) ) {
|
||||
$css = $response['body'];
|
||||
if ( is_string( $css ) && str_contains( $css, '#wpadminbar' ) ) {
|
||||
$start_position = strpos( $css, '#wpadminbar' );
|
||||
$end_position = strpos( $css, '.wp-pointer' );
|
||||
if ( false !== $end_position && $end_position > $start_position ) {
|
||||
$css = substr( $css, $start_position, $end_position - $start_position );
|
||||
if ( SCRIPT_DEBUG ) {
|
||||
$css = str_replace( '/* Pointers */', '', $css );
|
||||
}
|
||||
}
|
||||
wp_add_inline_style( 'admin-bar', $css );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +700,6 @@ add_action( 'activate_header', '_wp_admin_bar_init' );
|
||||
add_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
|
||||
add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // Back-compat for themes not using `wp_body_open`.
|
||||
add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );
|
||||
add_action( 'admin_bar_init', 'wp_admin_bar_add_color_scheme_to_front_end', 0 );
|
||||
|
||||
// Former admin filters that can also be hooked on the front end.
|
||||
add_action( 'media_buttons', 'media_buttons' );
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.1-alpha-62348';
|
||||
$wp_version = '7.1-alpha-62349';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user