Skip to content

Commit

Permalink
Version 1.5.1
Browse files Browse the repository at this point in the history
Update currencyconverterapi.com api to v7
  • Loading branch information
cryptoapi committed Mar 7, 2020
1 parent 7c74962 commit 4e90514
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 28 deletions.
53 changes: 35 additions & 18 deletions gourl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1000,15 +1000,19 @@ private function check_settings()
if ($this->record_errors) $this->errors = array_merge($this->errors, $this->record_errors);
}


// test currencyconverterapi.com api key
if ($this->options["currencyconverterapi_key"] && $this->options["currencyconverterapi_key"] != get_option(GOURL.'currencyconverterapi_key'))
{
$val = json_decode(gourl_get_url("https://free.currencyconverterapi.com/api/v6/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options["currencyconverterapi_key"], 10), TRUE);
$val = json_decode(gourl_get_url("https://free.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options["currencyconverterapi_key"], 10), TRUE);
if ($val <= 0)
{
$val2 = json_decode(gourl_get_url("https://api.currencyconverterapi.com/api/v6/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options["currencyconverterapi_key"], 10), TRUE);
if ($val2 <= 0) $this->errors[] = __('Invalid Currencyconverterapi.com Free/Premium API Key', GOURL);
$val = json_decode(gourl_get_url("https://prepaid.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options["currencyconverterapi_key"], 10), TRUE);
if ($val <= 0)
{
$val = json_decode(gourl_get_url("https://api.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options["currencyconverterapi_key"], 10), TRUE);
if ($val <= 0) $this->errors[] = __('Invalid Currencyconverterapi.com Free/Prepaid/Premium API Key', GOURL);
}
}
}

Expand Down Expand Up @@ -1204,12 +1208,13 @@ public function page_settings()
$tmp .= "<input type='hidden' id='".GOURL."boxlogo_url' name='".GOURL."boxlogo_url' value='".htmlspecialchars($this->options['boxlogo_url'], ENT_QUOTES)."'>";
$tmp .= '<input type="file" accept="image/*" id="'.GOURL.'boxlogo2" name="'.GOURL.'boxlogo2" class="widefat"><br><em>'.__('Optimal size: 200x40px. Allowed images: JPG, GIF, PNG.', GOURL).'</em>';
$tmp .= '</td></tr>';

$tmp .= '<tr><th><br>'.__('Free CurrencyConverterApi.com Key (optional)', GOURL).':</th>';
$txt2 = ($this->options['currencyconverterapi_key']) ? "&#160; and &#160; " . sprintf(__('<a target="_blank" href="%s">Test Your Free API Key Now &#187;</a>', GOURL), "https://free.currencyconverterapi.com/api/v6/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options['currencyconverterapi_key']) : "";
$tmp .= '<td><br><input type="text" id="'.GOURL.'currencyconverterapi_key" name="'.GOURL.'currencyconverterapi_key" value="'.htmlspecialchars($this->options['currencyconverterapi_key'], ENT_QUOTES).'" class="widefat"><br><em>'.sprintf(__('if you accept payments other than USD, place free api key here. <a target="_blank" href="%s">Get free API key on currencyconverterapi.com</a>', GOURL), "https://free.currencyconverterapi.com/free-api-key").$txt2.' &#160; &#160; &#160; ('.__("you can use premium key also but you don't need it", GOURL).')</em><br><br><br></td>';
$txt2 = ($this->options['currencyconverterapi_key']) ? "&#160; and &#160; " . sprintf(__('<a target="_blank" href="%s">Test Your Free API Key Now &#187;</a>', GOURL), "https://free.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options['currencyconverterapi_key']) : "";
$txt3 = ($this->options['currencyconverterapi_key']) ? sprintf(__('Test your prepaid key <a target="_blank" href="%s">here</a> or premium key <a target="_blank" href="%s">here</a>', GOURL), "https://prepaid.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options['currencyconverterapi_key'], "https://api.currconv.com/api/v7/convert?q=AUD_USD&compact=ultra&apiKey=".$this->options['currencyconverterapi_key']) : "";
$tmp .= '<td><br><input type="text" id="'.GOURL.'currencyconverterapi_key" name="'.GOURL.'currencyconverterapi_key" value="'.htmlspecialchars($this->options['currencyconverterapi_key'], ENT_QUOTES).'" class="widefat"><br><em>'. sprintf( __('if you accept payments other than USD, place free api key here.<br><a target="_blank" href="%s">Get free API key on currencyconverterapi.com</a>', GOURL), "https://free.currencyconverterapi.com/free-api-key") .$txt2.' <br> ( '. sprintf( __('you can use <a target="_blank" href="%s">PREPAID</a> / <a target="_blank" href="%s">PREMIUM</a> key also but you don\'t need it.', GOURL), "https://www.currencyconverterapi.com/dev/register-app?plan=prepaid", "https://www.currencyconverterapi.com/dev/register-app?plan=premium" ) .' ' .$txt3.' )</em><br><br><br></td>';
$tmp .= '</tr>';


foreach ($this->coin_names as $k => $v)
{
Expand Down Expand Up @@ -2786,6 +2791,9 @@ private function shortcode_view_init($image = "", $frame = "", $iwidth = "", $ih
global $wpdb, $current_user;
static $html = "-1";

// Marks the current page as noncacheable. https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:api
if ( class_exists( 'LiteSpeed_Cache_API' ) ) LiteSpeed_Cache_API::set_nocache();


if ($html !== "-1") return $html;

Expand Down Expand Up @@ -6524,7 +6532,7 @@ function gourl_retest_dir()
if (!file_exists(GOURL_DIR."files/index.html")) copy($dir."files/index.html", GOURL_DIR."files/index.html");

if (!file_exists(GOURL_DIR."lockimg")) wp_mkdir_p(GOURL_DIR."lockimg");
if (!file_exists(GOURL_DIR."lockimg/index.htm")) copy($dir."lockimg/index.htm", GOURL_DIR."lockimg/index.htm");
if (!file_exists(GOURL_DIR."lockimg/index.html")) copy($dir."lockimg/index.html", GOURL_DIR."lockimg/index.html");
if (!file_exists(GOURL_DIR."lockimg/image1.jpg")) copy($dir."lockimg/image1.jpg", GOURL_DIR."lockimg/image1.jpg");
if (!file_exists(GOURL_DIR."lockimg/image1.png")) copy($dir."lockimg/image1.png", GOURL_DIR."lockimg/image1.png");
if (!file_exists(GOURL_DIR."lockimg/image1b.png")) copy($dir."lockimg/image1b.png", GOURL_DIR."lockimg/image1b.png");
Expand Down Expand Up @@ -8191,20 +8199,29 @@ function gourl_convert_currency($from_Currency, $to_Currency, $amount, $interval
}
}


// d. get rates from https://free.currencyconverterapi.com/api/v6/convert?q=BTC_EUR&compact=ultra&apiKey=sample-api-key
// ----------------

/* d. get rates from
https://free.currconv.com/api/v7/convert?q=BTC_EUR&compact=ultra&apiKey=sample-api-key
https://prepaid.currconv.com/api/v7/convert?q=BTC_EUR&compact=ultra&apiKey=sample-api-key
https://api.currconv.com/api/v7/convert?q=BTC_EUR&compact=ultra&apiKey=sample-api-key
---------------- */
if (!$val)
{
$key2 = $from_Currency.'_'.$to_Currency;
$data = json_decode(gourl_get_url("https://free.currencyconverterapi.com/api/v6/convert?q=".$key2."&compact=ultra&apiKey=".$currencyconverterapi_key, 10, TRUE), TRUE);
$data = json_decode(gourl_get_url("https://free.currconv.com/api/v7/convert?q=".$key2."&compact=ultra&apiKey=".$currencyconverterapi_key, 10, TRUE), TRUE);
if (isset($data[$key2]) && $data[$key2] > 0) $val = $data[$key2];
elseif(isset($data["error"]))
{
$error = $data["error"] . "<br>-> <a style='text-decoration: underline;' href='".admin_url('admin.php?page=gourlsettings#'.GOURL.'boxlogo2')."'>" . __("Please check/save your free currencyconverterapi.com key on GoUrl plugin Settings page", GOURL )."</a>";
// try premium key
$data = json_decode(gourl_get_url("https://api.currencyconverterapi.com/api/v6/convert?q=".$key2."&compact=ultra&apiKey=".$currencyconverterapi_key, 10, TRUE), TRUE);

// try prepaid key
$data = json_decode(gourl_get_url("https://prepaid.currconv.com/api/v7/convert?q=".$key2."&compact=ultra&apiKey=".$currencyconverterapi_key, 10, TRUE), TRUE);
if (isset($data[$key2]) && $data[$key2] > 0) { $val = $data[$key2]; $error = ""; }
else {
// try premium key
$data = json_decode(gourl_get_url("https://api.currconv.com/api/v7/convert?q=".$key2."&compact=ultra&apiKey=".$currencyconverterapi_key, 10, TRUE), TRUE);
if (isset($data[$key2]) && $data[$key2] > 0) { $val = $data[$key2]; $error = ""; }
}
}
}

Expand Down Expand Up @@ -8397,7 +8414,7 @@ function gourl_altcoin_btc_price ($altcoin, $interval = 1)
{
return $arr2["price"];
}
return 0;


return 0;
}
6 changes: 3 additions & 3 deletions gourl_wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
Plugin Name: GoUrl Bitcoin Payment Gateway & Paid Downloads & Membership
Plugin URI: https://gourl.io/bitcoin-wordpress-plugin.html
Description: Official <a href="https://gourl.io">GoUrl.io</a> Bitcoin Payment Gateway for Wordpress. White Label Solution. Provides bitcoin/altcoin payment gateways for - WooCommerce, Paid Memberships Pro, bbPress, Give Donations, Pay-Per-View, Pay-Per-Download, etc. Accept Bitcoin, BitcoinCash, BitcoinSV, Litecoin, Dash, Dogecoin, etc payments online. No Chargebacks, Global, Secure. All in automatic mode.
Version: 1.5.0
Version: 1.5.1
Author: GoUrl.io
Author URI: https://gourl.io
WC requires at least: 2.1.0
WC tested up to: 5.2.0
WC tested up to: 5.4.0
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
GitHub Plugin URI: https://github.com/cryptoapi/Bitcoin-Wordpress-Plugin
Expand All @@ -33,7 +33,7 @@

DEFINE('GOURL', "gourl");
DEFINE('GOURL_PREVIEW', "gourladmin");
DEFINE('GOURL_VERSION', "1.5.0");
DEFINE('GOURL_VERSION', "1.5.1");
DEFINE('GOURL_ADMIN', admin_url("admin.php?page="));
DEFINE('GOURL_DIR', $dir_arr["basedir"]."/".GOURL.'/');
DEFINE('GOURL_DIR2', $dir_arr["baseurl"]."/".GOURL.'/');
Expand Down
7 changes: 4 additions & 3 deletions includes/cryptobox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1915,11 +1915,12 @@ function convert_currency_live($from_Currency, $to_Currency, $amount, $currencyc
}


// d. get rates from https://free.currencyconverterapi.com/api/v6/convert?q=BTC_EUR&compact=y
// d. get rates from https://free.currconv.com/api/v7/convert?q=BTC_EUR&compact=y&apiKey=your_free_currencyconverterapi_key
// free api key here - https://free.currencyconverterapi.com/free-api-key
// ----------------
if (!$val)
{
$data = json_decode(get_url_contents("https://free.currencyconverterapi.com/api/v6/convert?q=".$key."&compact=ultra&apiKey=".$currencyconverterapi_key, 20, TRUE), TRUE);
$data = json_decode(get_url_contents("https://free.currconv.com/api/v7/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 @@ -2386,6 +2387,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);
}
?>
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GoUrl Bitcoin Payment Gateway & Paid Downloads & Membership
-----------------------------------------------------------

Version 1.5.0
Version 1.5.1


**GoUrl Official Bitcoin/Altcoin Payment Gateway for Wordpress 3.5 or higher version**
Expand All @@ -17,7 +17,7 @@ Accept Bitcoin, BitcoinCash, BitcoinSV, Litecoin, Dash, Dogecoin, Speedcoin, Red
* Instruction - [https://tishonator.com/blog/how-to-add-bitcoin-payment-to-your-woocommerce-store](https://tishonator.com/blog/how-to-add-bitcoin-payment-to-your-woocommerce-store)
* Requires at least: 3.5
* Tested up to: 5.4
* Stable Tag: 1.5.0
* Stable Tag: 1.5.1
* License: GNU Version 2 or Any Later Version


Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author URI: https://gourl.io
Tags: bitcoin, accept bitcoin, bitcoin payments, bitcoin woocommerce, bitcoin wordpress plugin, bitcoin wordpress, bitcoin payments, bitcoincash, bitcoin cash, bitcoin sv, bitcoins, affiliate program, cryptocurrency, affiliates, altcoins, bitpay, paid memberships pro, pmpro, paid membership, btc, marketpress, coinbase, e-commerce, content protection, access-control, credit cards, currency, payment, dash, digital downloads, dogecoin, donation, downloads, e-downloads, e-store, easy digital downloads, ecommerce, feathercoin, universalcurrency, file download, gateway, gourl, litecoin, membership, paid content, payment gateway, paypal, potcoin, protection, reddcoin, registration, restrict access, restrict content, speedcoin, subscription, usd, vertcoin, virtual currency, jigoshop, woocommerce, authorize, shop, wp e-commerce, appthemes, classipress, vantage, jobroller, clipper, taskerr, hirebee, ideas, quality control, akismet, bbpress, buddypress, discussion, forums, forum, bitcoin donations, bitcoin donation, charity, churches, crowdfunding, donate, donation, donations, fundraiser, fundraising, gifts, giving, non-profit, nonprofit, paypal, stripe, give, wordpress donations, bitcoin, payments, payment gateway, digital downloads, download, downloads, e-commerce, e-downloads, e-store, ecommerce, eshop, selling, wp ecommerce, edd, easy digital downloads, litecoin, dogecoin, dash, speedcoin, vertcoin, reddcoin, feathercoin, potcoin, monetaryunit, peercoin, white label
Requires at least: 3.5
Tested up to: 5.4
Stable Tag: 1.5.0
Stable Tag: 1.5.1
License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -180,6 +180,9 @@ Yes, we offer [Free Technical Support](https://gourl.io/view/contact/Contact_Us.

== Changelog ==

= 1.5.1 =
Update currencyconverterapi.com api to v7

= 1.5.0 =
* Several new enhancements. Recommended Update
* Added Albanian Language (Thanks to Meso J.)
Expand Down Expand Up @@ -338,4 +341,4 @@ Add Pay-Per-Product, Pay-Per-Membership

= 1.0.0 =
This is the first version of GoUrl Bitcoin Payment Gateway & Paid Downloads & Membership Plugin

0 comments on commit 4e90514

Please sign in to comment.