Skip to content
Snippets Groups Projects
Commit 9b598b40 authored by Kevin Langley Jr's avatar Kevin Langley Jr
Browse files

fixing rewrite of urls without path part

parent 92dae5be
Branches
Tags
No related merge requests found
...@@ -4,7 +4,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp ...@@ -4,7 +4,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp
Tags: cdn, rewrite Tags: cdn, rewrite
Requires at least: 3.3 Requires at least: 3.3
Tested up to: 3.8 Tested up to: 3.8
Stable tag: 0.1.0 Stable tag: 0.1.1
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
...@@ -19,3 +19,11 @@ If using [Composer](http://getcomposer.org) for dependency management, you can a ...@@ -19,3 +19,11 @@ If using [Composer](http://getcomposer.org) for dependency management, you can a
### As standard plugin: ### As standard plugin:
> See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins). > 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 @@ ...@@ -3,7 +3,7 @@
Plugin Name: CDN Rewrite Plugin Name: CDN Rewrite
Plugin URI: http://voceconnect.com/ Plugin URI: http://voceconnect.com/
Description: Rewrites asset URLs to CDN Description: Rewrites asset URLs to CDN
Version: 0.1 Version: 0.1.1
Author: Chris Scott, Michael Pretty Author: Chris Scott, Michael Pretty
Author URI: http://voceconnect.com/ Author URI: http://voceconnect.com/
*/ */
...@@ -206,6 +206,11 @@ if( !class_exists( 'CDN_Rewrite' ) ){ ...@@ -206,6 +206,11 @@ if( !class_exists( 'CDN_Rewrite' ) ){
private function get_version($url) { private function get_version($url) {
if(0 === strpos($url, $this->root_url)) { if(0 === strpos($url, $this->root_url)) {
$parts = parse_url($url); $parts = parse_url($url);
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'] ); $file_path = str_replace( site_url('/'), ABSPATH, $parts['scheme'] . '://' . $parts['host'] . $parts['path'] );
if( !($version = @filemtime($file_path)) ) { if( !($version = @filemtime($file_path)) ) {
$version = $this->default_version; $version = $this->default_version;
......
...@@ -3,7 +3,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp ...@@ -3,7 +3,7 @@ Contributors: voceplatforms, chrisscott, prettyboymp
Tags: cdn, rewrite Tags: cdn, rewrite
Requires at least: 3.3 Requires at least: 3.3
Tested up to: 3.8 Tested up to: 3.8
Stable tag: 0.1.0 Stable tag: 0.1.1
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment