Skip to content

Commit

Permalink
2.4.1
Browse files Browse the repository at this point in the history
- Changed `file_get_contents` into `curl` for better server compatibility
  • Loading branch information
hrsetyono committed Sep 21, 2022
1 parent 7f1ad6c commit 05a40b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions includes/ongkir-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@ static function get_services($name, $simple_format = false) {
*/
private static function _read_json($filename) {
$fileurl = ONGKIR_FILE . "/includes/data/$filename";
$args = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
];

$fileraw = file_get_contents($fileurl, false, stream_context_create($args));
if (!function_exists('curl_init')){
die('Your server needs CURL for this plugin to work');
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $fileurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$fileraw = curl_exec($ch);
curl_close($ch);

return json_decode($fileraw, true);
}

Expand Down
4 changes: 2 additions & 2 deletions wc-ongkir-indonesia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Ongkir Indonesia for WooCommerce
* Plugin URI: http://github.com/hrsetyono/wc-ongkir-indonesia
* Description: Calculate the shipping costs for Indonesian couriers like JNE, J&T, Ninja Xpress, Sicepat, TIKI, POS, etc. Requires RajaOngkir PRO License.
* Version: 2.4.0
* Version: 2.4.1
* Author: Pixel Studio
* Author URI: https://pixelstudio.id/
* License: GPL-3.0+
Expand All @@ -18,7 +18,7 @@
return;
}

define('ONGKIR_VERSION', '2.4.0');
define('ONGKIR_VERSION', '2.4.1');
define('ONGKIR_FILE', plugins_url('', __FILE__));
define('ONGKIR_DIR', __DIR__);
define('ONGKIR_NAMESPACE', 'ongkir/v1');
Expand Down

0 comments on commit 05a40b9

Please sign in to comment.