<?php

add_filter( 'https_ssl_verify', '__return_false' );

if( !function_exists('blanka_get_gold') ){
  function blanka_get_gold() {
    // $cache_key = 'gold_value';

    // $_gold_value = wp_cache_get( $cache_key );

    // if ($_gold_value) return $_gold_value;

    // // * API *
    // $eu_URL = 'https://www.quandl.com/api/v3/datasets/LBMA/GOLD?start_date=2018-01-01&api_key=pQfBkQqWswwxpLzGHyhq';
    // // $url = 'https://www.quandl.com/api/v3/datasets/WGC/GOLD_DAILY_USD.json?api_key=pQfBkQqWswwxpLzGHyhq&start_date=2018-01-01';
    // $url = get_template_directory_uri().'/gold_eu.json';
    // // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    // $response = wp_remote_post($eu_URL, array(
    //   'method' => 'GET',
    //   // 'sslverify' => false,
    // ));
    // // * Content *
    // $dataset = json_decode($response['body'], true);
    // $lastUpdate = $dataset['dataset']['data'][0];
    // $price_oz = $lastUpdate[6];
    // $grams_k = 31.1035;
    // $price_g = (float)$price_oz / $grams_k;

    // $_gold_value = round($price_g, 2);

    // wp_cache_set( $cache_key, $_gold_value, '', 180 );

    return false;
  }
}

if( !function_exists('get_lingotto_price') ){
  // function get_lingotto_price($starting_price, $weight) {
  //   $gold_live_pricing = blanka_get_gold();
  //   $final_price = ($gold_live_pricing  + (($gold_live_pricing  * $starting_price) / 100)) * $weight;
  //   $final_price = number_format($final_price, 2, ',','.');
  //   return $final_price;
  // }

  return false;
}
