Skip to content

Commit

Permalink
Merge pull request #32 from ilovepdf/feature/v2.1.2
Browse files Browse the repository at this point in the history
Feature/v2.1.2
  • Loading branch information
teamcrombie authored Jul 10, 2024
2 parents c465fc2 + ebb6511 commit bfbd2c3
Show file tree
Hide file tree
Showing 23 changed files with 253 additions and 116 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
=== PDF Compressor & Watermark - iLovePDF ===
Plugin Name: Image Compressor & Optimizer - iLovePDF
Version: 2.1.1
Version: 2.1.2
Author: iLovePDF
Author URI: https://www.ilovepdf.com/
Contributors: iLovePDF
Tags: compress, watermark, optimize, performance, pdf optimizer
Requires at least: 5.3
Tested up to: 6.5.3
Stable tag: 2.1.1
Tested up to: 6.5.5
Stable tag: 2.1.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
14 changes: 11 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
=== PDF Compressor & Watermark - iLovePDF ===
Plugin Name: Image Compressor & Optimizer - iLovePDF
Version: 2.1.1
Version: 2.1.2
Author: iLovePDF
Author URI: https://www.ilovepdf.com/
Contributors: iLovePDF
Tags: compress, watermark, optimize, performance, pdf optimizer
Requires at least: 5.3
Tested up to: 6.5.3
Stable tag: 2.1.1
Tested up to: 6.5.5
Stable tag: 2.1.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -82,6 +82,14 @@ We will send you an email before limit is reached. When limit is reached, no mor

== Changelog ==

== 2.1.2 ==
Improved
* Update Libraries.
* Now IlovePDF will use credits to process the files.

Fixed
* A problem was solved with the option to create backup, where in some cases the option was not stored in the database.

== 2.1.1 ==
Improved
* Update Libraries.
Expand Down
2 changes: 1 addition & 1 deletion admin/functions-compress.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ilove_pdf_compress_pdf( $id_file, $auto = false, $bulk = false ) {
} else {
try {
// you can call task class directly
// to get your key pair, please visit https://developer.ilovepdf.com/user/projects
// to get your key pair, please visit https://iloveapi.com/user/projects
$my_task = new CompressTask( get_option( 'ilovepdf_user_public_key', true ), get_option( 'ilovepdf_user_private_key', true ) );

// file var keeps info about server file id, name...
Expand Down
2 changes: 1 addition & 1 deletion admin/functions-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ilove_pdf_watermark_pdf( $id_file, $auto = false, $bulk = false ) {

try {
// you can call task class directly
// to get your key pair, please visit https://developer.ilovepdf.com/user/projects
// to get your key pair, please visit https://iloveapi.com/user/projects
$my_task = new WatermarkTask( get_option( 'ilovepdf_user_public_key', true ), get_option( 'ilovepdf_user_private_key', true ) );

// file var keeps info about server file id, name...
Expand Down
2 changes: 1 addition & 1 deletion admin/general-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function ilove_pdf_popup_buymore_action() {
</g>
<polygon fill="#FFFFFF" points="93.946,33.938 93.946,6.254 121.63,33.938 "></polygon>
</g>
</svg><div><a href="https://developer.ilovepdf.com/pricing" target="_blank" class="button button-primary">' . esc_html( __( 'Accept', 'ilove-pdf' ) ) . '</a> <a href="#" onClick="tb_remove();" class="button button-primary">' . esc_html( __( 'Cancel', 'ilove-pdf' ) ) . '</a></div></div></div>';
</svg><div><a href="https://iloveapi.com/pricing" target="_blank" class="button button-primary">' . esc_html( __( 'Accept', 'ilove-pdf' ) ) . '</a> <a href="#" onClick="tb_remove();" class="button button-primary">' . esc_html( __( 'Cancel', 'ilove-pdf' ) ) . '</a></div></div></div>';
}
add_action( 'admin_footer', 'ilove_pdf_popup_buymore_action' );

Expand Down
12 changes: 6 additions & 6 deletions admin/partials/ilove-pdf-settings-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ function ilove_pdf_content_page_setting() {
</div>
<div class="col-md-8">
<div class="panel" style="margin-left: 10px;">
<h3><?php esc_html_e( 'Available files to process', 'ilove-pdf' ); ?></h3>
<h3><?php esc_html_e( 'Credits available to process files', 'ilove-pdf' ); ?></h3>
<div class="progress">
<div class="progress__text"><?php esc_html_e( 'Free', 'ilove-pdf' ); ?></div>
<div class="progress__total">
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $stats['files_used'], $stats['free_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo esc_html( ( $stats['files_used'] < $stats['free_files_limit'] ) ? $stats['files_used'] : 250 ); ?> / <?php echo esc_html( $stats['free_files_limit'] ); ?> <?php esc_html_e( 'processed files this month. Free Tier.', 'ilove-pdf' ); ?></div>
<div class="progress__total_text"><?php echo esc_html( ( $stats['files_used'] < $stats['free_files_limit'] ) ? $stats['files_used'] : 250 ); ?> / <?php echo esc_html( $stats['free_files_limit'] ); ?> <?php esc_html_e( 'credits used this month. Free Tier.', 'ilove-pdf' ); ?></div>
</div>
</div>
<?php if ( $stats['subscription_files_limit'] ) : ?>
Expand All @@ -78,7 +78,7 @@ function ilove_pdf_content_page_setting() {
$paid_files = ( $stats['files_used'] < $stats['free_files_limit'] ) ? 0 : $stats['files_used'] - $stats['free_files_limit'];
?>
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $paid_files, $stats['subscription_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo (int) $paid_files; ?> / <?php echo (int) $stats['subscription_files_limit']; ?> <?php echo wp_kses( ( 'yearly' === $stats['subscription']['period'] ) ? __( 'processed files this month. <strong>Yearly</strong> subscription.', 'ilove-pdf' ) : __( 'processed files this month. <strong>Monthly</strong> subscription.', 'ilove-pdf' ), 'ilove_pdf_expanded_alowed_tags' ); ?></div>
<div class="progress__total_text"><?php echo (int) $paid_files; ?> / <?php echo (int) $stats['subscription_files_limit']; ?> <?php echo wp_kses( ( 'yearly' === $stats['subscription']['period'] ) ? __( 'credits used this month. <strong>Yearly</strong> subscription.', 'ilove-pdf' ) : __( 'credits used this month. <strong>Monthly</strong> subscription.', 'ilove-pdf' ), 'ilove_pdf_expanded_alowed_tags' ); ?></div>
</div>
</div>
<?php endif; ?>
Expand All @@ -87,12 +87,12 @@ function ilove_pdf_content_page_setting() {
<div class="progress__text"><?php esc_html_e( 'Prepaid', 'ilove-pdf' ); ?></div>
<div class="progress__total">
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $stats['package_files_used'], $stats['package_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo esc_html( $stats['package_files_used'] ); ?> / <?php echo esc_html( $stats['package_files_limit'] ); ?> <?php esc_html_e( 'processed files. Prepaid files.', 'ilove-pdf' ); ?></div>
<div class="progress__total_text"><?php echo esc_html( $stats['package_files_used'] ); ?> / <?php echo esc_html( $stats['package_files_limit'] ); ?> <?php esc_html_e( 'credits used. Prepaid credits.', 'ilove-pdf' ); ?></div>
</div>
</div>
<?php endif; ?>
<a href="https://developer.ilovepdf.com/user/account" target="_blank" class="link"><?php esc_html_e( 'Account info', 'ilove-pdf' ); ?> (<?php echo esc_html( get_option( 'ilovepdf_user_email' ) ); ?>) &raquo;</a>
<a href="https://developer.ilovepdf.com/pricing" target="_blank" class="button button-primary"><?php esc_html_e( 'Buy more files', 'ilove-pdf' ); ?></a>
<a href="https://iloveapi.com/login" target="_blank" class="link"><?php esc_html_e( 'Account info', 'ilove-pdf' ); ?> (<?php echo esc_html( get_option( 'ilovepdf_user_email' ) ); ?>) &raquo;</a>
<a href="https://iloveapi.com/pricing" target="_blank" class="button button-primary"><?php esc_html_e( 'Buy more credits', 'ilove-pdf' ); ?></a>
</div>
<div class="panel" style="margin-left: 10px;">
<h3><?php esc_html_e( 'Account', 'ilove-pdf' ); ?></h3>
Expand Down
12 changes: 6 additions & 6 deletions admin/partials/ilove-pdf-statistics-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ function ilove_pdf_content_page_statistics() {
<div class="container no-center">
<div class="row">
<div class="col-md-6 panel">
<h3><?php esc_html_e( 'Available files to process', 'ilove-pdf' ); ?></h3>
<h3><?php esc_html_e( 'Credits available to process files', 'ilove-pdf' ); ?></h3>
<div class="progress">
<div class="progress__text"><?php esc_html_e( 'Free', 'ilove-pdf' ); ?></div>
<div class="progress__total">
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $stats['files_used'], $stats['free_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo esc_html( ( $stats['files_used'] < $stats['free_files_limit'] ) ? $stats['files_used'] : 250 ); ?> / <?php echo esc_html( $stats['free_files_limit'] ); ?> <?php esc_html_e( 'processed files this month. Free Tier.', 'ilove-pdf' ); ?></div>
<div class="progress__total_text"><?php echo esc_html( ( $stats['files_used'] < $stats['free_files_limit'] ) ? $stats['files_used'] : 250 ); ?> / <?php echo esc_html( $stats['free_files_limit'] ); ?> <?php esc_html_e( 'credits used this month. Free Tier.', 'ilove-pdf' ); ?></div>
</div>
</div>
<?php if ( $stats['subscription_files_limit'] ) : ?>
Expand All @@ -60,7 +60,7 @@ function ilove_pdf_content_page_statistics() {
$paid_files = ( $stats['files_used'] < $stats['free_files_limit'] ) ? 0 : $stats['files_used'] - $stats['free_files_limit'];
?>
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $paid_files, $stats['subscription_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo (int) $paid_files; ?> / <?php echo (int) $stats['subscription_files_limit']; ?> <?php echo wp_kses( ( 'yearly' === $stats['subscription']['period'] ) ? __( 'processed files this month. <strong>Yearly</strong> subscription.', 'ilove-pdf' ) : __( 'processed files this month. <strong>Monthly</strong> subscription.', 'ilove-pdf' ), 'ilove_pdf_expanded_alowed_tags' ); ?></div>
<div class="progress__total_text"><?php echo (int) $paid_files; ?> / <?php echo (int) $stats['subscription_files_limit']; ?> <?php echo wp_kses( ( 'yearly' === $stats['subscription']['period'] ) ? __( 'credits used this month. <strong>Yearly</strong> subscription.', 'ilove-pdf' ) : __( 'credits used this month. <strong>Monthly</strong> subscription.', 'ilove-pdf' ), 'ilove_pdf_expanded_alowed_tags' ); ?></div>
</div>
</div>
<?php endif; ?>
Expand All @@ -69,12 +69,12 @@ function ilove_pdf_content_page_statistics() {
<div class="progress__text"><?php esc_html_e( 'Prepaid', 'ilove-pdf' ); ?></div>
<div class="progress__total">
<div class="progress__total__percent" style="width: <?php echo esc_html( ilove_pdf_get_percentage( $stats['package_files_used'], $stats['package_files_limit'] ) ); ?>%;"></div>
<div class="progress__total_text"><?php echo esc_html( $stats['package_files_used'] ); ?> / <?php echo esc_html( $stats['package_files_limit'] ); ?> <?php esc_html_e( 'processed files. Prepaid files.', 'ilove-pdf' ); ?></div>
<div class="progress__total_text"><?php echo esc_html( $stats['package_files_used'] ); ?> / <?php echo esc_html( $stats['package_files_limit'] ); ?> <?php esc_html_e( 'credits used. Prepaid credits.', 'ilove-pdf' ); ?></div>
</div>
</div>
<?php endif; ?>
<a href="https://developer.ilovepdf.com/user/account" class="link" target="_blank"><?php esc_html_e( 'Account info', 'ilove-pdf' ); ?> (<?php echo esc_attr( get_option( 'ilovepdf_user_email' ) ); ?>) &raquo;</a>
<a href="https://developer.ilovepdf.com/pricing" target="_blank" class="button button-primary"><?php esc_html_e( 'Buy more files', 'ilove-pdf' ); ?></a>
<a href="https://iloveapi.com/user/account" class="link" target="_blank"><?php esc_html_e( 'Account info', 'ilove-pdf' ); ?> (<?php echo esc_attr( get_option( 'ilovepdf_user_email' ) ); ?>) &raquo;</a>
<a href="https://iloveapi.com/pricing" target="_blank" class="button button-primary"><?php esc_html_e( 'Buy more credits', 'ilove-pdf' ); ?></a>
</div>
<div class="col-md-5 col-md-offset-1 panel panel-margin-left">
<h3>Tools</h3>
Expand Down
39 changes: 37 additions & 2 deletions ilove-pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*
* @wordpress-plugin
* Plugin Name: iLovePDF
* Plugin URI: https://developer.ilovepdf.com/
* Plugin URI: https://iloveapi.com/
* Description: Compress your PDF files and Stamp Images or text into PDF files. This is the Official iLovePDF plugin for WordPress. You can optimize all your PDF and stamp them automatically as you do in ilovepdf.com.
* Version: 2.1.1
* Version: 2.1.2
* Requires at least: 5.3
* Requires PHP: 7.4
* Author: ILovePDF
Expand Down Expand Up @@ -52,6 +52,41 @@ function ilove_pdf_activate() {
}
register_activation_hook( __FILE__, 'ilove_pdf_activate' );

/**
* Plugin update.
*
* Fires when the upgrader process is complete.
*
* @since 2.1.2
*
* @param object $upgrader_object Reference to the plugin upgrader object.
* @param array $options {
* Array of plugin update options.
*
* @type string $action Type of action. Default 'update'.
* @type string $type Type of plugin being updated. Default 'plugin'.
* @type string $slug Slug of the plugin being updated. Default ''.
* }
*/
function ilove_pdf_upgrade_plugin( $upgrader_object, $options ) {
if ( 'update' === $options['action'] && 'plugin' === $options['type'] ) {
foreach ( $options['plugins'] as $each_plugin ) {
if ( ILOVE_PDF_PLUGIN_NAME === $each_plugin ) {

$get_options = get_option( 'ilove_pdf_display_general_settings', array() );

if ( ! isset( $get_options['ilove_pdf_general_backup'] ) ) {
$get_options['ilove_pdf_general_backup'] = 1;
}

update_option( 'ilove_pdf_display_general_settings', $get_options );

}
}
}
}
add_action( 'upgrader_process_complete', 'ilove_pdf_upgrade_plugin', 10, 2 );

/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-ilove-pdf-deactivator.php
Expand Down
2 changes: 1 addition & 1 deletion includes/Ilove_Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Ilove_Pdf {
public function __construct() {

$this->plugin_name = 'ilove-pdf';
$this->version = 'wp.2.1.1';
$this->version = 'wp.2.1.2';

$this->load_dependencies();
$this->set_locale();
Expand Down
6 changes: 1 addition & 5 deletions includes/Ilove_Pdf_Activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ public static function set_default_values_watermark_settings() {
*/
public static function set_default_values_general_settings() {

$get_options = get_option( 'ilove_pdf_display_general_settings' );

if ( ! is_array( $get_options ) ) {
$get_options = array();
}
$get_options = get_option( 'ilove_pdf_display_general_settings', array() );

if ( ! isset( $get_options['ilove_pdf_general_backup'] ) ) {
$get_options['ilove_pdf_general_backup'] = 1;
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.1"
"sass": "^1.77.7"
}
}
Loading

0 comments on commit bfbd2c3

Please sign in to comment.