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() {
return add_query_arg( array( WPAM_PluginConfig::$RefKey => $this->getTrackingKey()->pack() ),
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();
}
}