/** * generates code for .htaccess mod_rewrite * */ private function generateHtaccessCode($prefix, $separator, $suffix) { if($separator == '') { $separator = '/'; } $aid = Pap_Tracking_Request::getAffiliateClickParamName(); $bid = Pap_Tracking_Request::getBannerClickParamName(); $channel = Pap_Tracking_Request::getChannelParamName(); $data1 = Pap_Tracking_Request::getClickData1ParamName(); $tb = new Pap_Tracking_TrackerBase(); $scriptUrl = $tb->getScriptUrl("click.php"); $separators = str_replace($separator, '', '_-/'); $htaccessCode = "# Start Post Affiliate SEO Code----\n RewriteEngine On\n RewriteRule ^".$prefix."([a-zA-Z0-9".$separators."]+)".$suffix."\$ $scriptUrl?$aid=\$1 [R=301,L]\n RewriteRule ^".$prefix."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$suffix."\$ $scriptUrl?$aid=\$1&$bid=\$2 [R=301,L]\n RewriteRule ^".$prefix."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$suffix."\$ $scriptUrl?$aid=\$1&$bid=\$2&$channel=\$3 [R=301,L]\n RewriteRule ^".$prefix."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$separator."([a-zA-Z0-9".$separators."]+)".$suffix."\$ $scriptUrl?$aid=\$1&$bid=\$2&$channel=\$3&$data1=\$4 [R=301,L]\n # End of Post Affiliate SEO Code\n"; return $htaccessCode; }
private function loadParentFromRequest() { $affiliateParamName = Pap_Tracking_Request::getAffiliateClickParamName(); if (array_key_exists($affiliateParamName, $_REQUEST)) { $this->addValue("parentAffiliateIdFromRequest", $_REQUEST[$affiliateParamName]); } else { $this->addValue("parentAffiliateIdFromRequest", ""); } }
public static function getSignupScriptUrl($useParent = true, Pap_Common_User $user = null) { $url = Gpf_Paths::getAffiliateSignupUrl(); if ($useParent) { if ($user == null) { $user = Pap_Affiliates_User::getUserById(Gpf_Session::getAuthUser()->getPapUserId()); } $url .= '?' . Pap_Tracking_Request::getAffiliateClickParamName() . '=' . $user->getRefId(); } return $url; }
protected function loadSetting() { parent::loadSetting(); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_NEW_SALE_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SIGNUP_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SALE_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::SUPPORT_DIRECT_LINKING); $this->addSetting(Pap_Settings::MAIN_SITE_URL); $this->addSetting(Pap_Settings::TEXT_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::IMAGE_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::FLASH_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO); $this->addSetting(Gpf_Settings_Gpf::BRANDING_QUALITY_UNIT); $this->addSetting(Pap_Settings::BRANDING_KNOWLEDGEBASE_LINK); $this->addSetting(Pap_Settings::BRANDING_POST_AFFILIATE_PRO_HELP_LINK); $this->addSetting(Pap_Settings::BRANDING_TUTORIAL_VIDEOS_ENABLED); $this->addSetting(Pap_Settings::SETTING_LINKING_METHOD); Gpf_Plugins_Engine::extensionPoint('PostAffiliate.ApplicationSettings.loadSetting', $this); $this->addValue(Pap_Settings::PARAM_NAME_USER_ID, Pap_Tracking_Request::getAffiliateClickParamName()); $this->addValue(Pap_Settings::PARAM_NAME_BANNER_ID, Pap_Tracking_Request::getBannerClickParamName()); $currentTheme = new Gpf_Desktop_Theme(); $this->addValue("desktopMode", $currentTheme->getDesktopMode()); //TODO - IIF Export Format - easy solution for adding other export button than CSV, if needed other formats need to refactor (find out if plugin is active) $this->addValue("quickBooksPluginActive", $this->isPluginActive('QuickBooks')); try { $defaultCurrency = Gpf_Db_Currency::getDefaultCurrency(); $this->addValue("currency_symbol", $defaultCurrency->getSymbol()); $this->addValue("currency_precision", $defaultCurrency->getPrecision()); $this->addValue("currency_wheredisplay", $defaultCurrency->getWhereDisplay()); } catch(Gpf_Exception $e) { $this->addValue("currency_symbol", "Unknown"); $this->addValue("currency_precision", 2); $this->addValue("currency_wheredisplay", 1); } }
/** * returns user object from standard parameter from request * * @return string */ protected function getUserFromParameter(Pap_Contexts_Click $context) { $parameterName = Pap_Tracking_Request::getAffiliateClickParamName(); if($parameterName == '') { $context->debug(" Cannot get name of request parameter for affiliate ID"); return null; } $context->debug(" Trying to get affiliate from request parameter '$parameterName'"); $userId = $context->getAffiliateId(); if($userId != '') { $context->debug(" Setting affiliate from request parameter. Affiliate Id: ".$userId); return $this->getUserById($context, $userId); } $context->debug(" Affiliate not found in parameter"); return null; }
public function getSrcCode(Pap_Common_Banner $banner, Pap_Common_User $user, Pap_Db_Channel $channel = null, $data1 = '', $data2 = ''){ $code = $this->getScriptUrl("imp.php"); $code .= "?".Pap_Tracking_Request::getAffiliateClickParamName()."=".$user->getRefId(); $code .= "&".Pap_Tracking_Request::getBannerClickParamName()."=".$banner->getId(); if ($banner->getParentBannerId() != null) { $code .= "&".Pap_Tracking_Request::getRotatorBannerParamName()."=".$banner->getParentBannerId(); } if($channel != null && is_object($channel)) { $code .= "&".Pap_Tracking_Request::getChannelParamName()."=".$channel->getValue(); } if($data1 != '') { $code .= "&".Pap_Tracking_Request::getExtraDataParamName(1)."=".$data1; } if($data2 != '') { $code .= "&".Pap_Tracking_Request::getExtraDataParamName(2)."=".$data2; } return $code; }
public function getAffiliateId() { return $this->getRequestObject()->getRequestParameter(Pap_Tracking_Request::getAffiliateClickParamName()); }
/** * @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; }
/** * @return String url parameters style click url (requires integration code on landing page) */ private function getUrlParametersClickUrl(Pap_Common_Banner $banner = null, Pap_Common_User $user, $specialDesturl = '', Pap_Db_Channel $channel = null, $urlSeparator = '?', $data1 = '', $data2 = '') { $clickUrl = $this->getDestinationUrl($banner, $specialDesturl, $user); $anchorParams = ''; if($urlSeparator !== '#' && $anchorPos = strpos($clickUrl, '#')) { $anchorParams = substr($clickUrl, $anchorPos); $clickUrl = substr($clickUrl, 0, $anchorPos); } $firstParamSeparator = '&'; if ($urlSeparator !== '#') { $clickUrl .= (strpos($clickUrl, '?') === false) ? $urlSeparator : $firstParamSeparator; } else { $clickUrl .= (strpos($clickUrl, '#') === false) ? $urlSeparator : $firstParamSeparator; } $clickUrl .= Pap_Tracking_Request::getAffiliateClickParamName()."=".$user->getRefId(); $clickUrl .= $this->getBannerParams($banner); if($channel != null && is_object($channel)) { $clickUrl .= "&".Pap_Tracking_Request::getChannelParamName()."=".$channel->getValue(); } if ($data1 != '') { $clickUrl .= "&".Pap_Tracking_Request::getExtraDataParamName(1)."=".$data1; } if ($data2 != '') { $clickUrl .= "&".Pap_Tracking_Request::getExtraDataParamName(2)."=".$data2; } $clickUrl .= $anchorParams; return $clickUrl; }