Compare commits

..

No commits in common. "99f86e6e1504a56e76b70f037eb75365861a24f9" and "cf61449b9038332822655e46df48ace7e59f437b" have entirely different histories.

3 changed files with 5 additions and 6 deletions

View file

@ -144,17 +144,16 @@ abstract class PatchBase {
return false; return false;
} }
private function regex(string $pattern) { private function regex(string $pattern) {
if (!preg_match_all($pattern, $this->data, $m, PREG_PATTERN_ORDER)) if (!preg_match($pattern, $this->data, $m))
return false; return false;
// suppress full pattern match // suppress full pattern match
$m = $m[1]; unset($m[0]);
// TODO - add option: $m = array_reverse($m);
return $m; return $m;
} }
private function regex_str(string $pattern) { private function regex_str(string $pattern) {
$m = $this->regex($pattern); $m = $this->regex($pattern);
if ($m) if ($m)
return $m[0]; return $m[1];
return false; return false;
} }
} }

View file

@ -7,7 +7,7 @@ class CookieAutoDeleteChrome extends PatchBase {
} }
function check() : bool { function check() : bool {
if ($this->fetch('https://chrome.google.com/webstore/detail/cookie-autodelete/fhcgjolkccmbidfldomjliifgaodjagh')) if ($this->fetch('https://chrome.google.com/webstore/detail/cookie-autodelete/fhcgjolkccmbidfldomjliifgaodjagh'))
return $this->parse('/<div class="N3EXSc">([\d\.]+)<\/div>/'); return $this->parse('/\\\"version\\\": \\\"([\d\.]+)\\\"/');
return false; return false;
} }
} }

View file

@ -7,7 +7,7 @@ class LocalCDNChrome extends PatchBase {
} }
function check() : bool { function check() : bool {
if ($this->fetch('https://chrome.google.com/webstore/detail/localcdn/njdfdhgcmkocbgbhcioffdbicglldapd')) if ($this->fetch('https://chrome.google.com/webstore/detail/localcdn/njdfdhgcmkocbgbhcioffdbicglldapd'))
return $this->parse('/<div class="N3EXSc">([\d\.]+)<\/div>/'); return $this->parse('/\\\"version\\\": \\\"([\d\.]+)\\\"/');
return false; return false;
} }
} }