From e74022e1900b689aecbc2f4469d0cb6fbded9344 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 18 Jan 2015 22:14:51 -0600 Subject: [PATCH] Fixing issue with ad middleware --- indefero/src/IDF/Middleware/GoogleAds.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/indefero/src/IDF/Middleware/GoogleAds.php b/indefero/src/IDF/Middleware/GoogleAds.php index ec4cf93..918a744 100644 --- a/indefero/src/IDF/Middleware/GoogleAds.php +++ b/indefero/src/IDF/Middleware/GoogleAds.php @@ -60,8 +60,12 @@ class IDF_Middleware_GoogleAds } $replacead1 = $this->makead(Pluf::f("google_ads")["AD1"]); $replacead2 = $this->makead(Pluf::f("google_ads")["AD2"]); - $response->content = substr_replace($response->content, $replacead1, strrpos($response->content,''), strlen('')); - $response->content = substr_replace($response->content, $replacead2, strrpos($response->content,''), strlen('')); + $pos1 = strpos($response->content,''); + if ($pos1 !== false) + $response->content = substr_replace($response->content, $replacead1, $pos1, strlen('')); + $pos2 = strpos($response->content,''); + if ($pos2 !== false) + $response->content = substr_replace($response->content, $replacead2, $pos2, strlen('')); return $response; }