status_code))
return $response;
if (!Pluf::f('google_ads', false)) {
return $response;
}
if (!in_array($response->status_code,
array(200, 201, 202, 203, 204, 205, 206, 404, 501))) {
return $response;
}
$ok = false;
$cts = array('text/html', 'text/html', 'application/xhtml+xml');
foreach ($cts as $ct) {
if (false !== strripos($response->headers['Content-Type'], $ct)) {
$ok = true;
break;
}
}
if ($ok == false) {
return $response;
}
$replacead1 = $this->makead(Pluf::f("google_ads")["AD1"]);
$replacead2 = $this->makead(Pluf::f("google_ads")["AD2"]);
$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;
}
private function makead($ad)
{
$ret = '";
$ret .= '';
return $ret;
}
}