Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A comment is displayed in HTML output in order to aid with distinguis…

…hing if CDN Linker plugin has been activated or not.
  • Loading branch information...
commit 4687998757956c3f65a6982300a292b52f327a96 1 parent af57a83
@wmark authored
Showing with 11 additions and 1 deletion.
  1. +10 −1 cdn-linker-base.php
  2. +1 −0  test.php
View
11 cdn-linker-base.php
@@ -93,6 +93,8 @@ class CDNLinksRewriter
var $www_is_optional = false;
/** Boolean: will skip some matches in JS scripts if set to true */
var $skip_on_trailing_semicolon = false;
+ /** Boolean: only set in unit tests */
+ var $in_unit_test = false;
/** Constructor. */
@@ -198,7 +200,14 @@ public function rewrite(&$content) {
} else {
$regex .= '(?=[\"\')])#';
}
- return preg_replace_callback($regex, array(&$this, 'rewrite_single'), $content);
+
+ $new_content = preg_replace_callback($regex, array(&$this, 'rewrite_single'), $content);
+
+ if ($this->in_unit_test) {
+ return $new_content;
+ } else {
+ return $new_content.'<!-- CDN Linker <https://github.com/wmark/CDN-Linker/tags> active -->';
+ }
}
}
View
1  test.php
@@ -36,6 +36,7 @@ protected function setUp() {
false,
false
);
+ $this->ctx->in_unit_test = true;
}
public function testNoModificationIfUrlsMatch() {
Please sign in to comment.
Something went wrong with that request. Please try again.