Ejemplo n.º 1
0
function country_list($metalist)
{
    global $lang;
    global $region;
    $postID = get_the_ID();
    //echo "PID: $postID";
    list($null1, $null2, $null3, $posturl) = explode("/", get_permalink());
    list($null1, $null2, $null3, $null4, $posturl2) = explode("/", get_permalink());
    //We are at the main page (ID==1821)
    if ($postID == "1821") {
        $posturl = "";
    }
    if ($postID == "1821") {
        $posturl2 = "";
    }
    list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]);
    //echo "<br>PURL: 1: $posturl1 / 2: $posturl2 / $posturl3 / $posturl4 <br>";
    if ($posturl2 != "") {
        $posturl = $posturl2;
    }
    //we are in a qtranslate subfolder!
    //check for login page
    //list($posturl1,$posturl2,$posturl3,$posturl4)=explode("/",$_SERVER["REQUEST_URI"]);
    //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>";
    if (substr($posturl2, 0, 6) == "login?") {
        $posturl = $posturl2;
    }
    if (substr($posturl1, 0, 6) == "login?") {
        $posturl = $posturl1;
    }
    if (is_search()) {
        //echo "Search".$_SERVER["REQUEST_URI"];
        list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]);
        //list($null1,$null2,$null3,$null4,$posturl2)=explode("/",get_category_link($cid));
        //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>";
        $posturl = $posturl2;
        //echo "PURL: $posturl";
        //if (defined($posturl2)) {
        //	$posturl  = $posturl2;
        //}
    }
    if (is_404()) {
        $posturl = "";
        $posturl2 = "";
    }
    if (is_archive() or is_tag()) {
        //archives need special handling, otherwise first product will be used
        //echo "Archiv!".get_permalink()."<br>".$postID;
        //echo "<br>".get_permalink($postID);
        //$cid=get_the_category_ID();
        //echo get_the_category( $postID );
        //ob_start();
        //the_category_ID();
        //$cid = ob_get_clean();
        //echo "CID: $cid[1]";
        //echo "URL: ".$_SERVER["REQUEST_URI"];
        //echo "<br>CID:".the_category_ID();
        //echo "link: ".get_category_link($cid);
        list($posturl1, $posturl2, $posturl3, $posturl4) = explode("/", $_SERVER["REQUEST_URI"]);
        //list($null1,$null2,$null3,$null4,$posturl2)=explode("/",get_category_link($cid));
        //echo "<br>PURL: $posturl1 / $posturl2 / $posturl3 / $posturl4 <br>";
        if ($posturl1 == "category" or $posturl1 == "tag") {
            $posturl = $posturl1;
            if ($posturl2 != "") {
                $posturl .= "/{$posturl2}";
            }
        }
        if ($posturl2 == "category" or $posturl2 == "tag") {
            $posturl = "{$posturl2}";
        }
        if ($posturl3 != "") {
            $posturl .= "/{$posturl3}";
        }
        if ($posturl4 != "") {
            $posturl .= "/{$posturl4}";
        }
        //echo "AA: $posturl1";
        //echo "AA: $posturl2";
    }
    //echo "PURL: $posturl";
    $posturlde = $posturl;
    $posturlcom = $posturl;
    #echo "PU:".$posturlcom;
    //remove language selection for .de
    $posturlde = str_replace("?lang=jp", "", $posturlde);
    $posturlde = str_replace("?lang=it", "", $posturlde);
    $posturlde = str_replace("?lang=es", "", $posturlde);
    $posturlde = str_replace("?lang=uk", "", $posturlde);
    $posturlde = str_replace("?lang=ca", "", $posturlde);
    $posturlde = str_replace("?lang=in", "", $posturlde);
    $posturlde = str_replace("?lang=fr", "", $posturlde);
    $posturlde = str_replace("?lang=cn", "", $posturlde);
    $posturlde = str_replace("?lang=en", "", $posturlde);
    $posturlde = str_replace("?lang=nl", "", $posturlde);
    $posturlde = str_replace("?lang=br", "", $posturlde);
    $posturlcom = str_replace("?lang=jp", "", $posturlcom);
    $posturlcom = str_replace("?lang=it", "", $posturlcom);
    $posturlcom = str_replace("?lang=es", "", $posturlcom);
    $posturlcom = str_replace("?lang=uk", "", $posturlcom);
    $posturlcom = str_replace("?lang=ca", "", $posturlcom);
    $posturlcom = str_replace("?lang=in", "", $posturlcom);
    $posturlcom = str_replace("?lang=fr", "", $posturlcom);
    $posturlcom = str_replace("?lang=cn", "", $posturlcom);
    $posturlcom = str_replace("?lang=en", "", $posturlcom);
    $posturlcom = str_replace("?lang=nl", "", $posturlcom);
    $posturlcom = str_replace("?lang=br", "", $posturlcom);
    if ($posturlcom == "hardware-profile") {
        $url = getCurrentUrl();
        $pieces = parse_url($url);
        $urlpath = $pieces['path'];
        $hwprofpos = strpos($urlpath, "hardware-profile/user");
        $hwprofposg = strpos($urlpath, "hardware-profile/guser");
        # if we have a public page this fails and we need the following value
        $hwprofposs = strpos($urlpath, "hardware-profile/system");
        #print "$urlpath - $hwprofpos - $hwprofposs<br>";
        if ($hwprofposs != "") {
            $rurl = substr($urlpath, $hwprofposs);
        }
        //echo "URL: $posturlcom";
        //echo "<br>URL2: $rurl";
        $posturlcom = "{$rurl}";
        $posturlde = "{$rurl}";
        if ($hwprofpos != "") {
            # translate public user profile links to guid links to make them available on other servers
            $rurl = substr($urlpath, $hwprofpos);
            $hwprofpos = strpos($urlpath, "/hardware-profile/user");
            $uid = (int) substr($urlpath, $hwprofpos + 22);
            $guid = lhg_get_guid_from_uid($uid);
            #locally linking to standard user profile, transversally linking to guid
            if ($lang != "de") {
                $posturlde = "/hardware-profile/guser" . $guid;
            }
            if ($lang != "de") {
                $posturlcom = "/hardware-profile/user" . $uid;
            }
            if ($lang == "de") {
                $posturlcom = "/hardware-profile/guser" . $guid;
            }
            if ($lang == "de") {
                $posturlde = "/hardware-profile/user" . $uid;
            }
        }
        if ($hwprofposg != "") {
            # translate public user profile links to guid links to make them available on other servers
            $rurl = substr($urlpath, $hwprofpos);
            $hwprofpos = strpos($urlpath, "/hardware-profile/guser");
            $guid = (int) substr($urlpath, $hwprofposg + 22);
            #$guid = lhg_get_guid_from_uid( $uid );
            #locally linking to standard user profile, transversally linking to guid
            $rurl = "/hardware-profile/guser" . $guid;
            #if ($lang != "de") $posturlcom  = "/hardware-profile/user".$uid;
            #if ($lang == "de") $posturlcom  = "/hardware-profile/guser".$guid;
            #if ($lang == "de") $posturlde  = "/hardware-profile/user".$uid;
            $posturlcom = "{$rurl}";
            $posturlde = "{$rurl}";
        }
        # private profile page remains
        $posturlcom = "/hardware-profile";
        $posturlde = "/hardware-profile";
    }
    //translate tags
    if (is_tag()) {
        if ($region == "de" and ($posturl1 == "tag" or $posturl2 == "tag")) {
            //translated tags to be corrected
            $posturlcom = translate_tag($posturl);
        }
        if ($region != "de" and ($posturl1 == "tag" or $posturl2 == "tag")) {
            //translated tags to be corrected
            $posturlde = translate_tag($posturl);
        }
    }
    //translate categories
    if (is_archive()) {
        if ($region == "de" and ($posturl1 == "category" or $posturl2 == "category")) {
            //translated tags to be corrected
            $posturlcom = translate_category($posturl);
        }
        if ($region != "de" and ($posturl1 == "category" or $posturl2 == "category")) {
            //translated tags to be corrected
            $posturlde = translate_category($posturl);
        }
        $posturlde = str_replace("/page/2", "", $posturlde);
        $posturlde = str_replace("/page/3", "", $posturlde);
        $posturlde = str_replace("/page", "", $posturlde);
        $posturlcom = str_replace("/page/2", "", $posturlcom);
        $posturlcom = str_replace("/page/3", "", $posturlcom);
        $posturlcom = str_replace("/page", "", $posturlcom);
    }
    //echo "PU2: $posturlcom";
    if (!is_search() and !($postID == "1821") and !is_archive()) {
        //echo " ---------------- PU: $posturlcom  ---------";
        //check if postid is already in DB
        lhg_check_permalink($postID);
        if (is_single()) {
            //extract URL (w/o domain name) from database
            $comURL = lhg_URL_chomp(lhg_get_com_post_URL($postID));
            $deURL = lhg_URL_chomp(lhg_get_de_post_URL($postID));
            #error_log("DE URL: $deURL");
            //$comURL = get_post_meta($postID,'COM_URL',true);
            //$deURL  = get_post_meta($postID,'DE_URL',true);
            #echo "---------------------- CURL: $comURL";
            #echo "DURL: $deURL";
        } else {
            $comURL = get_post_meta($postID, 'COM_URL', true);
            $deURL = get_post_meta($postID, 'DE_URL', true);
        }
        /*
        if ($lang == "en") {
        	                $postid_de = lhg_get_postid_de_from_com($postID);
                 #echo "PID_de: $postid_de";
        
        
                 #echo "PL: ";
        	        }
        */
        //echo "---------------------- PURL-A: $posturlcom";
        // set default
        if ($comURL == "") {
            $comURL = $posturlcom;
        }
        #if ($deURL == "") $deURL = $posturlde;
        if (substr($comURL, 0, 1) == "/") {
            $comURL = substr($comURL, 1);
        }
        if (substr($deURL, 0, 1) == "/") {
            $deURL = substr($deURL, 1);
        }
        #if ($comURL != "") $posturlcom = $comURL;
        $posturlcom = $comURL;
        #if ($deURL  != "") $posturlde = $deURL;
        $posturlde = $deURL;
        //echo "---------------------- PURL-c: $posturlcom";
        //translation still missing -> redirect to main page
        //if ( ($comURL == "") and ($postID > 2599) and ($region == "de")) $posturlcom = "";
        //if ( ($deURL == "")  and ($postID > 2599) and ($region != "de")) $posturlde = "";
    }
    //echo "PURL: $posturlcom";
    //echo "PURL: $posturlde";
    //echo "LANG: $lang";
    //echo "Reg: $region";
    if ($region == "de") {
        //echo "Test $posturlcom -- ";
        $URLC = "http://www.linux-hardware-guide.com";
        $URLD = "";
    }
    if ($region != "de") {
        $URLC = "";
        $URLD = "http://www.linux-hardware-guide.de";
    }
    //$URLC="http://192.168.3.113"; //Debug
    if ($metalist == 1) {
        if ($region == "de") {
            echo '<meta http-equiv="Content-Language" content="de"/>';
        }
        if ($region == "de") {
            $URLD = "http://www.linux-hardware-guide.de";
        }
        # store url to be available globally (e.g. by wp-one-post-widget)
        global $posturlcom_glob;
        global $posturlde_glob;
        $posturlcom_glob = $posturlcom;
        $posturlde_glob = $posturlde;
        //create header meta-list
        //by qtranslate in "com" or here in "de" cases
        $URLC = "http://www.linux-hardware-guide.com";
        echo '
<link hreflang="EN-GB"   href="' . $URLC . '/uk/' . $posturlcom . '" rel="alternate" />
<link hreflang="ZH-Hans" href="' . $URLC . '/zh/' . $posturlcom . '" rel="alternate" />
<link hreflang="FR"      href="' . $URLC . '/fr/' . $posturlcom . '" rel="alternate" />
<link hreflang="IT"      href="' . $URLC . '/it/' . $posturlcom . '" rel="alternate" />
<link hreflang="JA"      href="' . $URLC . '/ja/' . $posturlcom . '" rel="alternate" />
<link hreflang="ES"      href="' . $URLC . '/es/' . $posturlcom . '" rel="alternate" />
<link hreflang="NL"      href="' . $URLC . '/nl/' . $posturlcom . '" rel="alternate" />
<link hreflang="EN-CA"   href="' . $URLC . '/ca/' . $posturlcom . '" rel="alternate" />
<link hreflang="EN-IN"   href="' . $URLC . '/in/' . $posturlcom . '" rel="alternate" />
<link hreflang="EN"      href="' . $URLC . '/' . $posturlcom . '"    rel="alternate" />
';
        if ($posturlde != "") {
            if ($region != "de") {
                echo '<link hreflang="DE"      href="' . $URLD . '/' . $posturlde . '"     rel="alternate" />';
            }
        }
        // <link hreflang="PT-BR"   href="'.$URLC.'/br/'.$posturlcom.'" rel="alternate" />
    } else {
        echo '<span class="flaglist">
        <a href="' . $URLD . '/' . $posturlde . '">
        <img src="/wp-content/plugins/qtranslate/flags/de.png" title="Region: Germany
Currency: &euro;" alt="Germany" /></a>';
        echo '<a href="' . $URLC . '/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/us.png"
title="Region: USA
Currency: &#36;" alt="USA" /></a>';
        echo '<a href="' . $URLC . '/ca/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/ca.png"
title="Region: Canada
Currency: CND&#36;"  alt="Canada" /></a>';
        echo '<a href="' . $URLC . '/uk/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/uk.png"
title="Region: United Kingdom
Currency: &pound;"  alt="UK" /></a>';
        echo '<a href="' . $URLC . '/fr/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/fr.png"
title="Region: France
Currency: &euro;"  alt="France" /></a>';
        echo '<a href="' . $URLC . '/es/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/es.png"
title="Region: Espana
Currency: &euro;"  alt="Espana" /></a>';
        echo '<a href="' . $URLC . '/it/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/it.png"
title="Region: Italia
Currency: &euro;"  alt="Italia" /></a>';
        echo '<a href="' . $URLC . '/nl/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/nl.png"
title="Region: Nederlands
Currency: &euro;"  alt="Nederlands" /></a>';
        /*
        echo '<a href="'.$URLC.'/br/'.$posturlcom.'"><img src="/wp-content/plugins/qtranslate/flags/br.png"
        title="Region: Brasil
        Currency: R&dollar;"></a>';
        */
        echo '<a href="' . $URLC . '/in/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/in.png"
title="Region: India
Currency: &#8377;"  alt="India" /></a>';
        echo '<a href="' . $URLC . '/ja/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/jp.png"
title="Region: Japan
Currency: &yen;"  alt="Japan" /></a>';
        echo '<a href="' . $URLC . '/zh/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/cn.png"
title="Region: China
Currency: RMB"  alt="China" /></a>

<br clear="all"/>';
        echo '</span>';
    }
}
function wp_one_post_widget($args, $vars = array())
{
    extract($args);
    $widget_number = (int) str_replace('wp-one-post-widget-', '', @$widget_id);
    $options = get_option('wp_one_post_widget');
    if (!empty($options[$widget_number])) {
        $vars = $options[$widget_number];
    }
    // ------ data used by several parts ----------
    $title = translate_title(get_the_title());
    $s = explode("(", $title);
    $short_title = trim($s[0]);
    global $post;
    global $wpdb;
    global $lhg_price_db;
    global $lang;
    global $txt_summary;
    global $txt_supplier;
    global $txt_cheapest_supplier;
    global $txt_rating;
    global $txt_select;
    global $txt_ratings;
    global $txt_sim_tags;
    global $txt_combine_tags;
    global $txt_wpop_register;
    global $txt_register_long;
    global $txt_send;
    global $txt_manage_subscr;
    global $txt_not_avail;
    global $txt_rate_yourself;
    global $txt_wpop_register;
    global $txt_button_string;
    //defined by amazon-product-in-a-post.php
    //echo "ID: $post->ID";
    if (is_single($post->ID)) {
        $querystr = "\r\n    SELECT {$wpdb->posts}.* \r\n    FROM {$wpdb->posts}\r\n    WHERE {$wpdb->posts}.post_title = '" . $vars['title'] . "'\r\n    AND {$wpdb->posts}.post_status = 'publish' \r\n    AND {$wpdb->posts}.post_type = 'post'\r\n  ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        foreach ($pageposts as $post) {
            setup_postdata($post);
            $title = $post->post_title;
            $excerpt = $post->post_excerpt;
            if (!$excerpt) {
                $excerpt = substr($post->post_content, 0, 100);
            }
            if (!$vars['thumbnail_position']) {
                $vars['thumbnail_position'] = 'left';
            }
            $thumb = get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => $vars['thumbnail_position']));
            $link = get_permalink($post->ID);
        }
        echo "\n{$before_widget}";
        echo '
    <div class="topright" style="border: 1px solid #2b8fc3; padding-left: 3px; padding-right:3px; padding-top: 1px; margin-bottom: 10px; background-color: #fff; padding-bottom: 17px;">';
        echo '
        <div class="wp-one-summary">' . $txt_summary . "</div>";
        //	if(empty($vars['custom_title'])): echo $before_title . "A".$vars['title'] . $after_title; else: echo "<h2>".$vars['custom_title'] . "</h2>"; endif;
        if ($vars['use_thumbnail'] == 'yes') {
            $content_widget = $thumb . '<p>' . $excerpt . ' <a href="' . $link . '">' . $vars['readmore'] . '</a></p>';
        } else {
            $content_widget = '<p>' . $excerpt . ' <a href="' . $link . '">' . $vars['readmore'] . '</a></p>';
        }
        //$thumb = get_the_post_thumbnail($post->ID);
        //echo "$thumb";
        //Rating Overview
        $post_id = $post->ID;
        // Check IP From IP Logging Database
        #$get_rates = $wpdb->get_results("SELECT rating_rating FROM $wpdb->ratings WHERE rating_postid = $post_id");
        //echo "Nr: ".sizeof($get_rates);
        $rating1 = 0;
        $rating2 = 0;
        $rating3 = 0;
        $rating4 = 0;
        $rating5 = 0;
        $rating_total = 0;
        #foreach($get_rates as $get_rate){
        #        $rating_total++;
        #
        #        if ($get_rate->rating_rating == 1 ) $rating1++;
        #        if ($get_rate->rating_rating == 2 ) $rating2++;
        #        if ($get_rate->rating_rating == 3 ) $rating3++;
        #        if ($get_rate->rating_rating == 4 ) $rating4++;
        #        if ($get_rate->rating_rating == 5 ) $rating5++;
        #
        #}
        if ($lang != "de") {
            $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_com = {$post_id}");
        }
        if ($lang == "de") {
            $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_de = {$post_id}");
        }
        #var_dump($ratings);
        $rating1 = $ratings[0]->post_ratings_1_com + $ratings[0]->post_ratings_1_de;
        $rating2 = $ratings[0]->post_ratings_2_com + $ratings[0]->post_ratings_2_de;
        $rating3 = $ratings[0]->post_ratings_3_com + $ratings[0]->post_ratings_3_de;
        $rating4 = $ratings[0]->post_ratings_4_com + $ratings[0]->post_ratings_4_de;
        $rating5 = $ratings[0]->post_ratings_5_com + $ratings[0]->post_ratings_5_de;
        $rating_total = $ratings[0]->post_ratings_users_com + $ratings[0]->post_ratings_users_de;
        #$rating1 + $rating2 + $rating3 + $rating4 + $rating5;
        //echo "<table cellspacing=0 cellpadding=0 border=1>
        //        <tr>
        //        <td width=90%>";
        //echo "</td></tr></table> ";
        global $vspacer;
        $vspacer = '<div class="spacer" style="border-top: 1px solid #2b8fc3; height: 0px; margin-top: 9px; margin-bottom: 9px;"></div>';
        // ---- Overview - cheapest supplier
        // get cheapest supplier
        $cheapest_supplier_id = lhg_db_get_cheapest_supplier_id($post->ID);
        #echo "CID: $cheapest_supplier_id <br>";
        if ($cheapest_supplier_id != "") {
            lhg_show_supplier_square($cheapest_supplier_id, $post->ID);
        }
        if ($cheapest_supplier_id == "") {
            lhg_show_supplier_square_default($post->ID);
        }
        //get price & url from DB
        $region = get_region();
        #        $meta="price-amazon.".$region;
        #        $aprice = get_post_meta($post->ID,$meta,true);
        #        $meta="url-amazon.".$region;
        #        $aurl=get_post_meta($post->ID,$meta,true); //amaz_url($post->ID);
        //still undefined?
        #	if ($aurl == ""){
        #	  $aid=get_id();
        #          $aurl = 'http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid;
        #        }
        /*
        if ( ($region == "de") or ($region == "fr") or ($region == "it") or ($region == "es")) {
                $aprice=str_replace(".","",$aprice);
        }else{
        	        $aprice=str_replace(",","",$aprice);
        	        //$aprice=str_replace(",",".",$aprice);
        }
        */
        //echo "AP0: $aprice";
        #        $aprice = lhg_amazon_price_to_float ( $aprice , $region );
        //echo "AP1: $aprice";
        //
        // affilinet prices
        //
        if ($lang == "de debug") {
            //echo "A";
            $meta = "affilinet_PID";
            $aff_PID = get_post_meta($post->ID, $meta, true);
            //amaz_url($post->ID);
            if ($aff_PID == "") {
                //check for wrong entered PID
                $meta = "PID_affilinet";
                $aff_PID = get_post_meta($post->ID, $meta, true);
                //amaz_url($post->ID);
                //echo "affPID: $aff_PID";
            }
            if ($aff_PID != "") {
                // check for multiple PIDs
                $PIDlist = str_getcsv($aff_PID, ";");
                $num = count($PIDlist);
                //echo "Num: $num <br>PIDlist0: $PIDlist[0]<br>";
                //echo "PIDlist1: $PIDlist[1]<br>";
                if ($num == 1) {
                    list($aff_date, $aff_shop_id, $aff_price, $aff_shipping, $aff_url) = get_price_aff($aff_PID);
                    $cheapestURL = str_replace("+++++", ";", $aff_url);
                    //echo "Cheap: $cheapestURL<br>";
                    $tprice = $aff_price + $aff_shipping;
                    //echo "TP: $tprice <br>";
                    if ($aff_shop_id == 1739) {
                        $pcount++;
                        $pricetable[$pcount] = $tprice . '###  EUR ' . str_replace(".", ",", number_format($tprice, 2)) . ' &gt;  <a href="' . $aff_url . '" rel="nofollow">Redcoon.de</a>';
                        $pricetable_data[$pcount] = $tprice . '###' . str_replace(".", ",", number_format($tprice, 2)) . '###' . $aff_url . '###Redcoon.de' . '###' . str_replace(".", ",", number_format($aff_shipping, 2));
                    }
                    if ($aff_shop_id == 1752) {
                        $pcount++;
                        $pricetable[$pcount] = $tprice . '###  EUR ' . str_replace(".", ",", number_format($tprice, 2)) . ' &gt;  <a href="' . $aff_url . '" rel="nofollow">Reichelt.de</a>';
                        $pricetable_data[$pcount] = $tprice . '###' . str_replace(".", ",", number_format($tprice, 2)) . '###' . $aff_url . '###Reichelt.de' . '###' . str_replace(".", ",", number_format($aff_shipping, 2));
                    }
                }
                if ($num > 1) {
                    //cycle through IDs
                    //$ProductIDList = str_getcsv($ProductID,";");
                    //echo "multiple ids<br>";
                    list($aff_date, $aff_shop_id, $aff_price, $aff_shipping, $aff_url) = get_price_aff($aff_PID, $num);
                    //echo "ShopID: $aff_shop_id";
                    $ShopIDList = str_getcsv($aff_shop_id, ";");
                    $PriceList = str_getcsv($aff_price, ";");
                    $ShippingList = str_getcsv($aff_shipping, ";");
                    $URLList = str_getcsv($aff_url, ";");
                    $tpriceListCheapest = 9999999999;
                    for ($i = 0; $i < $num; $i++) {
                        $tpriceList[$i] = $PriceList[$i] + $ShippingList[$i];
                        //url of cheapest partner
                        if ($tpriceList[$i] < $tpriceListCheapest) {
                            $tpriceListCheapest = $tpriceList[$i];
                            $cheapestURL = str_replace("+++++", ";", $URLList[$i]);
                            //echo "Cheap: $cheapestURL<br>";
                        }
                        if ($ShopIDList[$i] == 1739) {
                            $pcount++;
                            $pricetable[$pcount] = $tpriceList[$i] . '###  EUR ' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . ' &gt;  <a href="' . $URLList[$i] . '" rel="nofollow">Redcoon.de</a>';
                            $pricetable_data[$pcount] = $tpriceList[$i] . '###' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . '###' . $URLList[$i] . '###Redcoon.de' . '###' . str_replace(".", ",", number_format($ShippingList[$i], 2));
                        }
                        if ($ShopIDList[$i] == 1752) {
                            $pcount++;
                            $pricetable[$pcount] = $tpriceList[$i] . '###  EUR ' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . ' &gt;  <a href="' . $URLList[$i] . '" rel="nofollow">Reichelt.de</a>';
                            $pricetable_data[$pcount] = $tpriceList[$i] . '###' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . '###' . $URLList[$i] . '###Reichelt.de' . '###' . str_replace(".", ",", number_format($ShippingList[$i], 2));
                        }
                    }
                }
            }
            //echo "ID: $aff_shop_id <br>Price: $aff_price + $aff_shipping";
        }
        //$nbprice=str_replace(",",".",NB_price($post->ID));
        //$nburl=NB_url($post->ID);
        //$region=get_region();
        //$aid=get_id();
        //print $aprice;
        //print "AURL: $aurl<br>";
        //if ($aurl == "") $aurl="http://www.amazon.$region/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag=$aid";
        //default: Euro
        //print "2: ".number_format($aprice,2);
        //$pricestring = number_format( str_replace("EUR","",str_replace(",",".",$aprice)),2,',','.');
        //pure price without currency
        //$pureprice   = str_replace("EUR","",$aprice);
        //$pureprice   = str_replace("CND","",$aprice);
        //$pureprice   = str_replace("$","",$aprice);
        #        $pricestring = $aprice;
        #
        #        if ( ($region == "de") or
        #             ($region == "es") or
        #             ($region == "fr") or
        #             ($region == "it") ){
        #		//$pricetable[0] =  str_replace(",",".",$pricestring).'###  EUR <span itemprop="price">'.$pricestring.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #		//$pricetable[0] =  str_replace(",",".",$pricestring).'###  EUR <span itemprop="price">'.$pricestring.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #		$pricetable_data[0] =  $pricestring.'###'.$pricestring.'###'.$aurl.'###Amazon.'.$region;
        #        }
        //float price to string
        #        $aprice_str = lhg_float_to_currency_string( $aprice , $region );
        #        $cs = lhg_get_currency_symbol( $region );
        //echo "REG: $region";
        /*
        if ($region == "com") $pricetable[0] =    '  $ <span itemprop="price">'.str_replace(".",".",number_format(str_replace("$","",$aprice),2)).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "in")  $pricetable[0] = '  '.str_replace("INR",'&#8377; <span itemprop="price">',$aprice).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "ca")  $pricetable[0] = '  CDN$ <span itemprop="price">'.str_replace(".",".",number_format(str_replace("CDN\$","",$aprice),2)).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "co.uk")  $pricetable[0] = '  '.$cs.' <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "co.jp")  $pricetable[0] = '  &yen; <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        */
        #        $pricetable[0] = '  '.$cs.' <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        //echo "PT: $pricetable[0]";
        //print "APrice: $aprice<br>";
        #        if ($aprice=='out of stock')
        #                $pricetable[0] = '  '.$txt_not_avail.' &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        //print "AP: >$aprice< <br>";
        #        if ( (strpos($aprice,'nicht vorr') !== false) or (strpos($aprice,'nicht liefer') !== false) or ($aprice=="") )
        #                $pricetable[0] = '  '.$txt_not_avail.' &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #        if ($lang == "de"){
        #          if ($nbprice != ""){
        #                $pcount++;
        #        	$pricetable[$pcount] = '  EUR <span itemprop="price">'.str_replace(".",",",number_format(str_replace("EUR","",$nbprice),2)).'</span> &gt;  <a href="'.$nburl.'" rel="nofollow">Notebooksbilliger.de</a>';
        #          }
        #          //sort($pricetable);
        #          array_multisort( $pricetable , SORT_NUMERIC, $pricetable_data );
        #	}
        //echo "PT0 ".$pricetable[0];
        //echo "POS: ".strpos($pricetable[0],"###");
        //get rid of sorting string, works only for "de"
        #        if ( strpos($pricetable[0],"###") >0 )
        #       foreach ($pricetable as &$value) {
        #           list( $null, $value) = explode("###",$value);
        #       }
        //echo "PT0 ".$pricetable[0];
        //echo "<br>PT1 ".$pricetable[1];
        //echo "PR: $aprice";
        // echo "\n".'<div itemscope itemtype="http://data-vocabulary.org/Product">';
        // echo "\n".'<span itemprop="category" content="Hardware" ></span>';
        // echo "\n".'<span itemprop="name" content="'.translate_title(get_the_title()).'" ></span>';
        //echo "PC: $pcount";
        #        if ($pcount > 0)
        #	        echo "\n".'<div style="text-align: center;"><b>'.$txt_cheapest_supplier.':</b></div>';
        //echo "aprice: $aprice<br>";
        //echo "PC: ",$pcount;
        #        if ($pcount == 0)
        #                if ($aprice!='out of stock')
        #                        	echo "\n".'<div style="text-align: center;"><b>'.$txt_supplier.'</b></div>';
        #        echo "\n".'<div class="rating" style="border: 0px solid #222; width: 70%; text-align: center; margin: 0 auto;">';
        #        echo $cheap_txt;
        /* single offer. to be changed for group of offers! */
        //echo "\n".'<span itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">';
        #        $price_meta = "USD";
        #        if ($region == "de") $price_meta = "EUR";
        #        if ($region == "it") $price_meta = "EUR";
        #        if ($region == "fr") $price_meta = "EUR";
        #        if ($region == "es") $price_meta = "EUR";
        #        if ($region == "com") $price_meta = "USD";
        #        if ($region == "co.uk") $price_meta = "GBP";
        #        if ($region == "co.jp") $price_meta = "JPY";
        #        if ($region == "cn") $price_meta = "CNY";
        #        if ($region == "ca") $price_meta = "CAD";
        #        if ($region == "in") $price_meta = "INR";
        #
        #        echo "\n".'<meta itemprop="currency" content="'.$price_meta.'" />';
        //echo '<meta itemprop="price" content="'.str_replace(".",",",number_format(str_replace("EUR","",$nbprice),2)).'" />';
        //echo "Amazon.$region";
        //echo "PT: $pricetable[0]";
        #        if ( (strpos($pricetable[0],"Amazon.$region")) or ($pricetable[0] == "") ){
        #                //if ($aprice!='out of stock')
        #                echo "\n".'<div class="amazonbutton"><a href="'.$aurl.'" rel="nofollow"><img src="/wp-uploads/2012/10/Amazon_Logo1.png" border=0 width=125 height=125 alt="'.$txt_button_string.': '.$short_title.'" title="'.$txt_button_string.': '.$short_title.'"></a></div>';
        #        }elseif (strpos($pricetable[0],"Notebooksbilliger.de")){
        #        	echo "\n".'<div class="amazonbutton"><a href="'.$nburl.'" rel="nofollow"><img src="wp-uploads/2012/10/Logo_125-x-125_5_H.gif" border=0></a></div>';
        #        }elseif (strpos($pricetable[0],"Redcoon.de")){
        #        	echo "\n".'<div class="amazonbutton" style="border: 1px solid #2B8FC3; width: 140px; margin: 0 auto;"><a href="'.$cheapestURL.'" rel="nofollow"><img src="/wp-uploads/2014/03/redcoon-logo-125x125.jpg" border=0 width=140 height=140></a></div>';
        #        }elseif (strpos($pricetable[0],"Reichelt.de")){
        #        	echo "\n".'<div class="amazonbutton" style="border: 1px solid #2B8FC3; width: 140px; margin: 0 auto;"><a href="'.$cheapestURL.'" rel="nofollow"><img src="/wp-uploads/2014/03/reichelt_logo_125x125.gif" border=0 width=140 height=140></a></div>';
        #        }
        #
        #        $pricetable[0] = str_replace("+++++",";",$pricetable[0]);
        #        echo str_replace(" &gt; ", "<br>",$pricetable[0]);
        #        echo "\n"."</div>";
        #        if ($pcount == 0){
        #	        //echo "<b>Preis:</b>";
        #	}else{
        #	        //echo "<b>Amazon-Preis:</b><br>";
        #                //echo ' '.$aprice.' &gt; <a href="'.$aurl.'">Amazon.de</a>';
        #                echo $vspacer;
        #	        echo "<b>&Uuml;bersicht der Anbieter:</b>";
        #
        #	}
        //echo "<br>PT1 ".$pricetable[1];
        #	if ($pcount == 0){
        #		//echo $line;
        #	}else{
        #                echo "<br>
        #                <table>";
        #                //<tr><td><b>Preis</b></td><td><b>Anbieter</b></td><td></td></tr>
        #                //";
        #        	$i=0;
        #        	foreach($pricetable as $line){
        #                        list ($price1, $price2, $url , $shop, $shipping) = explode("###",$pricetable_data[$i]);
        #
        #                        //echo "$price2 .. $url .. $shop";
        #
        #		        if (strpos($pricetable[$i],"Redcoon.de")){
        #			      echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">inkl. Porto: '.$shipping.' EUR</div></td><td valign="middle"><a href="'.$url.'" rel="nofollow"><img src="wp-uploads/2014/03/redcoon-logo-110x033.jpg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Redcoon.de</a></td></tr>';
        #
        #	    		}elseif (strpos($pricetable[$i],"Amazon.de")){
        #			      echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">exkl. Porto</div></td><td valign="middle"><a href="'.$url.'" rel="nofollow"><img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Amazon.de</a></td></tr>';
        #			      //echo '<img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg">'.$pricetable[$i]."<br>";
        #  	    		}elseif (strpos($pricetable[$i],"Reichelt.de")){
        #                              $url = str_replace("+++++",";",$url);
        #                              echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">inkl. Porto: '.$shipping.' EUR</div></td><td valign="middle"><a href="'.$cheapestURL.'" rel="nofollow"><img src="wp-uploads/2014/03/reichelt_logo_110x33.jpeg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Reichelt.de</a></td></tr>';
        #			      //echo '<img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg">'.$pricetable[$i]."<br>";
        #	    		}
        #                        else{
        #			      echo $pricetable[$i]."<br>";
        #                        }
        #
        #	              //if ($i == 0) echo '<div class="priceline" style="border: 0px solid #000; "><div class="pricetop" style="border: 1px solid #2b8fc3; background-color: #eee; margin: 3px 3px;">'.$line.'</div></div>';
        #	              //if ($i > 0)  echo '<div class="priceline" style="border: 0px solid #000; "><div class="price" style="border: 0px solid #333; background-color: #fff; margin: 3px 3px;">'.$line.'</div></div>';
        #  	              $i++;
        #    		}
        #                echo"</table>";
        #	}
        // echo get_affiliate_prices($post->ID);
        //
        // ---- New Supplier Overview
        //
        #if ($lang == "de")
        lhg_supplier_comparison($post->ID);
        //
        // ---- Rating Overview ==============================================================
        //
        global $txt_opw_num_ratings;
        //    = "Number of ratings";
        global $txt_opw_average_rating;
        // = "Average ratings";
        global $txt_opw_rating_overview;
        global $txt_out_of;
        global $txt_opw_hardware;
        global $txt_average;
        global $no_supplier_square;
        #$rating_avg = get_post_meta($post->ID,'ratings_average',true);
        $num_rates = $ratings[0]->post_ratings_users_com + $ratings[0]->post_ratings_users_de;
        if ($num_rates == 0) {
            $rating_avg = 0;
        }
        if ($num_rates != 0) {
            $rating_avg = ($ratings[0]->post_ratings_score_com + $ratings[0]->post_ratings_score_de) / $num_rates;
        }
        if ($no_supplier_square != 1) {
            echo $vspacer;
        }
        #echo '<div itemscope itemtype="http://schema.org/Product">';
        #echo '<div itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
        #echo '<div property="itemReviewed" typeof="Product">';
        #echo '  <div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">';
        //echo '<div class="rating" style="border: 0px solid #222; width: 90%; margin: 0 auto;">';
        echo '

        <table class="ratingtable" border="0">
           <tr>
             <td><b>' . $txt_opw_hardware . ':</b></td>
             <td><span itemprop="name">' . $short_title . '</span></td>
           </tr>


           <tr>
             <td>
             ';
        //if ($rating_total>1) echo "<b>$txt_wpone_num_ratings:</b></td><td> <b>".'<span itemprop="votes">'."$rating_total</span></b><br>";
        //if ($rating_total<2)
        echo "       <b>{$txt_opw_num_ratings}:</b>\n             </td>\n\n\n\n             <td>\n                {$rating_total} <br />\n             </td>\n           </tr>\n\n\n           <tr>\n              <td><b>{$txt_opw_average_rating}: </b></td>\n\n              <td>";
        echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
        echo the_ratings_results($post->ID, 0, 0, 0, 10) . '
                            (<span itemprop="ratingValue">' . round($rating_avg, 1) . '</span> ' . $txt_out_of . '
                             <span itemprop="bestRating">5</span>)

                            <span itemprop="ratingCount" content="' . $rating_total . '" />
                            <span itemprop="worstRating" content="0" />
                        </span>

              </td>
           </tr>


           ';
        echo '
           <tr>
              <td class="td-ratingoverview">' . "<b>{$txt_opw_rating_overview}:</b></td>\n\n              <td>";
        if ($rating_total == 0) {
            $ra5 = 0;
            $ra4 = 0;
            $ra3 = 0;
            $ra2 = 0;
            $ra1 = 0;
        } else {
            $ra5 = 100 * $rating5 / $rating_total;
            $ra4 = 100 * $rating4 / $rating_total;
            $ra3 = 100 * $rating3 / $rating_total;
            $ra2 = 100 * $rating2 / $rating_total;
            $ra1 = 100 * $rating1 / $rating_total;
        }
        echo '

        <div class="rateline" style="border: 0px solid #000;">
           <div style="float: left;">5:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra5 . '%;" ></div>
           </div> &nbsp;(' . $rating5 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">4:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra4 . '%;" ></div>
           </div> &nbsp;(' . $rating4 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">3:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra3 . '%;" ></div>
           </div> &nbsp;(' . $rating3 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">2:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
              <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra2 . '%;" ></div>
           </div> &nbsp;(' . $rating2 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">1:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
              <div class="box" style="border: 0px solid #2b8fc3; background-color: #2b8fc3; height: 8px; width: ' . $ra1 . '%;" ></div>
           </div> &nbsp;(' . $rating1 . ')
        </div>';
        #        echo '
        #     </div>';
        echo '      <a href="#comments">' . $txt_rate_yourself . '</a>';
        //echo "</td></tr><tr><td></td><td>";
        echo "\n                </td>\n              </tr>\n\n          </table>\n\n          ";
        #echo '</div>'; // itemreviewed
        # echo "  </div>"; //Rating
        #echo '</div>'; //Review-aggregate
        //echo $vspacer;
        //
        // -------- Subscriber =============================================================
        //
        //if ($lang == "de"){
        echo $vspacer;
        print "<b>" . '<i class="icon-user icon-add-hw-user"></i><i class="icon-plus icon-add-hw-plus"></i>' . "{$txt_wpop_register}</b><br />";
        print "{$txt_register_long}";
        if (is_user_logged_in()) {
            $current_user = wp_get_current_user();
            print '<form action="/hardware-profile?srp=' . $post->ID . '&#038;sra=s" method="post" onsubmit="if(this.sre.value==\'\' || this.sre.indexOf(\'@\')==0) return false">
  	                 <fieldset style="border:0">
  	                 <input type="hidden" class="subscribe-form-field" name="sre" value="' . $current_user->user_email . '" size="18">
  	                 <button type="submit" value="' . $txt_send . '" >' . $txt_send . '&nbsp;<i class="icon-arrow-right icon-button"></i></button>
  	                 </fieldset>
  	                 </form>';
        } else {
            print '<form action="/hardware-profile?srp=' . $post->ID . '&#038;sra=s" method="post" onsubmit="if(this.sre.value==\'\' || this.sre.indexOf(\'@\')==0) return false">
  	                 <fieldset style="border:0">
  	                 <input type="text" class="subscribe-form-field" name="sre" value="email" size="18" onfocus="if(this.value==this.defaultValue)this.value=\'\'" onblur="if(this.value==\'\')this.value=this.defaultValue"/>
  	                 <button type="submit" value="' . $txt_send . '" >' . $txt_send . '&nbsp;<i class="icon-arrow-right icon-button"></i></button>
  	                 </fieldset>
  	                 </form>';
        }
        $usernum = 0;
        //get number of registered users
        global $txt_opw_registered;
        global $wpdb;
        global $txt_not_avail;
        $usernum = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key LIKE '\\_stcr@\\_%' AND post_id = " . $post->ID);
        if ($usernum > 0) {
            print "(" . $txt_opw_registered . ": " . $usernum . ")";
        }
        //print do_shortcode('<a href="/manage-subscriptions">'.$txt_manage_subscr."</a>");
        //}
        //
        // ----------- Language Selector ============================================
        //
        #$selected    ='<div class="pricetop" style="border: 1px solid #2b8fc3; background-color: #eee; margin: 3px 3px 3px 3px; padding-top: 3px;">';
        #$selectedEnd ='</div>';
        # Debug:
        #lhg_store_comment_numbers_by_post_id( $post_id );
        echo $vspacer;
        echo "<b>{$txt_select}:</b><br />";
        //echo "PL:".get_permalink();
        //echo "<br>QPL:".qtrans_convertURL(get_permalink());
        list($null1, $null2, $null3, $posturl) = explode("/", get_permalink());
        list($null1, $null2, $null3, $null4, $posturl2) = explode("/", get_permalink());
        //echo "pu:".$posturl ."<br>";
        //echo "pu2".$posturl2."<br>";
        if ($posturl2 != "") {
            $posturl = $posturl2;
        }
        //we are in a qtranslate subfolder!
        $posturlde = $posturl;
        $posturlcom = $posturl;
        if (!is_search() and !($postID == "1821") and !is_archive()) {
            $comURL = get_post_meta($post->ID, 'COM_URL', true);
            $deURL = get_post_meta($post->ID, 'DE_URL', true);
            if ($comURL != "") {
                $posturlcom = $comURL;
            }
            if ($deURL != "") {
                $posturlde = $deURL;
            }
            if (substr($comURL, 0, 1) == "/") {
                $comURL = substr($comURL, 1);
            }
            if (substr($deURL, 0, 1) == "/") {
                $deURL = substr($deURL, 1);
            }
            //echo "LANG: $lang, PID: $postID, ";
            //translation still missing -> redirect to main page
            if ($comURL == "" and $post->ID > 2599 and $lang == "de") {
                $posturlcom = "";
            }
            if ($deURL == "" and $post->ID > 2599 and $lang == "en") {
                $posturlde = "";
            }
            # on de server get com link from priceDB
            if ($lang == "de") {
                $com = lhg_get_com_post_URL($postID);
                $comURL == $com;
            }
        }
        //remove language selection for .de
        $posturlde = str_replace("?lang=jp", "", $posturlde);
        $posturlde = str_replace("?lang=it", "", $posturlde);
        $posturlde = str_replace("?lang=es", "", $posturlde);
        $posturlde = str_replace("?lang=uk", "", $posturlde);
        $posturlde = str_replace("?lang=ca", "", $posturlde);
        $posturlde = str_replace("?lang=in", "", $posturlde);
        $posturlde = str_replace("?lang=fr", "", $posturlde);
        $posturlde = str_replace("?lang=cn", "", $posturlde);
        $posturlde = str_replace("?lang=en", "", $posturlde);
        $posturlcom = str_replace("?lang=jp", "", $posturlcom);
        $posturlcom = str_replace("?lang=it", "", $posturlcom);
        $posturlcom = str_replace("?lang=es", "", $posturlcom);
        $posturlcom = str_replace("?lang=uk", "", $posturlcom);
        $posturlcom = str_replace("?lang=ca", "", $posturlcom);
        $posturlcom = str_replace("?lang=in", "", $posturlcom);
        $posturlcom = str_replace("?lang=fr", "", $posturlcom);
        $posturlcom = str_replace("?lang=cn", "", $posturlcom);
        $posturlcom = str_replace("?lang=en", "", $posturlcom);
        if ($lang == "de") {
            $URLC = "http://www.linux-hardware-guide.com";
            $URLD = "";
        }
        if ($lang != "de") {
            $URLC = "";
            $URLD = "http://www.linux-hardware-guide.de";
        }
        //$URLC="http://192.168.3.113"; //Debug
        if (1 == 1) {
            echo '<div class="countrytable"><table border="0">
        	<tr class="countrytable_header">
                  <td class="cth_country">Country</td>
                  <td class="cth_price">Price</td>
                  <td class="cth_currency"></td>
                  <td class="cth_comment">Comments</td>
                </tr>';
            print lhg_country_row("de", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("com", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("ca", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("co.uk", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("fr", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("es", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("it", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("nl", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("in", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("co.jp", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("cn", $URLC, $URLD, $posturlcom, $posturlde);
            echo "</table></div>";
        } else {
            //if ($region == "de") print $selected;
            //echo '&nbsp;&nbsp;<a href="'.$URLD.'/'.$posturlde.'"><img src="/wp-content/plugins/qtranslate/flags/de.png" alt="Germany" /> Germany (&euro;)</a><br />';
            //if ($region == "de") print $selectedEnd;
            if ($region == "de") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/us.png" alt="USA" /> USA (&euro;)</a><br />';
            if ($region == "de") {
                print $selectedEnd;
            }
            if ($region == "ca") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/ca/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/ca.png" alt="Canada" /> Canada (CDN $)</a><br />';
            if ($region == "ca") {
                print $selectedEnd;
            }
            if ($region == "co.uk") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/uk/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/uk.png" alt="UK" /> United Kingdom (&pound;)</a><br />';
            if ($region == "co.uk") {
                print $selectedEnd;
            }
            if ($region == "fr") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/fr/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/fr.png" alt="France" /> France (&euro;)</a><br />';
            if ($region == "fr") {
                print $selectedEnd;
            }
            if ($region == "es") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/es/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/es.png" alt="Espana" /> Espana (&euro;)</a><br />';
            if ($region == "es") {
                print $selectedEnd;
            }
            if ($region == "it") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/it/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/it.png" alt="Italia" /> Italia (&euro;)</a><br />';
            if ($region == "it") {
                print $selectedEnd;
            }
            if ($region == "nl") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/nl/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/nl.png" alt="Netherlands" /> Netherlands (&euro;)</a><br />';
            if ($region == "nl") {
                print $selectedEnd;
            }
            if ($region == "in") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/in/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/in.png" alt="India" /> India (&#8377;)</a><br />';
            if ($region == "in") {
                print $selectedEnd;
            }
            if ($region == "co.jp") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/ja/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/jp.png" alt="Japan" /> Japan (&yen;)</a><br />';
            if ($region == "co.jp") {
                print $selectedEnd;
            }
            if ($region == "cn") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/zh/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/cn.png" alt="China" /> China (RMB)</a><br />';
            if ($region == "cn") {
                print $selectedEnd;
            }
        }
        //
        // Tag List Start
        //
        echo $vspacer;
        echo "\n\n" . "  <b>{$txt_sim_tags}:</b>\n  <br />";
        echo "\n" . '  <div style="margin-left: 18px;">';
        echo "\n\n" . '    <form method="get" action="/tagsearch/" class="combine_tags">' . "\n";
        foreach (get_the_category() as $category) {
            $counter++;
            $CID = $category->cat_ID;
            break;
            //stop at main category!
        }
        $args = array('category' => $CID);
        $catposts = get_posts($args);
        foreach ($catposts as $post) {
            setup_postdata($post);
            $posttags = get_the_tags(get_the_ID());
            if (is_array($posttags)) {
                foreach ($posttags as $tag) {
                    if ($tag->count > 1) {
                        // combination not useful in case of one result
                        if ($tag->term_id != 981) {
                            $count++;
                            $tagstrings[$count] = $tag->term_id . '; <a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> (' . $tag->count . ')<br /> ';
                            if ($count > 15) {
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (is_array($tagstrings)) {
            $unique_tagstrings = array_unique($tagstrings);
        }
        if (is_array($unique_tagstrings)) {
            sort($unique_tagstrings);
        }
        $countU = 0;
        if (is_array($unique_tagstrings)) {
            foreach ($unique_tagstrings as $tagstring) {
                $part = explode(";", $tagstring);
                $out .= "\n" . '      <input type="checkbox" name="tagid[' . $countU . ']" value="' . $part[0] . '" />' . $part[1];
                $countU++;
            }
        }
        echo $out;
        //
        // Tag List End
        //
        echo $content_widget;
        echo "\n" . '
      <div class="tagbutton">
        <button type="submit" value="' . $txt_combine_tags . '" >' . $txt_combine_tags . '&nbsp;
          <i class="icon-arrow-right icon-button"></i>
        </button>
      </div>

    </form>';
        echo "\n" . "\n  </div>\n  ";
        echo "\n" . "</div>";
        echo $after_widget;
        //close the blue widget
    }
}