Skip to content

Commit

Permalink
[FirefoxAddonsBridge] Add detectParameters() (#1997)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerifiedJoseph authored Mar 15, 2021
1 parent 5c011c8 commit 700813e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bridges/FirefoxAddonsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ class FirefoxAddonsBridge extends BridgeAbstract {
private $xpiFileRegex = '/([A-Za-z0-9_.-]+)\.xpi$/';
private $outgoingRegex = '/https:\/\/outgoing.prod.mozaws.net\/v1\/(?:[A-z0-9]+)\//';

private $urlRegex = '/addons\.mozilla\.org\/(?:[\w-]+\/)?firefox\/addon\/([\w-]+)/';

public function detectParameters($url) {
$params = array();

if(preg_match($this->urlRegex, $url, $matches)) {
$params['id'] = $matches[1];
return $params;
}

return null;
}

public function collectData() {
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request: ' . $this->getURI());
Expand Down

0 comments on commit 700813e

Please sign in to comment.