Commit 9b598b40 authored by Kevin Langley Jr's avatar Kevin Langley Jr
Browse files

fixing rewrite of urls without path part

parent 92dae5be
......@@ -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
......@@ -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;
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment