@@ -13,7 +13,7 @@ function send_http2_link_header( $items ) {
1313 foreach ( $ urls as $ url ) {
1414 $ links [] = sprintf (
1515 '<%s>; rel=preload; as=%s ' ,
16- esc_url_raw ( $ url ) ,
16+ $ url ,
1717 $ as
1818 );
1919 }
@@ -29,13 +29,13 @@ function send_http2_link_header( $items ) {
2929 *
3030 * @return array An array of URLs.
3131 */
32- function get_enqueued_items () {
32+ function get_preload_items () {
3333 $ items = array (
3434 'style ' => get_urls ( wp_styles () ),
3535 'script ' => get_urls ( wp_scripts () ),
3636 );
3737
38- return apply_filters ( 'http2_server_push_items ' , $ items );
38+ return apply_filters ( 'http2_server_preload_items ' , $ items );
3939}
4040
4141/**
@@ -57,8 +57,9 @@ function get_urls( $wp_links ) {
5757
5858 $ urls = array ();
5959 foreach ( $ to_do as $ handle ) {
60- if ( ! empty ( $ links [ $ handle ] ) && $ links [ $ handle ]->src && is_string ( $ links [ $ handle ]->src ) ) {
61- $ src = $ links [ $ handle ]->src ;
60+ if ( ! empty ( $ links [ $ handle ] ) && ! empty ( $ links [ $ handle ]->src )
61+ && is_string ( $ links [ $ handle ]->src ) ) {
62+ $ src = esc_url_raw ( $ links [ $ handle ]->src );
6263 if ( preg_match ( "#^http://# " , $ src ) ) {
6364 continue ;
6465 } elseif ( preg_match ( "#^https://# " , $ src ) ) {
0 commit comments