diff --git a/README.md b/README.md index 2bb80628d926c628eb237eafa4c0d8a3c0b815da..23756770dbf308f98df9c6fbf8c17e2ffdbea2d0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp Tags: cdn, rewrite Requires at least: 3.3 Tested up to: 3.8 -Stable tag: 0.1.0 +Stable tag: 0.1.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -18,4 +18,12 @@ If using [Composer](http://getcomposer.org) for dependency management, you can a ## Installation ### As standard plugin: -> See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins). \ No newline at end of file +> See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins). + +## Changelog + +** 0.1.1 ** +*Fixing issue with URLs without a path part.* + +** 0.1.0 ** +*Initial version.* \ No newline at end of file diff --git a/cdn-rewrite.php b/cdn-rewrite.php index 1e682e6b182a4bc63cbd45d15a856d90646c3fb1..bb4695fb4fe9fa5a7c96d81bda28023b84499c4f 100644 --- a/cdn-rewrite.php +++ b/cdn-rewrite.php @@ -3,7 +3,7 @@ Plugin Name: CDN Rewrite Plugin URI: http://voceconnect.com/ Description: Rewrites asset URLs to CDN -Version: 0.1 +Version: 0.1.1 Author: Chris Scott, Michael Pretty Author URI: http://voceconnect.com/ */ @@ -206,7 +206,12 @@ if( !class_exists( 'CDN_Rewrite' ) ){ private function get_version($url) { if(0 === strpos($url, $this->root_url)) { $parts = parse_url($url); - $file_path = str_replace(site_url('/'), ABSPATH, $parts['scheme'].'://'.$parts['host'].$parts['path']); + foreach( array( 'scheme', 'host', 'path' ) as $part ){ + if( !isset( $parts[$part] ) ) + return false; + } + + $file_path = str_replace( site_url('/'), ABSPATH, $parts['scheme'] . '://' . $parts['host'] . $parts['path'] ); if( !($version = @filemtime($file_path)) ) { $version = $this->default_version; } diff --git a/readme.txt b/readme.txt index 5e5434d2b6d5526501e6613553f09e3346390f60..644de0a441708c4403c67d13b347cdd6351f5a56 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp Tags: cdn, rewrite Requires at least: 3.3 Tested up to: 3.8 -Stable tag: 0.1.0 +Stable tag: 0.1.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html