Skip to content

Conversation

@ryanneufeld
Copy link
Member

Make css/js urls protocol agnostic.

Fixes gh-312

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was an auto whitespace trim by my text editor, the blank line was there containing only a tab char.

@scottgonzalez
Copy link
Member

This is a good start, but it's not enough to remove all the mixed protocol problems. There are other calls to get_*_directory_uri(), such as those in the footers and there are calls to enqueue_script() which have scripts registered with protocols defined.

@scottgonzalez
Copy link
Member

There are lots of style guide violations in this code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ===

@scottgonzalez
Copy link
Member

It looks like this covers everything for the CDN to work properly on HTTPS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can replace this with:

add_filter( 'theme_root_uri', function( $url ) {
    return preg_replace( '/^https?:/', '', $url );
}, 10, 1 );

Which would make the existing calls to get_*_directory_uri() use protocol-relative URLs. This would prevent us from regressing with new code.

@ryanneufeld
Copy link
Member Author

So can this be merged?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorten this to match the theme_root_uri implementation.

Ryan Neufeld and others added 3 commits July 2, 2014 09:49
@ryanneufeld
Copy link
Member Author

This should be the simplest form of this fix now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Use protocol agnostic urls for stylesheets and js includes in header.php

2 participants