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