Skip to content

Commit

Permalink
versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
timoj committed Dec 27, 2017
1 parent d2d048e commit 0dc3f4b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
30 changes: 21 additions & 9 deletions includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class WC_Wuunder_Create
{
public $order_id;
private $version_obj = array("product" => "Woocommerce extension", "version" => array("build" => "2.1.2", "plugin" => "2.0"));
private $version_obj = array("product" => "Woocommerce extension", "version" => array("build" => "2.2.0", "plugin" => "2.0"));

public function __construct()
{
Expand Down Expand Up @@ -77,9 +77,7 @@ private function buildWuunderData($orderId)
if ($dimensions === null) {
$dimensions = explode(' x ', $item['dimensions']);
}
// if ($description === null) {
$description .= "- " . $item['name'] . "\r\n";
// }
$description .= "- " . $item['quantity'] . "x " . $item['name'] . "\r\n";
}

if ($totalWeight === 0) {
Expand Down Expand Up @@ -327,23 +325,37 @@ public function get_customer_address($orderid, $phone)

}

public function get_base64_image($picture)
public function get_base64_image($imagepath)
{

$imagepath = $picture;
try {
if (filesize($imagepath) <= 2097152) { //smaller or equal to 2MB
$fileSize = (substr($imagepath, 0, 4) === "http") ? $this->remote_filesize($imagepath) : filesize($imagepath);
if ($fileSize <= 2097152) { //smaller or equal to 2MB
$imagedata = file_get_contents($imagepath);
$image = base64_encode($imagedata);
} else {
$image = "";
}
return $image;
}catch(Exception $e) {
} catch (Exception $e) {
return "";
}
}

private function remote_filesize($url)
{
static $regex = '/^Content-Length: *+\K\d++$/im';
if (!$fp = @fopen($url, 'rb')) {
return false;
}
if (
isset($http_response_header) &&
preg_match($regex, implode("\n", $http_response_header), $matches)
) {
return (int)$matches[0];
}
return strlen(stream_get_contents($fp));
}

public function add_listing_actions($order)
{

Expand Down
4 changes: 2 additions & 2 deletions woocommerce-wuunder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Wuunder
* Plugin URI: http://wearewuunder.com
* Description: Wuunder shipping plugin
* Version: 2.1.2
* Version: 2.2.0
* Author: Wuunder
* Author URI: http://wearewuunder.com
*/
Expand Down Expand Up @@ -49,7 +49,7 @@ class Woocommerce_Wuunder
public static $plugin_path;
public static $plugin_basename;

const VERSION = '2.1.2';
const VERSION = '2.2.0';

public function __construct()
{
Expand Down

0 comments on commit 0dc3f4b

Please sign in to comment.