Files
medicalalert-web-reloaded/wp/wp-content/plugins/iper-medical/campaign/templates/single-campaign.php
Rachit Bhargava 5d0f0734d8 first commit
2023-07-21 17:12:10 -04:00

85 lines
3.0 KiB
PHP

<?php
session_start();
$now=time();
$campaignTitle = get_the_title();
$campaignID = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_ID,true);
$campaignPhone = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_PHONE,true);
$controlPhone = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_ControlPhone,true);
$CanaryPhone = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_CanaryPhone,true);
$campaignStart = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_START_DATE,true);
$campaignEnd = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_END_DATE,true);
$campaignLink = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_LANDING_URL,true);
$campaignFive9CallbackCampaign = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_FIVE9,true);
$WebPromotionText = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_WEB_PROMOTION_TEXT,true);
$WebTopBarSpecialOffer = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_WEB_TOP_BAR,true);
$Google_KW = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_Google_KW,true);
$ABTest = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_AB_Test,true);
$ConfirmationPageText = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_ConfirmationPageText,true);
$campaignStart.=" 00:00:00";
$campaignEnd.=" 23:59:59";
$campaignStart = strtotime($campaignStart);
$campaignEnd = strtotime($campaignEnd);
if($now>=$campaignStart && $now<=$campaignEnd){
//campaign active
$controller = IperCampaignController::instance();
$controller->setCampaign($campaignID,$campaignPhone,$campaignFive9CallbackCampaign,$WebPromotionText,$WebTopBarSpecialOffer,$Google_KW,$ABTest,$ConfirmationPageText,$CanaryPhone,$controlPhone);
}else{
//campaign expired or not yet started
}
function append_query_string($url) {
return add_query_arg($_GET, $url);
}
add_filter('the_permalink', 'append_query_string');
$permalink = append_query_string($url);
$url = (empty($campaignLink)) ? get_home_url() : $campaignLink;
$myurl = get_option('siteurl');
$campaignurl = (empty($campaignLink)) ? get_home_url() : $campaignLink;
$utm_campaign = $_GET['dynamic_id'];
/* For testing
ob_flush();
ob_start();
var_dump($permalink);
file_put_contents("dumps.txt", ob_get_flush());
*/
switch ($utm_campaign) {
case "landline" :
header ("location: /product/home-system-landline/");
break;
case "cellular" :
header ("location: /product/home-system-cellular/");
break;
case "home" :
header ("location: /home-system" );
break;
case "mobile" :
header ("location: /product/mobile-system");
break;
case "fall" :
header ("location: /fall-detection");
break;
case "app" :
header ("location: /mobile-app");
break;
case "quiz" :
header ("location: /free-medical-monitoring-assessment");
break;
case "faq" :
header ("location: /frequently-asked-questions");
break;
case "reviews" :
header ("location: /reviews");
break;
default:
header ("location:" . $url.$permalink);
break;
}