Skip to content

Commit

Permalink
Version 2.1.6
Browse files Browse the repository at this point in the history
Added support currencyconverterapi.com keys
  • Loading branch information
cryptoapi committed Feb 20, 2019
1 parent 420bafd commit 692f698
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
12 changes: 10 additions & 2 deletions history.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
===============================================================================
== Version 2.1.5 (November 2018)
== Version 2.1.6 (February 2019)
===============================================================================

- Added support currencyconverterapi.com keys



===============================================================================
== Version 2.1.5 (November 2018)
===============================================================================

- Added Bitcoin SV (BSV/BCHSV)
Expand Down Expand Up @@ -159,4 +167,4 @@ Instruction - https://gourl.io/bitcoin-payment-gateway-api.html#p8
- Added Dutch Language (Thanks to Erik)

- Several new enhancements


2 changes: 1 addition & 1 deletion js/_source/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @category Javascript
* @website https://gourl.io
* @api https://gourl.io/api.html
* @version 2.1.5
* @version 2.1.6
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion js/_source/cryptobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @category Javascript
* @website https://gourl.io
* @api https://gourl.io/api.html
* @version 2.1.5
* @version 2.1.6
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion js/_source/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @category Javascript
* @website https://gourl.io
* @api https://gourl.io/api.html
* @version 2.1.5
* @version 2.1.6
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/cryptobox.callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @copyright 2014-2019 Delta Consultants
* @category Libraries
* @website https://gourl.io
* @version 2.1.5
* @version 2.1.6
*
*
* This file processes call-backs from Cryptocoin Payment Box server when new payment
Expand Down
31 changes: 20 additions & 11 deletions lib/cryptobox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @example https://gourl.io/lib/examples/example_customize_box.php <----
* @gitHub https://github.com/cryptoapi/Payment-Gateway
* @license Free GPLv2
* @version 2.1.5
* @version 2.1.6
*
*
* CLASS CRYPTOBOX - LIST OF METHODS:
Expand Down Expand Up @@ -79,7 +79,7 @@
elseif (!defined('ABSPATH')) exit; // Wordpress


define("CRYPTOBOX_VERSION", "2.1.5");
define("CRYPTOBOX_VERSION", "2.1.6");

// GoUrl supported crypto currencies
define("CRYPTOBOX_COINS", json_encode(array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit', 'universalcurrency')));
Expand Down Expand Up @@ -1104,7 +1104,7 @@ public function display_cryptobox_bootstrap ($coins = array(), $def_coin = "", $

$tmp .= "<div class='card-body'>";

if ($qrcodeSize) $tmp .= "<div class='".$ext."copy_address'><a href='#a'><img class='".$ext."qrcode_image' style='max-width:100%; height:auto; width:auto\9;' alt='qrcode' data-size='".intval($qrcodeSize)."' src='#'></a></div>";
if ($qrcodeSize) $tmp .= "<div class='".$ext."copy_address'><a href='#a'><img class='".$ext."qrcode_image' style='max-width:".intval($qrcodeSize)."px; height:auto; width:auto\9;' alt='qrcode' data-size='".intval($qrcodeSize)."' src='#'></a></div>";

$tmp .= "<h1 class='mt-3 mb-4 pb-1 card-title ".$ext."copy_amount'><span class='".$ext."amount'>&#160;</span> <small class='text-muted'><span class='".$ext."coinlabel'></span></small></h1>";
$tmp .= "<div class='lead ".$ext."copy_amount ".$ext."texts_send'></div>";
Expand Down Expand Up @@ -1782,9 +1782,10 @@ function get_country_name($countryID, $reverse = false)
*
* Currency Converter using live exchange rates websites
* Example - convert_currency_live("EUR", "USD", 22.37) - convert 22.37euro to usd
convert_currency_live("EUR", "BTC", 22.37) - convert 22.37euro to bitcoin
convert_currency_live("EUR", "BTC", 22.37) - convert 22.37euro to bitcoin
optional - currencyconverterapi_key you can get on https://free.currencyconverterapi.com/free-api-key
*/
function convert_currency_live($from_Currency, $to_Currency, $amount)
function convert_currency_live($from_Currency, $to_Currency, $amount, $currencyconverterapi_key = "")
{
static $arr = array();

Expand Down Expand Up @@ -1888,8 +1889,9 @@ function convert_currency_live($from_Currency, $to_Currency, $amount)
// ----------------
if (!$val)
{
$data = json_decode(get_url_contents("https://free.currencyconverterapi.com/api/v6/convert?q=".$key."&compact=y"), TRUE);
if (isset($data[$key]["val"]) && $data[$key]["val"] > 0) $val = $data[$key]["val"];
$data = json_decode(get_url_contents("https://free.currencyconverterapi.com/api/v6/convert?q=".$key."&compact=ultra&apiKey=".$currencyconverterapi_key, 20, TRUE), TRUE);
if (isset($data[$key]) && $data[$key] > 0) $val = $data[$key];
elseif(isset($data["error"])) echo "<h1>Error in function convert_currency_live(...)! ". $data["error"] . "</h1>";
}


Expand Down Expand Up @@ -1917,7 +1919,7 @@ function convert_currency_live($from_Currency, $to_Currency, $amount)

/* I. Get URL Data
*/
function get_url_contents( $url, $timeout = 20 )
function get_url_contents( $url, $timeout = 20, $ignore_httpcode = false )
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
Expand All @@ -1931,7 +1933,7 @@ function get_url_contents( $url, $timeout = 20 )
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

return ($httpcode>=200 && $httpcode<300) ? $data : false;
return (($httpcode>=200 && $httpcode<300) || $ignore_httpcode) ? $data : false;
}


Expand Down Expand Up @@ -2007,11 +2009,18 @@ function run_sql($sql)
}
}
$mysqli = @mysqli_connect($dbhost, DB_USER, DB_PASSWORD, DB_NAME, $port, $socket);
$err = (mysqli_connect_errno()) ? mysqli_connect_error() : "";
if ($err)
{
// try SSL connection
$mysqli = mysqli_init();
$mysqli->real_connect ($dbhost, DB_USER, DB_PASSWORD, DB_NAME, $port, $socket, MYSQLI_CLIENT_SSL);
}
if (mysqli_connect_errno())
{
echo "<br /><b>Error. Can't connect to your MySQL server.</b> You need to have PHP 5.2+ and MySQL 5.5+ with mysqli extension activated. <a href='http://crybit.com/how-to-enable-mysqli-extension-on-web-server/'>Instruction &#187;</a>\n";
if (!CRYPTOBOX_WORDPRESS) echo "<br />Also <b>please check DB username/password in file cryptobox.config.php</b>\n";
die("<br />Server has returned error - <b>".mysqli_connect_error()."</b>");
die("<br />Server has returned error - <b>".$err."</b>");
}
$mysqli->query("SET NAMES utf8");
}
Expand Down Expand Up @@ -2274,6 +2283,6 @@ function run_sql($sql)
foreach ($cryptobox_private_keys as $v)
if (strpos($v, " ") !== false || strpos($v, "PRV") === false || strpos($v, "AA") === false || strpos($v, "77") === false) die("Invalid Private Key - ". (CRYPTOBOX_WORDPRESS ? "please setup it on your plugin settings page" : "$v in variable \$cryptobox_private_keys, file cryptobox.config.php."));

unset($v); unset($cryptobox_private_keys);
unset($v); unset($cryptobox_private_keys);
}
?>
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GoUrl.io Cryptocoin Payment Gateway API
-----------------------------------------

Version 2.1.5
Version 2.1.6

**Accept Bitcoin, Bitcoin Cash, Bitcoin SV, Litecoin, Dash, Dogecoin, Speedcoin, Reddcoin, Potcoin, Feathercoin, Vertcoin, Peercoin, UniversalCurrency, MonetaryUnit Payments Online on your website**

Expand Down

0 comments on commit 692f698

Please sign in to comment.