<?php

$country_code = get_geoIP();
$keywords = simple_fields_value('keywords');
$keyword_arr = explode(',', $keywords);
$key_index = 0;
if (count($keyword_arr) > 1) {
    $key_index = array_rand($keyword_arr, 1);
}
$filter_key = trim(strip_tags($keyword_arr[$key_index]));
$filter_key = strtolower($filter_key);
$filter_key = keyword_dictionary($filter_key);
$filter_key = str_replace(' ', '-', $filter_key);
$custom_keyword = $filter_key;
switch ($country_code) {
    case 'PH':
        $widget_url = "http://tripzilla.ph/widgets/tp_feed/" . $custom_keyword;
        break;
    case 'MY':
        $widget_url = "http://tripzilla.my/widgets/tp_feed/" . $custom_keyword;
        break;
    default:
        $widget_url = "http://tripzilla.sg/widgets/tp_feed_new/" . $custom_keyword;
        break;
}
?>

<div class="sidebar-widget row type-1">
	<div class="inner">
		<div class="widget-title" style="margin-bottom:20px !important;"><h4>TOUR PACKAGES</h4></div>
		<iframe src="<?php 
Example #2
0
function cn_nf_url_parse($content)
{
    $country_code = get_geoIP();
    switch ($country_code) {
        case 'SG':
            $country_url = 'tripzilla.sg/';
            break;
        case 'MY':
            $country_url = 'tripzilla.my/';
            break;
        case 'VN':
            $country_url = 'tripzilla.vn/';
            break;
        case 'PH':
            $country_url = 'tripzilla.ph/';
            break;
        default:
            $country_url = 'tripzilla.sg/';
            break;
    }
    $country_url = 'tripzilla.sg/';
    preg_match_all('#<a href="(.*?)".*?>#ims', $content, $matches);
    $srcUrl = 'http://tz_location/';
    if (!empty($matches)) {
        foreach ($matches[1] as $k => $v) {
            $url = $matches[1][$k];
            $pos = strpos($url, $srcUrl);
            if ($pos !== false) {
                $content = str_replace($srcUrl, 'http://' . $country_url, $content);
            }
        }
    }
    $srcUrl = 'http://flyzilla.com';
    if (!empty($matches)) {
        foreach ($matches[1] as $k => $v) {
            $url = $matches[1][$k];
            $pos = strpos($url, $srcUrl);
            if ($pos !== false) {
                $content = str_replace($srcUrl, 'https://flyzilla.com', $content);
            }
        }
    }
    preg_match_all('#iframe src="(.*?)"#ims', $content, $matches);
    $srcUrl = 'http://flyzilla.com';
    if (!empty($matches)) {
        foreach ($matches[1] as $k => $v) {
            $url = $matches[1][$k];
            $pos = strpos($url, $srcUrl);
            if ($pos !== false) {
                $content = str_replace($srcUrl, 'https://flyzilla.com', $content);
            }
        }
    }
    $check_mobile = detect_mobile();
    if ($check_mobile == 'true') {
        preg_match_all('#<img .*? src="http://static.tripzilla.com/(.*?)".*?>#ims', $content, $t_static);
        $replaceImg = '_300x.jpg';
        if (!empty($t_static)) {
            foreach ($t_static[1] as $k => $v) {
                $oriImg = '_620x.jpg';
                $content = str_replace($oriImg, $replaceImg, $content);
                $content = preg_replace('#width=".*?"#ims', 'width=100%', $content);
                $content = preg_replace('#height=".*?"#ims', '', $content);
            }
        }
    }
    return $content;
}