Browse Source

Tweak

master
J. King 2 years ago
parent
commit
bbd3edc4a8
  1. 7
      lib/SitePattern.php

7
lib/SitePattern.php

@ -45,7 +45,7 @@ class SitePattern {
} else {
$param = "";
$depth = 0;
while (true) {
while ($pos < $end) {
$len = strcspn($d, "()'\"", $pos);
$param .= substr($d, $pos, $len);
$pos += $len;
@ -98,6 +98,7 @@ class SitePattern {
case "strip_id_or_class":
case "strip_image_src":
case "find_string":
case "replace_sring":
// string values may be enclosed by single or double quotation marks as leading and trailing whitespace is otherwise stripped
if ((preg_match('/^"/', $value) && preg_match('/"$/', $value)) || (preg_match("/^'/", $value) && preg_match("/'$/", $value))) {
$value = substr($value, 1, strlen($value) - 2);
@ -113,12 +114,12 @@ class SitePattern {
} else {
throw new SitePatternException("\"find_string\" directive on line $findStringLine is not followed by a matching \"replace_string\" directive", 3);
}
} elseif ($directive === "replace_string") {
# requires special handling to match up with find_string
} else {
$this->cleanUp[] = [$directive, [$value]];
}
break;
case "replace_sring":
# requires special handling to match up with find_string
case "http_header":
# string with param
case "tidy":

Loading…
Cancel
Save