Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/v2.0.2 #27

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion admin/Ilove_Img_Wm_Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"ilovepdf/iloveimg-php": "^1.1"
"ilovepdf/iloveimg-php": "dev-master"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
Expand Down
2 changes: 1 addition & 1 deletion ilove-img-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 15 additions & 14 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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/"
Expand All @@ -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"
},
Expand Down Expand Up @@ -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": {
Expand All @@ -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"
Expand Down
20 changes: 11 additions & 9 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
'name' => 'ilovepdf/iloveimg-wp-watermark',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '09fe79763657448fa01d9bc6c7c7299af6215a36',
'reference' => 'c3ca3b02afee681927514e4a66ed38cbff2e1500',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'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(),
Expand All @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions vendor/ilovepdf/iloveimg-php/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -59,4 +59,4 @@ See samples folder.

## Documentation

Please see https://developer.iloveimg.com/docs for up-to-date documentation.
Please see https://developer.iloveimg.com/docs for up-to-date documentation.
6 changes: 3 additions & 3 deletions vendor/ilovepdf/iloveimg-php/samples/compress_basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,4 +19,4 @@
$myTask->execute();

// and finally download file. If no path is set, it will be downloaded on current folder
$myTask->download();
$myTask->download();
36 changes: 32 additions & 4 deletions vendor/ilovepdf/iloveimg-php/src/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class Element
*/
public $font_style = 'Regular';

/**
* @var string
*/
public $font_weight = null;

/**
* @var string
*/
Expand Down Expand Up @@ -141,7 +146,11 @@ class Element
public $layer;


/**
* @var bool
*/
public $bold = false;

/**
* string
* @var
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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;
Expand All @@ -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;
}

}
14 changes: 13 additions & 1 deletion vendor/ilovepdf/iloveimg-php/src/Iloveimg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions vendor/ilovepdf/iloveimg-php/src/ImageTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
}

Expand Down
Loading
Loading