roborourke / wp-less

Provides a LESS compiler compatible with wp_enqueue_style() for rapid CSS development in themes and plugins.
MIT License
217 stars 55 forks source link

Match the URL schemes #54

Closed simonwheatley closed 10 years ago

simonwheatley commented 10 years ago

Currently, if the scheme of the URL passed in does not match the scheme of WP_CONTENT_URL, then the search and replace str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $src ) does not occur, and the $src string remains a URL rather than being converted to a file path.

For example, we had this situation, where the replace failed (note different schemes):

str_replace( 'http://example.com/somesite/wp-content', '/srv/www/someproject/htdocs/wp-content', 'https://example.com/somesite/wp-content/themes/some-theme/assets/less/wp-admin.less?ver=3.7.1' )

This pull request matches the schemes if they differ, forcing the $src scheme to the scheme of WP_CONTENT_URL.