prefix.'ap_transaction ( ap_transactionID bigint(20) unsigned NOT NULL AUTO_INCREMENT, network varchar(32) NOT NULL, TransactionId_network varchar(128) NOT NULL, Date datetime NOT NULL, SubId int(10) unsigned NOT NULL, ProgramId int(10) unsigned NOT NULL, ProgramTitle varchar(1024) NOT NULL, Transaction char(1) NOT NULL, Price float unsigned NOT NULL, Commission float NOT NULL, Confirmed float NOT NULL, CheckDate datetime NOT NULL, TransactionStatus varchar(64) NOT NULL, PRIMARY KEY (ap_transactionID), KEY SubId (SubId), KEY TransactionStatus (TransactionStatus), KEY ProgramId (ProgramId), KEY network (network), KEY Date (Date) );'; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } static public function deactivation() { wp_clear_scheduled_hook('affiliate_power_daily_event'); } static public function uninstall() { global $wpdb; $sql = 'DROP TABLE '.$wpdb->prefix.'ap_transaction;'; $wpdb->query($sql); delete_option('affiliate-power-options'); } static public function addSubIds ($content) { $options = get_option('affiliate-power-options'); if ($options['add-sub-ids'] === 0) { return $content; } $id = get_the_ID(); //affili.net $content = preg_replace("@(['\"]http://partners\.webmasterplan\.com/click\.asp[^'\"]+)(['\"])@", "$1&subid=".$id."$2", $content); //zanox $content = preg_replace("@(['\"]http://[a-z\-\.]+zanox[a-z\-\.]+/ppc/[A-Z0-9\?]+)T(['\"])@", "$1S".$id."T$2", $content); //tradedoubler $content = preg_replace("@(['\"]http://clkde\.tradedoubler\.com/click[^'\"]+)(['\"])@", "$1&epi=".$id."$2", $content); return $content; } static public function addSubIdsPrettyLink ($arrLinkInfo) { $options = get_option('affiliate-power-options'); if ($options['add-sub-ids'] === 0) { return $arrLinkInfo; } $id = url_to_postid($_SERVER['HTTP_REFERER']); $link = $arrLinkInfo['url']; //affili.net if (strpos($link, 'partners.webmasterplan.com')) { $link .= '&subid='.$id; } //zanox elseif (strpos($link, "zanox")) { $link = str_replace("T", "S".$id."T", $link); } //tradedoubler elseif (strpos($link, "tradedoubler")) { $link .= '&epi='.$id; } $arrLinkInfo['url'] = $link; return $arrLinkInfo; } } ?>