<?php



function removeSpchar($str) {

    $str = str_replace("%", "-", $str);

    $str = str_replace("#", "-", $str);

    $str = str_replace("!", "-", $str);

    $str = str_replace("@", "-", $str);

    $str = str_replace("^", "-", $str);

    $str = str_replace("*", "-", $str);

    $str = preg_replace('/\s\&+/', '-', $str);

    $str = preg_replace("/\s/", "-", $str);

    $str = preg_replace('/\-\-+/', '-', $str);

    $str = str_replace("(", "-", $str);

    $str = str_replace(")", "-", $str);

    $str = str_replace("(", "-", $str);

    $str = str_replace(")", "_", $str);

    $str = str_replace("_", "-", $str);

    $str = str_replace("&", "-", $str);

    $str = str_replace("'", "-", $str);

    $str = preg_replace('/\-\-+/', '-', $str);

    $str = rtrim($str, '-');

    return $str;

}

function chageURL($str) {

    $str = str_replace("%", "-", $str);

    $str = str_replace("#", "-", $str);

    $str = str_replace("!", "-", $str);

    $str = str_replace("@", "-", $str);

    $str = str_replace("^", "-", $str);

    $str = str_replace("*", "-", $str);

    $str = preg_replace('/\s\&+/', '-', $str);

    $str = preg_replace("/\s/", "-", $str);

    $str = preg_replace('/\-\-+/', '-', $str);

    $str = str_replace("(", "-", $str);

    $str = str_replace(")", "-", $str);

    $str = str_replace("(", "-", $str);

    $str = str_replace(")", "_", $str);

    $str = str_replace("_", "-", $str);

    $str = str_replace("&", "-", $str);

    $str = str_replace("'", "-", $str);

    $str = preg_replace('/\-\-+/', '-', $str);

    $str = rtrim(strtolower($str), '');

    return $str;

}

function url_get_contents ($Url) {
    if (!function_exists('curl_init')){ 
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}
function priceChange($val){
    //$price =  number_format($val, 2, '.', ',');
    return $val."kr";
}
function pageSEO(){
$sql = db_query("select * from home_seo");
$row = mysqli_fetch_array($sql);
$page_seo['home']['meta_title']  = $row['meta_title'];
$page_seo['home']['meta_desc']  = $row['meta_description'];
$page_seo['home']['keywords']  = $row['keywords'];

$sql = db_query("select * from about_seo");
$row = mysqli_fetch_array($sql);
$page_seo['about']['meta_title']  = $row['meta_title'];
$page_seo['about']['meta_desc']  = $row['meta_description'];
$page_seo['about']['keywords']  = $row['keywords'];

$sql = db_query("select * from contact_seo");
$row = mysqli_fetch_array($sql);
$page_seo['contact']['meta_title']  = $row['meta_title'];
$page_seo['contact']['meta_desc']  = $row['meta_description'];
$page_seo['contact']['keywords']  = $row['keywords'];

$sql = db_query("select * from how_it_work_seo");
$row = mysqli_fetch_array($sql);
$page_seo['how_it_work']['meta_title']  = $row['meta_title'];
$page_seo['how_it_work']['meta_desc']  = $row['meta_description'];
$page_seo['how_it_work']['keywords']  = $row['keywords'];

$sql = db_query("select * from faq_seo");
$row = mysqli_fetch_array($sql);
$page_seo['faq']['meta_title']  = $row['meta_title'];
$page_seo['faq']['meta_desc']  = $row['meta_description'];
$page_seo['faq']['keywords']  = $row['keywords'];

return $page_seo;
}

function pageurl(){
    $sql = db_query("select page_url from about_seo"); 
    $row = mysqli_fetch_array($sql);
    $about  = $row['page_url'];
    
    $sql2 = db_query("select page_url from contact_seo"); 
    $row2 = mysqli_fetch_array($sql2);
    $contact  = $row2['page_url'];
        
    $sql21 = db_query("select page_url from faq_seo"); 
    $row21 = mysqli_fetch_array($sql21);
    $faq  = $row21['page_url'];

    $sql22= db_query("select page_url from how_it_work_seo"); 
    $row22 = mysqli_fetch_array($sql22);
    $howitworks  = $row22['page_url'];
    
    $object = new stdClass();
    $object->about = $about;
    $object->contact    = $contact;
    $object->faq    = $faq;
    $object->howitworks     = $howitworks;
    
    
    return $object;
}

function addhttp($url) {
    if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
        $url = "http://" . $url;
    }
    return $url;
}


$secretKey 	 = "6LcZYsUaAAAAACkOhBLEW3D7DWjS9cOaWulbnY6s";

$sitekey	 = "6LcZYsUaAAAAACqnVLGPEw9flraEfNcf-nTHmwRJ";



?>