From 93fab7e793bfe591e44bf0984d12a0a0b47d5eea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Phil=20H=C3=B6fer?= <phil@suma-ev.de>
Date: Thu, 4 Aug 2016 09:37:24 +0200
Subject: [PATCH] boost wieder eingebaut

---
 app/MetaGer.php | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/app/MetaGer.php b/app/MetaGer.php
index 786718f13..13d095a94 100644
--- a/app/MetaGer.php
+++ b/app/MetaGer.php
@@ -259,7 +259,10 @@ class MetaGer
         //Slice the collection to get the items to display in current page
         $currentPageSearchResults = $collection->slice($offset * $perPage, $perPage)->all();
 
-        # Für diese 20 Links folgt nun unsere Adgoal Implementation.
+        # Für diese 20 Links folgt nun unsere Boost-Implementation.
+        $currentPageSearchResults = $this->parseBoost($currentPageSearchResults);
+
+        # Für diese 20 Links folgt nun unsere Adgoal- Implementation.
         $currentPageSearchResults = $this->parseAdgoal($currentPageSearchResults);
 
         //Create our paginator and pass it to the view
@@ -290,6 +293,25 @@ class MetaGer
         }
 	}
 
+    public function parseBoost($results)
+    {
+	foreach($results as $result)
+        {
+		if(preg_match('/^(http[s]?\:\/\/)?(www.)?amazon\.de/',$result->anzeigeLink))
+		{
+			if(preg_match('/\?/',$result->anzeigeLink))
+	                {
+				$result->link .= '&tag=boostmg01-21';
+        	        } else
+			{
+				$result->link .= '?tag=boostmg01-21';
+			}
+			$result->partnershop = true;
+
+		}
+	}	
+	return $results;
+    }
     public function parseAdgoal($results)
     {
         $publicKey = getenv('adgoal_public');
@@ -1053,4 +1075,4 @@ class MetaGer
     {
         return $this->quicktips;
     }
-}
\ No newline at end of file
+}
-- 
GitLab