diff --git a/README.md b/README.md index bf2deaa..a2c026a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ === Best Watermark - Protect images on your site with iLoveIMG === Plugin Name: Best Watermark - Protect images on your site with iLoveIMG -Version: 2.0.1 +Version: 2.0.2 Author: iLovePDF Author URI: https://www.iloveimg.com/ Contributors: iLovePDF Tags: watermark, image protection, photography, picture, e-commerce Requires at least: 5.3 -Tested up to: 6.4.1 -Stable tag: 2.0.1 +Tested up to: 6.4.2 +Stable tag: 2.0.2 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -86,6 +86,10 @@ Moreover, all processed files are automatically deleted from our servers after b == Changelog == +== 2.0.2 == +Added +* Update iloveimg-php library + == 2.0.1 == Added * Improved class loading. diff --git a/README.txt b/README.txt index 6a03ad8..eb9a72f 100644 --- a/README.txt +++ b/README.txt @@ -1,13 +1,13 @@ === Best Watermark - Protect images on your site with iLoveIMG === Plugin Name: Best Watermark - Protect images on your site with iLoveIMG -Version: 2.0.1 +Version: 2.0.2 Author: iLovePDF Author URI: https://www.iloveimg.com/ Contributors: iLovePDF Tags: watermark, image protection, photography, picture, e-commerce Requires at least: 5.3 -Tested up to: 6.4.1 -Stable tag: 2.0.1 +Tested up to: 6.4.2 +Stable tag: 2.0.2 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -86,6 +86,10 @@ Moreover, all processed files are automatically deleted from our servers after b == Changelog == +== 2.0.2 == +Added +* Update iloveimg-php library + == 2.0.1 == Added * Improved class loading. diff --git a/admin/Ilove_Img_Wm_Plugin.php b/admin/Ilove_Img_Wm_Plugin.php index 9b0b5f2..45b38ba 100644 --- a/admin/Ilove_Img_Wm_Plugin.php +++ b/admin/Ilove_Img_Wm_Plugin.php @@ -18,7 +18,7 @@ class Ilove_Img_Wm_Plugin { * @access public * @var string VERSION The current version of the plugin. */ - const VERSION = '2.0.1'; + const VERSION = '2.0.2'; /** * The unique identifier of this plugin. diff --git a/composer.json b/composer.json index 60796d5..2dd404a 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "ilovepdf/iloveimg-php": "^1.1" + "ilovepdf/iloveimg-php": "dev-master" }, "require-dev": { "phpstan/phpstan": "^1.10", diff --git a/ilove-img-watermark.php b/ilove-img-watermark.php index e25bedb..8ec06d2 100644 --- a/ilove-img-watermark.php +++ b/ilove-img-watermark.php @@ -15,7 +15,7 @@ * Plugin Name: Best Watermark - Protect images on your site with iLoveIMG * Plugin URI: https://developer.iloveimg.com/ * Description: Protect your site from image theft with our reliable and easy-to-use watermark plugin. Effective protection for your images. - * Version: 2.0.1 + * Version: 2.0.2 * Requires at least: 5.3 * Requires PHP: 7.4 * Author: iLoveIMG diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b4addf8..f90605b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "ilovepdf/iloveimg-php", - "version": "v1.1.15", - "version_normalized": "1.1.15.0", + "version": "dev-master", + "version_normalized": "dev-master", "source": { "type": "git", "url": "https://github.com/ilovepdf/iloveimg-php.git", - "reference": "e825be5c31c81971b52caebd372e54846528c7f4" + "reference": "0dcf0c1b83fd20c52fcfd76b2328ab02b81124a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ilovepdf/iloveimg-php/zipball/e825be5c31c81971b52caebd372e54846528c7f4", - "reference": "e825be5c31c81971b52caebd372e54846528c7f4", + "url": "https://api.github.com/repos/ilovepdf/iloveimg-php/zipball/0dcf0c1b83fd20c52fcfd76b2328ab02b81124a4", + "reference": "0dcf0c1b83fd20c52fcfd76b2328ab02b81124a4", "shasum": "" }, "require": { @@ -22,9 +22,10 @@ "require-dev": { "phpunit/phpunit": "^7.1" }, - "time": "2019-05-30T12:35:52+00:00", + "time": "2021-10-29T14:46:10+00:00", + "default-branch": true, "type": "library", - "installation-source": "dist", + "installation-source": "source", "autoload": { "psr-4": { "Iloveimg\\": "src/" @@ -44,7 +45,7 @@ "homepage": "https://iloveimg.com/", "support": { "issues": "https://github.com/ilovepdf/iloveimg-php/issues", - "source": "https://github.com/ilovepdf/iloveimg-php/tree/v1.1.15" + "source": "https://github.com/ilovepdf/iloveimg-php/tree/master" }, "install-path": "../ilovepdf/iloveimg-php" }, @@ -147,17 +148,17 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.41", - "version_normalized": "1.10.41.0", + "version": "1.10.48", + "version_normalized": "1.10.48.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c6174523c2a69231df55bdc65b61655e72876d76" + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6174523c2a69231df55bdc65b61655e72876d76", - "reference": "c6174523c2a69231df55bdc65b61655e72876d76", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", "shasum": "" }, "require": { @@ -166,7 +167,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2023-11-05T12:57:57+00:00", + "time": "2023-12-08T14:34:28+00:00", "bin": [ "phpstan", "phpstan.phar" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index f512fe2..806d41b 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'ilovepdf/iloveimg-wp-watermark', 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => '09fe79763657448fa01d9bc6c7c7299af6215a36', + 'reference' => 'c3ca3b02afee681927514e4a66ed38cbff2e1500', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,18 +11,20 @@ ), 'versions' => array( 'ilovepdf/iloveimg-php' => array( - 'pretty_version' => 'v1.1.15', - 'version' => '1.1.15.0', - 'reference' => 'e825be5c31c81971b52caebd372e54846528c7f4', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '0dcf0c1b83fd20c52fcfd76b2328ab02b81124a4', 'type' => 'library', 'install_path' => __DIR__ . '/../ilovepdf/iloveimg-php', - 'aliases' => array(), + 'aliases' => array( + 0 => '9999999-dev', + ), 'dev_requirement' => false, ), 'ilovepdf/iloveimg-wp-watermark' => array( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => '09fe79763657448fa01d9bc6c7c7299af6215a36', + 'reference' => 'c3ca3b02afee681927514e4a66ed38cbff2e1500', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,9 +49,9 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '1.10.41', - 'version' => '1.10.41.0', - 'reference' => 'c6174523c2a69231df55bdc65b61655e72876d76', + 'pretty_version' => '1.10.48', + 'version' => '1.10.48.0', + 'reference' => '087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), diff --git a/vendor/ilovepdf/iloveimg-php/readme.md b/vendor/ilovepdf/iloveimg-php/readme.md index d15d0cd..09a64e0 100644 --- a/vendor/ilovepdf/iloveimg-php/readme.md +++ b/vendor/ilovepdf/iloveimg-php/readme.md @@ -23,7 +23,7 @@ PHP 7.1 and later. You can install the library via [Composer](http://getcomposer.org/). Run the following command: ```bash -composer require iloveimg/iloveimg-php +composer require ilovepdf/iloveimg-php ``` To use the library, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading): @@ -59,4 +59,4 @@ See samples folder. ## Documentation -Please see https://developer.iloveimg.com/docs for up-to-date documentation. \ No newline at end of file +Please see https://developer.iloveimg.com/docs for up-to-date documentation. diff --git a/vendor/ilovepdf/iloveimg-php/samples/compress_basic.php b/vendor/ilovepdf/iloveimg-php/samples/compress_basic.php index 142ee85..77ee90b 100644 --- a/vendor/ilovepdf/iloveimg-php/samples/compress_basic.php +++ b/vendor/ilovepdf/iloveimg-php/samples/compress_basic.php @@ -4,12 +4,12 @@ //if manual installation has been used comment line that requires the autoload and uncomment this line: //require_once('../init.php'); -use Iloveimg\CompressimageImageTask; +use Iloveimg\CompressImageTask; // you can call task class directly // to get your key pair, please visit https://developer.iloveimg.com/user/projects -$myTask = new CompressimageImageTask('project_public_id','project_secret_key'); +$myTask = new CompresImageTask('project_public_id','project_secret_key'); // file var keeps info about server file id, name... // it can be used latter to cancel file @@ -19,4 +19,4 @@ $myTask->execute(); // and finally download file. If no path is set, it will be downloaded on current folder -$myTask->download(); \ No newline at end of file +$myTask->download(); diff --git a/vendor/ilovepdf/iloveimg-php/src/Element.php b/vendor/ilovepdf/iloveimg-php/src/Element.php index afc49d0..d631b1b 100644 --- a/vendor/ilovepdf/iloveimg-php/src/Element.php +++ b/vendor/ilovepdf/iloveimg-php/src/Element.php @@ -98,6 +98,11 @@ class Element */ public $font_style = 'Regular'; + /** + * @var string + */ + public $font_weight = null; + /** * @var string */ @@ -141,7 +146,11 @@ class Element public $layer; + /** + * @var bool + */ public $bold = false; + /** * string * @var @@ -224,6 +233,15 @@ public function setFontStyle($font_style) return $this; } + /** + * @param string $font_weight + */ + public function setFontWeight($font_weight) + { + $this->font_weight = $font_weight; + return $this; + } + /** * @param int $font_size */ @@ -295,7 +313,7 @@ public function setVerticalPositionAdjustment($vertical_position_adjustment) /** * @param int $horizontal_position_adjustment */ - public function setHorizontalAdjustmentPercent($horizontal_adjustment_percent) + public function setHorizontalAdjustmentPercent($horizontal_adjustment_percent): Element { $this->horizontal_adjustment_percent = $horizontal_adjustment_percent; return $this; @@ -305,7 +323,7 @@ public function setHorizontalAdjustmentPercent($horizontal_adjustment_percent) * @param $gravity * @return $this */ - public function setGravity($gravity) + public function setGravity($gravity): Element { $this->checkValues($gravity, $this->gravityValues); @@ -317,7 +335,7 @@ public function setGravity($gravity) * @param int $width_percent * @return $this */ - public function setWidthPercent(int $width_percent) + public function setWidthPercent(int $width_percent): Element { $this->width_percent = $width_percent; return $this; @@ -332,8 +350,18 @@ public function setWidthPercent(int $width_percent) public function checkValues($value, $allowedValues) { if (!in_array($value, $allowedValues)) { - throw new \InvalidArgumentException('Invalid ' . $this->tool . ' value "' . $value . '". Must be one of: ' . implode(',', $allowedValues)); + throw new \InvalidArgumentException('Invalid value "' . $value . '". Must be one of: ' . implode(',', $allowedValues)); } } + /** + * @param bool $mosaic + * @return Element + */ + public function setMosaic(bool $mosaic): Element + { + $this->mosaic = $mosaic; + return $this; + } + } \ No newline at end of file diff --git a/vendor/ilovepdf/iloveimg-php/src/Iloveimg.php b/vendor/ilovepdf/iloveimg-php/src/Iloveimg.php index b5f06ba..a476179 100644 --- a/vendor/ilovepdf/iloveimg-php/src/Iloveimg.php +++ b/vendor/ilovepdf/iloveimg-php/src/Iloveimg.php @@ -34,7 +34,7 @@ class Iloveimg // @var string|null The version of the Iloveimg API to use for requests. public static $apiVersion = 'v1'; - const VERSION = 'php.1.0.2'; + const VERSION = 'php.1.1.16'; public $token = null; @@ -187,6 +187,9 @@ public function sendRequest($method, $endpoint, $body = null, $start = false) throw new AuthException($response->body->name, $response->code, null, $response); } if ($endpoint == 'upload') { + if(is_string($response->body)){ + throw new UploadException("Upload error", $response->code, null, $response); + } throw new UploadException($response->body->error->message, $response->code, null, $response); } elseif ($endpoint == 'process') { throw new ProcessException($response->body->error->message, $response->code, null, $response); @@ -316,6 +319,15 @@ public function verifySsl($verify) Request::verifyHost($verify); } + + + /** + * @param $follow + */ + public function followLocation($follow){ + Request::followLocation($follow); + } + private function getUpdatedInfo() { $data = array('v' => self::VERSION); diff --git a/vendor/ilovepdf/iloveimg-php/src/ImageTask.php b/vendor/ilovepdf/iloveimg-php/src/ImageTask.php index cbc4fc8..485d11d 100644 --- a/vendor/ilovepdf/iloveimg-php/src/ImageTask.php +++ b/vendor/ilovepdf/iloveimg-php/src/ImageTask.php @@ -179,6 +179,10 @@ public function addFileFromUrl($url) */ public function uploadFile($task, $filepath) { + if(!file_exists($filepath)){ + throw new \InvalidArgumentException('File '.$filepath.' does not exists'); + } + $data = array('task' => $task, 'v' => self::VERSION); $files = array('file' => $filepath); $body = Request\Body::multipart($data, $files); @@ -285,11 +289,12 @@ private function downloadFile($task) $data = array('v' => self::VERSION); $body = Request\Body::Form($data); $response = parent::sendRequest('get', 'download/' . $task, $body); + $contentDispoition = $response->headers['Content-Disposition'] ?? $response->headers['content-disposition']; - if (preg_match("/filename\*\=utf-8\'\'([\W\w]+)/", $response->headers['Content-Disposition'], $matchesUtf)) { + if (preg_match("/filename\*\=utf-8\'\'([\W\w]+)/", $contentDispoition, $matchesUtf)) { $filename = urldecode(str_replace('"', '', $matchesUtf[1])); } else { - preg_match('/ .*filename=\"([\W\w]+)\"/', $response->headers['Content-Disposition'], $matches); + preg_match('/ .*filename=\"([\W\w]+)\"/', $contentDispoition, $matches); $filename = str_replace('"', '', $matches[1]); } diff --git a/vendor/ilovepdf/iloveimg-php/src/Request/Request.php b/vendor/ilovepdf/iloveimg-php/src/Request/Request.php index 9a631ac..6675e97 100644 --- a/vendor/ilovepdf/iloveimg-php/src/Request/Request.php +++ b/vendor/ilovepdf/iloveimg-php/src/Request/Request.php @@ -13,8 +13,9 @@ class Request private static $socketTimeout = null; private static $verifyPeer = true; private static $verifyHost = true; + private static $followLocation = true; - private static $auth = array ( + private static $auth = array( 'user' => '', 'pass' => '', 'method' => CURLAUTH_BASIC @@ -25,7 +26,7 @@ class Request 'tunnel' => false, 'address' => false, 'type' => CURLPROXY_HTTP, - 'auth' => array ( + 'auth' => array( 'user' => '', 'pass' => '', 'method' => CURLAUTH_BASIC @@ -67,6 +68,17 @@ public static function verifyHost($enabled) return self::$verifyHost = $enabled; } + /** + * Follow location option + * + * @param bool $enabled enable follow location, by default is true + * @return bool + */ + public static function followLocation($enabled) + { + return self::$followLocation = $enabled; + } + /** * Set a timeout * @@ -302,25 +314,25 @@ public static function buildHTTPCurlQuery($data, $parent = false) /** * Send a cURL request - * @param \Iloveimg\Method|string $method HTTP method to use + * @param \Ilovepdf\Method|string $method HTTP method to use * @param string $url URL to send the request to * @param mixed $body request body * @param array $headers additional headers to send * @param string $username Authentication username (deprecated) * @param string $password Authentication password (deprecated) - * @throws \Iloveimg\Exception if a cURL error occurs * @return Response + * @throws \Ilovepdf\Exception if a cURL error occurs */ public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null) { self::$handle = curl_init(); if ($method !== Method::GET) { - if ($method === Method::POST) { - curl_setopt(self::$handle, CURLOPT_POST, true); - } else { - curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method); - } + if ($method === Method::POST) { + curl_setopt(self::$handle, CURLOPT_POST, true); + } else { + curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method); + } curl_setopt(self::$handle, CURLOPT_POSTFIELDS, $body); } elseif (is_array($body)) { @@ -336,7 +348,6 @@ public static function send($method, $url, $body = null, $headers = array(), $us $curl_base_options = [ CURLOPT_URL => self::encodeUrl($url), CURLOPT_RETURNTRANSFER => true, - CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 10, CURLOPT_HTTPHEADER => self::getFormattedHeaders($headers), CURLOPT_HEADER => true, @@ -349,6 +360,10 @@ public static function send($method, $url, $body = null, $headers = array(), $us curl_setopt_array(self::$handle, self::mergeCurlOptions($curl_base_options, self::$curlOpts)); + if (self::$followLocation == true) { + @curl_setopt(self::$handle, CURLOPT_FOLLOWLOCATION, true); + } + if (self::$socketTimeout !== null) { curl_setopt(self::$handle, CURLOPT_TIMEOUT, self::$socketTimeout); } @@ -372,38 +387,38 @@ public static function send($method, $url, $body = null, $headers = array(), $us if (!empty(self::$auth['user'])) { curl_setopt_array(self::$handle, array( - CURLOPT_HTTPAUTH => self::$auth['method'], - CURLOPT_USERPWD => self::$auth['user'] . ':' . self::$auth['pass'] + CURLOPT_HTTPAUTH => self::$auth['method'], + CURLOPT_USERPWD => self::$auth['user'] . ':' . self::$auth['pass'] )); } if (self::$proxy['address'] !== false) { curl_setopt_array(self::$handle, array( - CURLOPT_PROXYTYPE => self::$proxy['type'], - CURLOPT_PROXY => self::$proxy['address'], - CURLOPT_PROXYPORT => self::$proxy['port'], + CURLOPT_PROXYTYPE => self::$proxy['type'], + CURLOPT_PROXY => self::$proxy['address'], + CURLOPT_PROXYPORT => self::$proxy['port'], CURLOPT_HTTPPROXYTUNNEL => self::$proxy['tunnel'], - CURLOPT_PROXYAUTH => self::$proxy['auth']['method'], - CURLOPT_PROXYUSERPWD => self::$proxy['auth']['user'] . ':' . self::$proxy['auth']['pass'] + CURLOPT_PROXYAUTH => self::$proxy['auth']['method'], + CURLOPT_PROXYUSERPWD => self::$proxy['auth']['user'] . ':' . self::$proxy['auth']['pass'] )); } - $response = curl_exec(self::$handle); - $error = curl_error(self::$handle); - $info = self::getInfo(); + $response = curl_exec(self::$handle); + $error = curl_error(self::$handle); + $info = self::getInfo(); if ($error) { - if(strpos($error,'SSL certificate problem')){ - throw new \Exception($error.' Try using method verifySsl to false: "$iloveimg->verifySsl(false)"'); + if (strpos($error, 'SSL certificate problem')) { + throw new \Exception($error . ' Try using method verifySsl to false: "$ilovepdf->verifySsl(false)"'); } throw new \Exception($error); } // Split the full response in its headers and body $header_size = $info['header_size']; - $header = substr($response, 0, $header_size); - $body = substr($response, $header_size); - $httpCode = $info['http_code']; + $header = substr($response, 0, $header_size); + $body = substr($response, $header_size); + $httpCode = $info['http_code']; return new Response($httpCode, $body, $header, self::$jsonOpts); } @@ -428,7 +443,7 @@ public static function getFormattedHeaders($headers) { $formattedHeaders = array(); - $combinedHeaders = array_change_key_case(array_merge(self::$defaultHeaders, (array) $headers)); + $combinedHeaders = array_change_key_case(array_merge(self::$defaultHeaders, (array)$headers)); foreach ($combinedHeaders as $key => $val) { $formattedHeaders[] = self::getHeaderString($key, $val); @@ -458,7 +473,7 @@ private static function getArrayFromQuerystring($query) /** * Ensure that a URL is encoded and safe to use with cURL - * @param string $url URL to encode + * @param string $url URL to encode * @return string */ private static function encodeUrl($url) @@ -466,10 +481,10 @@ private static function encodeUrl($url) $url_parsed = parse_url($url); $scheme = $url_parsed['scheme'] . '://'; - $host = $url_parsed['host']; - $port = (isset($url_parsed['port']) ? $url_parsed['port'] : null); - $path = (isset($url_parsed['path']) ? $url_parsed['path'] : null); - $query = (isset($url_parsed['query']) ? $url_parsed['query'] : null); + $host = $url_parsed['host']; + $port = (isset($url_parsed['port']) ? $url_parsed['port'] : null); + $path = (isset($url_parsed['path']) ? $url_parsed['path'] : null); + $query = (isset($url_parsed['query']) ? $url_parsed['query'] : null); if ($query !== null) { $query = '?' . http_build_query(self::getArrayFromQuerystring($query));