/** * @param Pap_Db_Visit * @return Pap_Contexts_Click */ private function getContextFromParams(Pap_Db_Visit $visit) { $context = $this->createContext($visit); $getRequest = new Pap_Tracking_Request(); $getRequest->parseUrl($visit->getGetParams()); if($getRequest->getAffiliateId() == ''){ $context->debug('Affiliate Id or Affiliate Id Parameter is missing'); } if ($this->isClickRequest($getRequest)) { $context->setRequestObject($getRequest); $context->debug('It is click request.'); return $context; } $anchorRequest = new Pap_Tracking_Request(); $anchor = $visit->getAnchor(); $anchorRequest->parseUrl($anchor); if ($this->isClickRequest($anchorRequest)) { $context->setRequestObject($anchorRequest); $context->debug('It is anchor request, anchor: ' . $anchor); return $context; } if ($anchor != '' && Gpf_Settings::get(Pap_Settings::SUPPORT_SHORT_ANCHOR_LINKING) == Gpf::YES) { $user = $this->affiliateRecognizer->getUserById($context, $anchor); if ($user == null) { $context->debug('User is null, anchor was:' . $anchor); return null; } $shortAnchorRequest = new Pap_Tracking_Request(); $shortAnchorRequest->parseUrl('?'.Pap_Tracking_Request::getAffiliateClickParamName().'='.$anchor); $context->setRequestObject($shortAnchorRequest); $context->debug('Short anchor link'); return $context; } $context->debug('No click was recognized (normal, anchor or short anchor) - this might be a problem...'); return null; }
/** * @deprecated should be moved to hover banner */ public function previewHover() { $request = new Pap_Tracking_Request(); try { $banner = $this->getBanner($request->getBannerId(), $request->getAffiliateId(), $request->getChannelId()); if ($banner->getBannerType() == Pap_Features_HoverBanner_Hover::TYPE_HOVER) { return $banner->getPreviewCode($request->getUser()); } } catch (Exception $e) { $this->logMessage($e); } }
public function showBanner(Pap_Tracking_Request $request, Pap_Common_Banner $banner) { if($request->getAffiliateId() === 'preview'){ echo $banner->getWindowPreview(); } }