/** * Gets clickUrl for banner * * @param Pap_Common_Banner $banner * @param Pap_Common_User $user * @param string $specialDestinationUrl * @return string */ public function getClickUrl(Pap_Common_Banner $banner = null, Pap_Common_User $user, $specialDestinationUrl = '', $flags = '', Pap_Db_Channel $channel = null, $data1 = '', $data2 = '') { if ($banner != null && $banner->getDynamicLink() != null && $flags == self::LINKMETHOD_REDIRECT) { return $this->getRedirectClickUrl($banner, $user, $banner->getDynamicLink(), $channel, $data1, $data2); } if($flags & Pap_Common_Banner::FLAG_DIRECTLINK) { return $this->geDirectLinkClickUrl($banner, $user, $specialDestinationUrl); } if ($this->getLinkingMethod($banner) == self::LINKMETHOD_REDIRECT) { return $this->getRedirectClickUrl($banner, $user, $specialDestinationUrl, $channel, $data1, $data2); } else if ($this->getLinkingMethod($banner) == self::LINKMETHOD_URLPARAMETERS) { return $this->getUrlParametersClickUrl($banner, $user, $specialDestinationUrl, $channel, '?', $data1, $data2); } else if ($this->getLinkingMethod($banner) == self::LINKMETHOD_MODREWRITE) { return $this->getModRewriteClickUrl($banner, $user, $specialDestinationUrl, $channel); } else if ($this->getLinkingMethod($banner) == self::LINKMETHOD_DIRECTLINK) { return $this->geDirectLinkClickUrl($banner, $user, $specialDestinationUrl, $channel); } else if ($this->getLinkingMethod($banner) == self::LINKMETHOD_ANCHOR) { return $this->getAnchorClickUrl($banner, $user, $specialDestinationUrl, $channel, $data1, $data2); } }
public function getBannerInWrapper($bannercode, Pap_Common_Banner $banner, Pap_Common_User $user){ $wrapper = new Pap_Db_BannerWrapper(); $wrapper->setId($banner->getWrapperId()); $wrapper->load(); $code = $wrapper->getCode(); $code = $this->replaceConstant(self::CONST_WIDTH, $banner->getWidth(), $code); $code = $this->replaceConstant(self::CONST_HEIGHT, $banner->getHeight(), $code); $code = $this->replaceConstant(self::CONST_HTML, $bannercode, $code); $code = $this->replaceConstant(self::CONST_NAME, $banner->getName(), $code); $code = $this->replaceConstant(self::CONST_BANNERID, $banner->getId(), $code); $completeUrl = $banner->getBannerScriptUrl($user) . '&' . self::URL_PARAM_WRAPPER . '=' . self::URL_VALUE_INNERPAGE; if($banner->getDynamicLink() != '') { $completeUrl .= '&'. Pap_Db_Table_CachedBanners::DYNAMIC_LINK . '=' . urlencode($banner->getDynamicLink()); } $code = $this->replaceConstant(self::CONST_HTMLCOMPL, $completeUrl, $code); $code = $this->replaceConstant(self::CONST_HTMLCOMPL_ENCODED, urlencode($completeUrl), $code); $code = $this->replaceConstant(self::CONST_HTMLCLEAN, $banner->getBannerScriptUrl($user) . '&' . self::URL_PARAM_WRAPPER . '=' . self::URL_VALUE_CLEAN, $code); $code = $this->replaceConstant(self::CONST_CLICKURL, $banner->getClickUrl($user), $code); $code = $this->replaceConstant(self::CONST_TARGETURL, $banner->getDestinationUrl($user), $code); $code = $this->replaceConstant(self::CONST_HTMLJSURL, $banner->getBannerScriptUrl($user), $code); $code = $this->replaceConstant(self::CONST_SEOSTRING, $banner->getSeoString(), $code); return Pap_Common_Banner::cleanIncompleteCode($code); }