diff --git a/LICENSE b/LICENSE index 180d162f..89d0c08c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ -Copyright (C) 2021 Tatum +Copyright (C) 2021 Hathoriel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. diff --git a/README.txt b/README.txt index d23f8e6e..72b894c4 100644 --- a/README.txt +++ b/README.txt @@ -5,7 +5,7 @@ Tags: tatum, blockchain, nft, erc721, ethereum, celo, bsc, mint Requires at least: 5.5 Requires PHP: 7.0 Tested up to: 5.7.1 -Stable tag: 2.0.6 +Stable tag: 2.0.7 License: MIT License URI: https://opensource.org/licenses/MIT diff --git a/inc/base/others/cachebuster-lib.php b/inc/base/others/cachebuster-lib.php index 490209c4..f9c413c3 100644 --- a/inc/base/others/cachebuster-lib.php +++ b/inc/base/others/cachebuster-lib.php @@ -1,5 +1,5 @@ '4.15.4', 'react' => '17.0.2', diff --git a/inc/base/others/cachebuster.php b/inc/base/others/cachebuster.php index f4525066..d652a25c 100644 --- a/inc/base/others/cachebuster.php +++ b/inc/base/others/cachebuster.php @@ -1,5 +1,5 @@ '91676d9e5af4f8ad7beeb660744b8c3f', 'src/public/dist/vendor-admin.js' => '3a0de1fe5709d597975e4e6993e9600a', diff --git a/inc/tatum/Ipfs.php b/inc/tatum/Ipfs.php index a20e74a1..69ac819a 100644 --- a/inc/tatum/Ipfs.php +++ b/inc/tatum/Ipfs.php @@ -46,15 +46,39 @@ private static function getProductImageNameAndContent($product_id) { $attachment_url = wp_get_attachment_url($product->get_image_id()); $uploads = wp_upload_dir(); $file_path = str_replace($uploads['baseurl'], $uploads['basedir'], $attachment_url); - if (file_exists($file_path)) { - if (filesize($file_path) <= 52428800) { - return array('name' => basename($attachment_url), 'content' => file_get_contents($file_path)); + if (substr($file_path, 0, 4) === "http") { + if (self::urlFileExists($file_path)) { + if (self::urlFileSize($file_path) <= 52428800) { + return array('name' => basename($attachment_url), 'content' => file_get_contents($file_path)); + } + throw new \Exception('IPFS: Image is too big.'); + } + } else { + if (file_exists($file_path)) { + if (filesize($file_path) <= 52428800) { + return array('name' => basename($attachment_url), 'content' => file_get_contents($file_path)); + } + throw new \Exception('IPFS: Image is too big.'); } - throw new \Exception('IPFS: Image is too big.'); } throw new \Exception('IPFS: Cannot find image.'); } + private static function urlFileExists($url) { + $options['http'] = array( + 'method' => "HEAD", + 'ignore_errors' => 1, + 'max_redirects' => 0 + ); + $body = file_get_contents($url, NULL, stream_context_create($options)); + sscanf($http_response_header[0], 'HTTP/%*d.%*d %d', $code); + return $code === 200; + } + + private static function urlFileSize($url) { + $headers = get_headers($url, true); + return $headers['Content-Length']; + } private static function buildDataFiles($boundary, $file) { $data = ''; diff --git a/index.php b/index.php index 3411648f..4977726d 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,7 @@ * Description: NFT Maker is the easiest and fastest free plugin to work with NFTs without any blockchain development experience. * Author: Tatum * Author URI: https://tatum.io - * Version: 2.0.6 + * Version: 2.0.7 * Text Domain: tatum * Domain Path: /languages * License: MIT diff --git a/vendor/autoload.php b/vendor/autoload.php index edad4194..983d2a4f 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitca38ed42bb78fd96011107c159caeffe::getLoader(); +return ComposerAutoloaderInit972e818115428fd1a6fa2272f133fd5b::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 62bdafc4..15595c4e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitca38ed42bb78fd96011107c159caeffe +class ComposerAutoloaderInit972e818115428fd1a6fa2272f133fd5b { private static $loader; @@ -24,15 +24,15 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitca38ed42bb78fd96011107c159caeffe', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit972e818115428fd1a6fa2272f133fd5b', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitca38ed42bb78fd96011107c159caeffe', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit972e818115428fd1a6fa2272f133fd5b', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitca38ed42bb78fd96011107c159caeffe::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit972e818115428fd1a6fa2272f133fd5b::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 294baa78..edbaf363 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitca38ed42bb78fd96011107c159caeffe +class ComposerStaticInit972e818115428fd1a6fa2272f133fd5b { public static $prefixLengthsPsr4 = array ( 'k' => @@ -70,9 +70,9 @@ class ComposerStaticInitca38ed42bb78fd96011107c159caeffe public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitca38ed42bb78fd96011107c159caeffe::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitca38ed42bb78fd96011107c159caeffe::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitca38ed42bb78fd96011107c159caeffe::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit972e818115428fd1a6fa2272f133fd5b::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit972e818115428fd1a6fa2272f133fd5b::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit972e818115428fd1a6fa2272f133fd5b::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/tatum/utils/vendor/autoload.php b/vendor/tatum/utils/vendor/autoload.php index f6f9f600..0b62ebfa 100644 --- a/vendor/tatum/utils/vendor/autoload.php +++ b/vendor/tatum/utils/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitf7361bbe595adda61517a2c8a420c030::getLoader(); +return ComposerAutoloaderInit5e6c42dc1d791a19ee1e18545c2a81a6::getLoader(); diff --git a/vendor/tatum/utils/vendor/composer/autoload_real.php b/vendor/tatum/utils/vendor/composer/autoload_real.php index 3def27d1..44464e15 100644 --- a/vendor/tatum/utils/vendor/composer/autoload_real.php +++ b/vendor/tatum/utils/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf7361bbe595adda61517a2c8a420c030 +class ComposerAutoloaderInit5e6c42dc1d791a19ee1e18545c2a81a6 { private static $loader; @@ -22,15 +22,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf7361bbe595adda61517a2c8a420c030', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit5e6c42dc1d791a19ee1e18545c2a81a6', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitf7361bbe595adda61517a2c8a420c030', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit5e6c42dc1d791a19ee1e18545c2a81a6', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitf7361bbe595adda61517a2c8a420c030::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit5e6c42dc1d791a19ee1e18545c2a81a6::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { diff --git a/vendor/tatum/utils/vendor/composer/autoload_static.php b/vendor/tatum/utils/vendor/composer/autoload_static.php index 9a1874ec..3162ea1b 100644 --- a/vendor/tatum/utils/vendor/composer/autoload_static.php +++ b/vendor/tatum/utils/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitf7361bbe595adda61517a2c8a420c030 +class ComposerStaticInit5e6c42dc1d791a19ee1e18545c2a81a6 { public static $prefixLengthsPsr4 = array ( 'H' => @@ -35,9 +35,9 @@ class ComposerStaticInitf7361bbe595adda61517a2c8a420c030 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitf7361bbe595adda61517a2c8a420c030::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitf7361bbe595adda61517a2c8a420c030::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitf7361bbe595adda61517a2c8a420c030::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit5e6c42dc1d791a19ee1e18545c2a81a6::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit5e6c42dc1d791a19ee1e18545c2a81a6::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit5e6c42dc1d791a19ee1e18545c2a81a6::$classMap; }, null, ClassLoader::class); }