public function readRequestVariables() { $request = new Pap_Tracking_Request(); $this->testMode = $request->getPostParam('ap_test'); $this->securityCode = $request->getPostParam('ap_securitycode'); $this->purchaseType = $request->getPostParam('ap_purchasetype'); // assign posted variables to local variables $cookieValue = stripslashes($request->getPostParam('apc_'.Gpf_Settings::get(AlertPay_Config::CUSTOM_FIELD_NUMBER))); $this->setCookie($cookieValue); $this->setTotalCost($request->getPostParam('ap_totalamount')); $this->setTransactionID($request->getPostParam('ap_referencenumber')); $this->setEmail($request->getPostParam('ap_custemailaddress')); $this->setProductID($request->getPostParam('ap_itemname')); $this->setPaymentStatus($request->getPostParam('ap_status')); $this->debug('Request variables: '. 'testMode:'.$this->testMode.', '. 'securityCode:'.$this->securityCode.', '. 'purchaseType:'.$this->purchaseType.', '. 'cookieValue:'.$this->getCookie().', '. 'totalCost:'.$this->getTotalCost().', '. 'transactionId:'.$this->getTransactionID().', '. 'email:'.$this->getEmail().', '. 'productID:'.$this->getProductID().', '. 'paymentStatus:'.$this->getPaymentStatus()); }
/** * 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", ""); } }
/** * @param $type * @return Gpf_Log_Logger */ public static function create($type = self::SYSTEM_DEBUG_TYPE) { $logLevel = self::getLogLevel($type); $request = new Pap_Tracking_Request(); if($request->getDebug() == Gpf::YES) { $logLevel = Gpf_Log::DEBUG; } $logger = Gpf_Log_Logger::getInstance($type); $logger->setGroup(substr($type, 0, 4) . '-' . Gpf_Common_String::generateId(10)); $logger->setType($type); $logger->add(Gpf_Log_LoggerDatabase::TYPE, $logLevel); if($request->getDebug() == Gpf::YES) { $logger->add(Gpf_Log_LoggerDisplay::TYPE, $logLevel); } return $logger; }
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; }
public function readRequestAffiliateVariables(Pap_Tracking_Request $request) { $this->setUserFirstName($request->getRequestParameter('customer_fname')); $this->setUserLastName($request->getRequestParameter('customer_lname')); $this->setUserEmail($request->getRequestParameter('email')); $this->setUserCity($request->getRequestParameter('city')); $this->setUserAddress($request->getRequestParameter('address1')); }
public function readRequestVariables() { $request = new Pap_Tracking_Request(); // assign posted variables to local variables $this->setCookie(stripslashes($request->getRequestParameter('user1'))); $this->setTotalCost($request->getRequestParameter('amount')); $this->setTransactionID($request->getRequestParameter('transaction_id')); $this->setProductID($request->getRequestParameter('transaction_ref')); $this->setSubscriptionID($request->getRequestParameter('subscription_id')); }
private function resolveStatus() { $messageType = trim($this->request->getPostParam('message_type')); $this->debug('2checkout INS plugin: resolveStatus: '.$messageType); $this->notificationType = $messageType; switch ($messageType) { case 'ORDER_CREATED': case 'REFUND_ISSUED': case 'RECURRING_INSTALLMENT_SUCCESS': case 'RECURRING_STOPPED': case 'RECURRING_COMPLETE': $this->setPaymentStatus(true); return; } $this->setPaymentStatus(false); $this->debug('2checkout INS plugin: Message type not supported: ' . $messageType); }
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; }
private function getClickTrackingCode() { $code = '<script id="pap_x2s6df8d" src="'.Gpf_Paths::getInstance()->getFullScriptsUrl().'clickjs.php" type="text/javascript">'."\n"; $code .= '</script>'."\n"; $code .= '<script type="text/javascript">'."\n"; $code .= '<!--'."\n"; $code .= "var AffiliateID='".$this->user->getRefId()."'\n"; $code .= "var BannerID='".$this->site->getId()."'\n"; if($this->request->getRequestParameter('channel') != '') { $code .= "var Channel='".$this->request->getRequestParameter('channel')."'\n"; } if($this->request->getRequestParameter('data1') != '') { $code .= "var Data1='".$this->request->getRequestParameter('data1')."'\n"; } if($this->request->getRequestParameter('data2') != '') { $code .= "var Data2='".$this->request->getRequestParameter('data2')."'\n"; } $code .= 'papTrack();'."\n"; $code .= '//-->'."\n"; $code .= '</script>'."\n"; return $code; }
private function adjustTotalCost($originalTotalCost, Pap_Tracking_Request $request) { $totalCost = $originalTotalCost; $this->debug('Original totalcost: '.$totalCost); if (Gpf_Settings::get(AuthorizeNet_Config::DISCOUNT_TAX)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('x_tax')); $this->debug('Discounting tax ('.$request->getPostParam('x_tax').') from totalcost.'); } if (Gpf_Settings::get(AuthorizeNet_Config::DUTY_TAX)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('x_duty')); $this->debug('Discounting duty tax ('.$request->getPostParam('x_duty').') from totalcost.'); } if (Gpf_Settings::get(AuthorizeNet_Config::FREIGHT_TAX)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('x_freight')); $this->debug('Discounting freight tax ('.$request->getPostParam('x_freight').') from totalcost.'); } $this->debug('Totalcost after discounts: '.$totalCost); return $totalCost; }
private function adjustTotalCost(Pap_Tracking_Request $request) { $totalCost = $request->getPostParam('valor'); $this->debug('Original totalcost: '.$totalCost); if (Gpf_Settings::get(PagosOnline_Config::DISCOUNT_FEE)==Gpf::YES) { $totalCost = $totalCost - $request->getPostParam('valorAdicional'); $this->debug('Discounting fee ('.$request->getPostParam('valorAdicional').') from totalcost.'); } if (Gpf_Settings::get(PagosOnline_Config::DISCOUNT_TAX)==Gpf::YES) { $totalCost = $totalCost - $request->getPostParam('iva'); $this->debug('Discounting tax (IVA) ('.$request->getPostParam('iva').') from totalcost.'); } $this->debug('Totalcost after discounts: '.$totalCost); return $totalCost; }
/** * @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); } }
/** * @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; }
private function adjustTotalCost($originalTotalCost, Pap_Tracking_Request $request, $index = '') { $totalCost = $originalTotalCost; $this->debug('Original totalcost: '.$totalCost); if (Gpf_Settings::get(ISecure_Config::DISCOUNT_TAX)==Gpf::YES) { $tax = $request->getPostParam('xxxTotalTax'); if (!empty($tax)) { $totalCost = $this->discountFromTotalcost($totalCost, $tax); $tax = $totaltax; } else { $Items = explode("|",$this->doubleColonProducts); if (strpos($Items[count($Items)-1][4],"TAX") !== false ) { $totalCost = $this->discountFromTotalcost($totalCost, $Items[count($Items)-1][0]); $tax = $Items[count($Items)-1][0]; } else { $tax = 0; } } $this->debug('Discounting tax ('.$tax.') from totalcost.'); } $this->debug('Totalcost after discounts: '.$totalCost); return $totalCost; }
private function adjustTotalCost($originalTotalCost, Pap_Tracking_Request $request, $index = '') { $totalCost = $originalTotalCost; $this->debug('Original totalcost: '.$totalCost); if (Gpf_Settings::get(PayPal_Config::DISCOUNT_FEE)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('mc_fee'.$index)); $this->debug('Discounting fee ('.$request->getPostParam('mc_fee'.$index).') from totalcost.'); } if (Gpf_Settings::get(PayPal_Config::DISCOUNT_TAX)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('tax'.$index)); $this->debug('Discounting tax ('.$request->getPostParam('tax'.$index).') from totalcost.'); } if (Gpf_Settings::get(PayPal_Config::DISCOUNT_HANDLING)==Gpf::YES) { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('mc_handling'.$index)); $this->debug('Discounting handling ('.$request->getPostParam('mc_handling'.$index).') from totalcost.'); } if (Gpf_Settings::get(PayPal_Config::DISCOUNT_SHIPPING)==Gpf::YES) { if ($index == '' && $request->getPostParam('mc_shipping') == '') { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('shipping')); $this->debug('Discounting shipping ('.$request->getPostParam('shipping').') from totalcost.'); } else { $totalCost = $this->discountFromTotalcost($totalCost, $request->getPostParam('mc_shipping'.$index)); $this->debug('Discounting shipping ('.$request->getPostParam('mc_shipping'.$index).') from totalcost.'); } } $this->debug('Totalcost after discounts: '.$totalCost); return $totalCost; }
public function showBanner(Pap_Tracking_Request $request, Pap_Common_Banner $banner) { if($request->getAffiliateId() === 'preview'){ echo $banner->getWindowPreview(); } }
function getBannerParams(Pap_Common_Banner $banner = null){ $clickUrl = ''; if ($banner != null) { $clickUrl .= "&".Pap_Tracking_Request::getBannerClickParamName()."=".$banner->getId(); if ($banner->getParentBannerId()!= null) { $clickUrl .= "&".Pap_Tracking_Request::getRotatorBannerParamName()."=".$banner->getParentBannerId(); } } return $clickUrl; }
public function getRotatorBannerId() { return $this->getRequestObject()->getRequestParameter(Pap_Tracking_Request::getRotatorBannerParamName()); }
public static function isWrapperRequest(Pap_Common_Banner $banner, Pap_Tracking_Request $request){ return $banner->getWrapperId() !== null && $request->getRequestParameter(self::URL_PARAM_WRAPPER) !== ''; }
public function getReferrerUrl() { return Pap_Tracking_Request::decodeRefererUrl($this->rf); }
public function getReferrerUrl() { return Pap_Tracking_Request::decodeRefererUrl($this->get(Pap_Db_Table_Visits::REFERRERURL)); }
protected function setQueryParams(Gpf_Net_Http_Request $request) { $request->addQueryParam('visitorId', $this->visitorId); $request->addQueryParam('accountId', $this->accountId); $request->addQueryParam('url', Pap_Tracking_Request::encodeRefererUrl($this->getUrl())); $request->addQueryParam('referrer', Pap_Tracking_Request::encodeRefererUrl($this->getReferrerUrl())); $request->addQueryParam('tracking', '1'); $request->addQueryParam('getParams', $this->getGetParams()->getQuery()); $request->addQueryParam('cookies', $this->getOldCookies()); $request->addQueryParam('ip', $this->getIp()); $request->addQueryParam('useragent', $this->getUserAgent()); }
function __construct() { parent::__construct(); $this->cookie = new Pap_Tracking_Cookie(); }