affiliate = $affiliate; $this->creative = $creative; } public function getTrackingKey() { $trackingKey = new WPAM_Tracking_TrackingKey(); $trackingKey->setAffiliateRefKey($this->affiliate->uniqueRefKey); $trackingKey->setCreativeId($this->creative->creativeId); return $trackingKey; } public function getUrl() { $aff_landing_page = get_option(WPAM_PluginConfig::$AffLandingPageURL); if(isset($aff_landing_page) && !empty($aff_landing_page)){ $aff_landing_page = trailingslashit($aff_landing_page); $aff_landing_page = $aff_landing_page.trim($this->creative->slug); return add_query_arg( array( WPAM_PluginConfig::$wpam_id => $this->affiliate->affiliateId ), $aff_landing_page); } return add_query_arg( array( WPAM_PluginConfig::$wpam_id => $this->affiliate->affiliateId ), home_url( trim( $this->creative->slug ) ) ); } public function getHtmlSnippet() { switch ($this->creative->type) { case 'image': $html = "getUrl() . "\">"; $html .= "creative->imagePostId) . "\" style=\"border: 0;\" title=\"{$this->creative->altText}\"/>"; $html .= ""; return $html; case 'text': $html = "getUrl() . "\" title=\"{$this->creative->altText}\">"; $html .= $this->creative->linkText; $html .= ""; return $html; default: return NULL; } } public function getImpressionHtmlSnippet() { if (get_option (WPAM_PluginConfig::$AffEnableImpressions) ) { $impurl = add_query_arg( array( WPAM_PluginConfig::$RefKey => $this->getTrackingKey()->pack() ), WPAM_URL . "/imp.php" ); $html = ""; } else $html = ""; return $html . $this->getHtmlSnippet(); } }