Skip to content
Snippets Groups Projects
Commit 2c8ceb46 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Amazon Affiliate Links mit neuem Tag wieder eingefügt.

parent 9e7d444e
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
......@@ -237,6 +237,9 @@ class MetaGer
#Adgoal Implementation
$this->results = $this->parseAdgoal($this->results);
#Amazon Affiliate (MetaGers tag ist: metager04-21)
$this->results = $this->parseAmazon($this->results);
$counter = 0;
$firstRank = 0;
......@@ -435,6 +438,34 @@ class MetaGer
return $results;
}
public function parseAmazon($results)
{
$amazonTag = "metager04-21";
foreach ($results as $result) {
$link = $result->anzeigeLink;
if (strpos($link, "http") !== 0) {
$link = "http://" . $link;
}
$info = parse_url($url);
if(isset($info["host"])){
$host = $info['host'];
if(strpos($host, "amazon") !== FALSE){
# This is Probably an Amazon Link. We'll add our tag as get parameter
if(isset($info["query"])){
$info["query"] .= "&tag=metager04-21";
}else{
$info["query"] = "tag=metager04-21";
}
}
$newurl = http_build_url($info);
$result->link = $newurl;
$result->partnershop = true;
}
}
return $results;
}
public function authorize($key)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment