@@ -1428,17 +1428,20 @@ function wp_admin_bar_add_color_scheme_to_front_end() {
14281428 $ url = $ color ->url ?? '' ;
14291429
14301430 if ( $ url ) {
1431- $ css = file_get_contents ( $ url );
1432- if ( is_string ( $ css ) && str_contains ( $ css , '#wpadminbar ' ) ) {
1433- $ start_position = strpos ( $ css , '#wpadminbar ' );
1434- $ end_position = strpos ( $ css , '.wp-pointer ' );
1435- if ( false !== $ end_position && $ end_position > $ start_position ) {
1436- $ css = substr ( $ css , $ start_position , $ end_position - $ start_position );
1437- if ( SCRIPT_DEBUG ) {
1438- $ css = str_replace ( '/* Pointers */ ' , '' , $ css );
1431+ $ response = wp_remote_get ( $ url );
1432+ if ( ! is_wp_error ( $ response ) ) {
1433+ $ css = $ response ['body ' ];
1434+ if ( is_string ( $ css ) && str_contains ( $ css , '#wpadminbar ' ) ) {
1435+ $ start_position = strpos ( $ css , '#wpadminbar ' );
1436+ $ end_position = strpos ( $ css , '.wp-pointer ' );
1437+ if ( false !== $ end_position && $ end_position > $ start_position ) {
1438+ $ css = substr ( $ css , $ start_position , $ end_position - $ start_position );
1439+ if ( SCRIPT_DEBUG ) {
1440+ $ css = str_replace ( '/* Pointers */ ' , '' , $ css );
1441+ }
14391442 }
1443+ wp_add_inline_style ( 'admin-bar ' , $ css );
14401444 }
1441- wp_add_inline_style ( 'admin-bar ' , $ css );
14421445 }
14431446 }
14441447}
0 commit comments