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.2.0 #33

Merged
merged 10 commits into from
Jul 16, 2024
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
22 changes: 16 additions & 6 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.1.0
Version: 2.2.0
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.5.3
Stable tag: 2.1.0
Tested up to: 6.6
Stable tag: 2.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -38,7 +38,7 @@ Trust reliable developers. **Best Watermark - Protect images on your site with i
- **Good for eCommerce** - Works great for eCommerce websites using WooCommerce, NextGen Gallery and other plugins for e-commerce.
- **Security first** - Your data is not stored nor collected on our services. We are GDPR compliant.
- **Frequent updates** - Get a stable and frequently updated image compression plugin.
- **Freemium service** - Freely process up to 500 images per month. Need more? Subscribe our Premium plan o buy a prepaid package to use at your convenience.
- **Freemium service** - Freely up to 2500 credits per month. Need more? Subscribe our [Premium plan](https://iloveapi.com/pricing) or buy a [prepaid package](https://iloveapi.com/pricing) to use at your convenience.

With online images being shared and re-shared all over the Internet, it's easy to lose track of the original author. iLoveIMG Watermark plugin helps you protect the rights of your online photos.

Expand All @@ -52,7 +52,7 @@ With online images being shared and re-shared all over the Internet, it's easy t

**Can I use the plugin for free?**

Absolutely. As a free user, you can optimise a maximum of 500 images per month. Once this limit is reached, you cannot compress new images until next month unless you purchase credits.
Absolutely. As a free user, we let you process your first 2500 monthly credits. Once this limit is reached, you cannot watermark new images until next month unless you purchase credits.

**Can I make a one-time payment?**

Expand All @@ -76,7 +76,7 @@ iLoveIMG Watermark plugin can optimize images in JPG, PNG and GIF format.

**Do you have an API REST?**

Yes, in fact this plugin is powered by our API. And you can integrate our image optimization tools into your software apps too! Learn more about [iLoveIMG API for developers](https://developer.iloveimg.com).
Yes, in fact this plugin is powered by our API. And you can integrate our image optimization tools into your software apps too! Learn more about [iLoveIMG API for developers](https://iloveapi.com).

**Do you care about the privacy of my images?**

Expand All @@ -86,6 +86,16 @@ Moreover, all processed files are automatically deleted from our servers after b

== Changelog ==

== 2.2.0 ==
Improved
* Update Libraries.
* Now IloveIMG will use credits to process the files.
* Now iloveimg accounts have been migrated to ilovepdf.
* Improved the function to restore all files.

Fixed
* When autowatermark is activated and you wanted to restore a specific file, it was watermarked again.

== 2.1.0 ==
Added
* Functionality to restore images individually.
Expand Down
22 changes: 16 additions & 6 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.1.0
Version: 2.2.0
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.5.3
Stable tag: 2.1.0
Tested up to: 6.6
Stable tag: 2.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -38,7 +38,7 @@ Trust reliable developers. **Best Watermark - Protect images on your site with i
- **Good for eCommerce** - Works great for eCommerce websites using WooCommerce, NextGen Gallery and other plugins for e-commerce.
- **Security first** - Your data is not stored nor collected on our services. We are GDPR compliant.
- **Frequent updates** - Get a stable and frequently updated image compression plugin.
- **Freemium service** - Freely process up to 500 images per month. Need more? Subscribe our Premium plan o buy a prepaid package to use at your convenience.
- **Freemium service** - Freely up to 2500 credits per month. Need more? Subscribe our Premium plan (https://iloveapi.com/pricing) or buy a prepaid package (https://iloveapi.com/pricing) to use at your convenience.

With online images being shared and re-shared all over the Internet, it's easy to lose track of the original author. iLoveIMG Watermark plugin helps you protect the rights of your online photos.

Expand All @@ -52,7 +52,7 @@ With online images being shared and re-shared all over the Internet, it's easy t

**Can I use the plugin for free?**

Absolutely. As a free user, you can optimise a maximum of 500 images per month. Once this limit is reached, you cannot compress new images until next month unless you purchase credits.
Absolutely. As a free user, we let you process your first 2500 monthly credits. Once this limit is reached, you cannot compress new images until next month unless you purchase credits.

**Can I make a one-time payment?**

Expand All @@ -76,7 +76,7 @@ iLoveIMG Watermark plugin can optimize images in JPG, PNG and GIF format.

**Do you have an API REST?**

Yes, in fact this plugin is powered by our API. And you can integrate our image optimization tools into your software apps too! Learn more about [iLoveIMG API for developers](https://developer.iloveimg.com).
Yes, in fact this plugin is powered by our API. And you can integrate our image optimization tools into your software apps too! Learn more about [iLoveIMG API for developers](https://iloveapi.com).

**Do you care about the privacy of my images?**

Expand All @@ -86,6 +86,16 @@ Moreover, all processed files are automatically deleted from our servers after b

== Changelog ==

== 2.2.0 ==
Improved
* Update Libraries.
* Now IloveIMG will use credits to process the files.
* Now iloveimg accounts have been migrated to ilovepdf.
* Improved the function to restore all files.

Fixed
* When autowatermark is activated and you wanted to restore a specific file, it was watermarked again.

== 2.1.0 ==
Added
* Functionality to restore images individually.
Expand Down
23 changes: 11 additions & 12 deletions 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.1.0';
const VERSION = '2.2.0';

/**
* The unique identifier of this plugin.
Expand Down Expand Up @@ -158,21 +158,16 @@ public function ilove_img_wm_library() {
public function ilove_img_wm_restore_all() {

if ( is_dir( ILOVE_IMG_WM_BACKUP_FOLDER ) ) {
$folders = array_diff( scandir( ILOVE_IMG_WM_BACKUP_FOLDER ), array( '..', '.' ) );

foreach ( $folders as $key => $folder ) {
Ilove_Img_Wm_Resources::rcopy( ILOVE_IMG_WM_BACKUP_FOLDER . $folder, ILOVE_IMG_WM_UPLOAD_FOLDER . '/' . $folder );
}

Ilove_Img_Wm_Resources::rrmdir( ILOVE_IMG_WM_BACKUP_FOLDER );

$images_restore = json_decode( get_option( 'iloveimg_images_to_restore' ), true );

foreach ( $images_restore as $key => $value ) {
Ilove_Img_Wm_Resources::rcopy( ILOVE_IMG_WM_BACKUP_FOLDER . basename( get_attached_file( $value ) ), get_attached_file( $value ) );

delete_post_meta( $value, 'iloveimg_status_watermark' );
delete_post_meta( $value, 'iloveimg_watermark' );
delete_post_meta( $value, 'iloveimg_status_compress' );
delete_post_meta( $value, 'iloveimg_compress' );
wp_delete_file( ILOVE_IMG_WM_BACKUP_FOLDER . basename( get_attached_file( $value ) ) );
delete_option( 'iloveimg_images_to_restore' );
}
}
Expand Down Expand Up @@ -261,7 +256,9 @@ public function column_id_row( $column_name, $column_id ) {
public function process_attachment( $metadata, $attachment_id ) {
update_post_meta( $attachment_id, 'iloveimg_status_watermark', 0 ); // status no watermarked

if ( (int) Ilove_Img_Wm_Resources::is_auto_watermark() === 1 && Ilove_Img_Wm_Resources::is_loggued() && (int) Ilove_Img_Wm_Resources::is_activated() === 1 ) {
$images_restore = null !== get_option( 'iloveimg_images_to_restore', null ) ? json_decode( get_option( 'iloveimg_images_to_restore' ), true ) : array();

if ( (int) Ilove_Img_Wm_Resources::is_auto_watermark() === 1 && Ilove_Img_Wm_Resources::is_loggued() && (int) Ilove_Img_Wm_Resources::is_activated() === 1 && ! in_array( $attachment_id, $images_restore, true ) ) {
wp_update_attachment_metadata( $attachment_id, $metadata );
$this->async_watermark( $attachment_id );

Expand Down Expand Up @@ -397,7 +394,7 @@ public function show_notices() {
if ( $account['files_used'] >= $account['free_files_limit'] && $account['package_files_used'] >= $account['package_files_limit'] && (int) $account['subscription_files_used'] >= $account['subscription_files_limit'] ) {
?>
<div class="notice notice-warning is-dismissible">
<p><strong>iLoveIMG</strong> - Please you need more files. <a href="https://developer.iloveimg.com/pricing" target="_blank">Buy more files</a></p>
<p><strong>iLoveIMG</strong> - Please you need more files. <a href="https://iloveapi.com/pricing" target="_blank">Buy more files</a></p>
</div>
<?php
}
Expand Down Expand Up @@ -520,8 +517,10 @@ public function ilove_img_restore() {
delete_post_meta( $attachment_id, 'iloveimg_status_compress' );
delete_post_meta( $attachment_id, 'iloveimg_compress' );

if ( ! $key_founded ) {
if ( false !== $key_founded ) {
unset( $images_restore[ $key_founded ] );
wp_delete_file( ILOVE_IMG_WM_BACKUP_FOLDER . basename( get_attached_file( $attachment_id ) ) );
update_option( 'iloveimg_images_to_restore', wp_json_encode( $images_restore ) );
}

wp_send_json_success( __( 'It was restored correctly', 'iloveimg-watermark' ), 200 );
Expand Down
2 changes: 1 addition & 1 deletion admin/Ilove_Img_Wm_Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function watermark( $images_id ) {

$images_restore = array_unique( $images_restore );

update_option( 'iloveimg_images_to_restore', wp_json_encode( $images_restore ) );
update_option( 'iloveimg_images_to_restore', wp_json_encode( $images_restore, JSON_FORCE_OBJECT ) );
}

foreach ( $_sizes as $_size ) {
Expand Down
1 change: 1 addition & 0 deletions admin/Ilove_Img_Wm_Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public function save() {
);
if ( wp_remote_retrieve_response_code( $response ) === 200 ) {
update_option( 'iloveimg_account', $response['body'] );
update_option( 'iloveimg_user_is_migrated', 1 );
$options = json_decode( get_option( 'iloveimg_options_watermark' ), true );
$options['iloveimg_field_watermark_activated'] = 1;
$options['iloveimg_field_autowatermark'] = 1;
Expand Down
29 changes: 22 additions & 7 deletions admin/views/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
$ilove_img_wm_account = array();

if ( get_option( 'iloveimg_account' ) ) {

if ( ! get_option( 'iloveimg_user_is_migrated' ) ) {

delete_option( 'iloveimg_account' );
delete_option( 'iloveimg_proyect' );
$ilove_img_wm_options = json_decode( get_option( 'iloveimg_options_watermark' ), true );
unset( $options['iloveimg_field_watermark_activated'] );
unset( $options['iloveimg_field_autowatermark'] );
unset( $options['iloveimg_field_resize_full'] );
update_option( 'iloveimg_options_watermark', wp_json_encode( $ilove_img_wm_options ) );

wp_safe_redirect( admin_url( 'admin.php?page=iloveimg-watermark-admin-page' ) );
exit();
}

$ilove_img_wm_account = json_decode( get_option( 'iloveimg_account' ), true );

$ilove_img_wm_is_logged = true;
Expand Down Expand Up @@ -76,7 +91,7 @@
<div>
<input type="password" class="iloveimg_field_password" name="iloveimg_field_password" placeholder="Password" required/>
</div>
<a class="forget" href="https://developer.iloveimg.com/login/reset" target="_blank">Forget Password?</a>
<a class="forget" href="https://iloveapi.com/login/reset" target="_blank">Forget Password?</a>
<?php
wp_nonce_field();
submit_button( 'Login' );
Expand All @@ -96,28 +111,28 @@
<div class="iloveimg_percent <?php echo ( $ilove_img_wm_percent >= 100 ) ? 'iloveimg_percent-exceeded' : ''; ?> <?php echo ( $ilove_img_wm_percent >= 90 && $ilove_img_wm_percent < 100 ) ? 'iloveimg_percent-warning' : ''; ?>">
<div class="iloveimg_percent-total" style="width: <?php echo (float) $ilove_img_wm_percent; ?>%;"></div>
</div>
<p><?php echo (int) $ilove_img_wm_account['files_used']; ?>/<?php echo (int) $ilove_img_wm_account['free_files_limit']; ?> processed files this month. Free Tier.</p>
<p><?php echo (int) $ilove_img_wm_account['files_used']; ?>/<?php echo (int) $ilove_img_wm_account['free_files_limit']; ?> credits used this month. Free Tier.</p>
<?php if ( $ilove_img_wm_account['subscription_files_limit'] ) : ?>
<h4>Subscription files</h4>
<?php $ilove_img_wm_percent = ( ( $ilove_img_wm_account['subscription_files_used'] * 100 ) / $ilove_img_wm_account['subscription_files_limit'] ); ?>
<div class="iloveimg_percent <?php echo ( $ilove_img_wm_percent >= 100 ) ? 'iloveimg_percent-exceeded' : ''; ?> <?php echo ( $ilove_img_wm_percent >= 90 && $ilove_img_wm_percent < 100 ) ? 'iloveimg_percent-warning' : ''; ?>">
<div class="iloveimg_percent-total" style="width: <?php echo (float) $ilove_img_wm_percent; ?>%;"></div>
</div>
<p><?php echo ( isset( $ilove_img_wm_account['subscription_files_used'] ) ) ? (int) $ilove_img_wm_account['subscription_files_used'] : 0; ?>/<?php echo (int) $ilove_img_wm_account['subscription_files_limit']; ?> processed files this month.</p>
<p><?php echo ( isset( $ilove_img_wm_account['subscription_files_used'] ) ) ? (int) $ilove_img_wm_account['subscription_files_used'] : 0; ?>/<?php echo (int) $ilove_img_wm_account['subscription_files_limit']; ?> credits used this month.</p>
<?php endif; ?>
<?php if ( $ilove_img_wm_account['package_files_limit'] ) : ?>
<h4>Package files</h4>
<?php $ilove_img_wm_percent = ( ( $ilove_img_wm_account['package_files_used'] * 100 ) / $ilove_img_wm_account['package_files_limit'] ); ?>
<div class="iloveimg_percent <?php echo ( $ilove_img_wm_percent >= 100 ) ? 'iloveimg_percent-exceeded' : ''; ?> <?php echo ( $ilove_img_wm_percent >= 90 && $ilove_img_wm_percent < 100 ) ? 'iloveimg_percent-warning' : ''; ?>">
<div class="iloveimg_percent-total" style="width: <?php echo (float) $ilove_img_wm_percent; ?>%;"></div>
</div>
<p><?php echo (int) $ilove_img_wm_account['package_files_used']; ?>/<?php echo (int) $ilove_img_wm_account['package_files_limit']; ?> processed files this month.</p>
<p><?php echo (int) $ilove_img_wm_account['package_files_used']; ?>/<?php echo (int) $ilove_img_wm_account['package_files_limit']; ?> credits used this month.</p>
<?php endif; ?>
</div>
<div class="iloveimg_settings__overview__account-logged__column_left__details">
<p style="margin-top: 22px;">Every month since your registry you will get <?php echo (int) $ilove_img_wm_account['free_files_limit']; ?> free file processes to use to compress or stamp your images.</p>
<p>To increase your file processes amount you can either open one of our <a href="https://developer.iloveimg.com/pricing" target="_blank">subscription plans</a> to get a fixed amount of additional processes per month or buy a <a href="https://developer.iloveimg.com/pricing" target="_blank">single package</a> of file processes.</p>
<a class="button button-secondary" href="https://developer.iloveimg.com/pricing" target="_blank">Buy more files</a>
<p style="margin-top: 22px;">Every month since your registry you will get <?php echo (int) $ilove_img_wm_account['free_files_limit']; ?> free credits to use to compress or stamp your images.</p>
<p>To increase your credits amount you can either open one of our <a href="https://iloveapi.com/pricing" target="_blank">subscription plans</a> to get a fixed amount of additional credits per month or buy a <a href="https://iloveapi.com/pricing" target="_blank">single package</a> of credits.</p>
<a class="button button-secondary" href="https://iloveapi.com/pricing" target="_blank">Buy more credits</a>
</div>
</div>
<div class="iloveimg_settings__overview__account-logged__column_right">
Expand Down
2 changes: 1 addition & 1 deletion admin/views/compress.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="iloveimg_settings__info">
<h3>The power of iLoveIMG in your WordPress!</h3>
<p>Compress all your Media image files and Stamp other Images or text into your WordPress pictures. This is the Official iLoveIMG plugin for WordPress. You can optimize all your Images and stamp them automatically as you do in iloveimg.com.</p>
<p>Register now to get 500 free uses and start working with iLoveIMG plugin now!</p>
<p>Register now to get 2500 free credits uses and start working with iLoveIMG plugin now!</p>
</div>
<?php endif ?>

Expand Down
2 changes: 1 addition & 1 deletion admin/views/watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="iloveimg_settings__info">
<h3>The power of iLoveIMG in your WordPress!</h3>
<p>Compress all your Media image files and Stamp other Images or text into your WordPress pictures. This is the Official iLoveIMG plugin for WordPress. You can optimize all your Images and stamp them automatically as you do in iloveimg.com.</p>
<p>Register now to get 500 free uses and start working with iLoveIMG plugin now!</p>
<p>Register now to get 2500 free credits uses and start working with iLoveIMG plugin now!</p>
</div>
<?php endif; ?>

Expand Down
10 changes: 5 additions & 5 deletions ilove-img-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*
* @wordpress-plugin
* Plugin Name: Best Watermark - Protect images on your site with iLoveIMG
* Plugin URI: https://developer.iloveimg.com/
* Plugin URI: https://iloveapi.com/
* Description: Protect your site from image theft with our reliable and easy-to-use watermark plugin. Effective protection for your images.
* Version: 2.1.0
* Version: 2.2.0
* Requires at least: 5.3
* Requires PHP: 7.4
* Author: iLoveIMG
Expand All @@ -38,9 +38,9 @@

$ilove_img_wm_upload_path = wp_upload_dir();

define( 'ILOVE_IMG_WM_REGISTER_URL', 'https://api.iloveimg.com/v1/user' );
define( 'ILOVE_IMG_WM_LOGIN_URL', 'https://api.iloveimg.com/v1/user/login' );
define( 'ILOVE_IMG_WM_USER_URL', 'https://api.iloveimg.com/v1/user' );
define( 'ILOVE_IMG_WM_REGISTER_URL', 'https://api.ilovepdf.com/v1/user' );
define( 'ILOVE_IMG_WM_LOGIN_URL', 'https://api.ilovepdf.com/v1/user/login' );
define( 'ILOVE_IMG_WM_USER_URL', 'https://api.ilovepdf.com/v1/user' );
define( 'ILOVE_IMG_WM_NUM_MAX_FILES', 2 );
define( 'ILOVE_IMG_WM_COMPRESS_DB_VERSION', '1.0' );
define( 'ILOVE_IMG_WM_UPLOAD_FOLDER', $ilove_img_wm_upload_path['basedir'] );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"gulp-sass": "^5.1.0",
"gulp-uglify": "^3.0.2",
"merge-stream": "^2.0.0",
"sass": "^1.77.2"
"sass": "^1.77.8"
}
}
Loading
Loading