Files
medicalalert-web-reloaded/wp/wp-content/plugins/iper-medical/campaign/templates/single-campaign.php
2024-02-21 14:18:40 +00:00

71 lines
2.2 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);
$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);
$campaignStart.=" 00:00:00";
$campaignEnd.=" 23:59:59";
$campaignStart = strtotime($campaignStart);
$campaignEnd = strtotime($campaignEnd);
if($now>=$campaignStart && $now<=$campaignEnd){
$controller = IperCampaignController::instance();
$controller->setCampaign($campaignID,$campaignPhone,$campaignFive9CallbackCampaign,$WebPromotionText);
}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'];
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;
}