summaryrefslogtreecommitdiff
blob: 1893113dc5fade20372c63b8224907d6e3791e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
// get the page url
$pageUrlParam = '';

$permalink = get_permalink();

if (is_numeric(get_the_ID()) && filter_var($permalink, FILTER_VALIDATE_URL)){
    $permalink = rawurlencode($permalink);
    $permalink = str_replace('.','%2E',$permalink);
    
    $pageUrlParam = '#pageUrl/'.$permalink;
} 

// load config json for the premium theme
$premium_manager = new WMobilePack_Premium();
$json_config_premium = $premium_manager->set_premium_config();
    
$arr_config_premium = null;
if ($json_config_premium !== false) {
	$arr_config_premium = json_decode($json_config_premium, true);
}


// check if front page is a static page
if(get_option('show_on_front') == 'page' && get_option('page_on_front') == get_the_ID()){
	require_once('template.php');// load app
} else {
	
	// check if we have a valid domain
	if (isset($arr_config_premium['domain_name']) && filter_var('http://'.$arr_config_premium['domain_name'], FILTER_VALIDATE_URL)) {
		header("Location: http://".$arr_config_premium['domain_name'].$pageUrlParam);
	} else {
		header("Location: ".home_url().$pageUrlParam);
	}	
	
}
?>