Skip to content

Instantly share code, notes, and snippets.

@tollmanz
Created January 30, 2014 05:07
Show Gist options
  • Save tollmanz/8702942 to your computer and use it in GitHub Desktop.
Save tollmanz/8702942 to your computer and use it in GitHub Desktop.
diff --git a/WordPress-Dropins/wp-stack-cdn.php b/WordPress-Dropins/wp-stack-cdn.php
index 4099276..070ace8 100644
--- a/WordPress-Dropins/wp-stack-cdn.php
+++ b/WordPress-Dropins/wp-stack-cdn.php
@@ -54,11 +54,11 @@ class WP_Stack_CDN_Plugin extends WP_Stack_Plugin {
$preg_path = preg_quote( $path, '#' );
// Targeted replace just on uploads URLs
- return preg_replace( "#=([\"'])(https?://{$domain})?$preg_path/((?:(?!\\1]).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1http://' . $this->cdn_domain . $path . '/$3.$4$5$1', $content );
+ return preg_replace( "#=([\"'])(https?://{$domain})?$preg_path/((?:(?!\\1]).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1//' . $this->cdn_domain . $path . '/$3.$4$5$1', $content );
}
public function filter( $content ) {
- return preg_replace( "#=([\"'])(https?://{$this->site_domain})?/([^/](?:(?!\\1).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1http://' . $this->cdn_domain . '/$3.$4$5$1', $content );
+ return preg_replace( "#=([\"'])(https?://{$this->site_domain})?/([^/](?:(?!\\1).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1//' . $this->cdn_domain . '/$3.$4$5$1', $content );
}
public function template_redirect() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment