Skip to content

Commit

Permalink
Merge pull request #31 from ilovepdf/develop
Browse files Browse the repository at this point in the history
V2.1.1
  • Loading branch information
diegocrombie authored May 14, 2024
2 parents b04beab + c465fc2 commit 48862d9
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 81 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.0
Version: 2.1.1
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.2
Stable tag: 2.1.0
Tested up to: 6.5.3
Stable tag: 2.1.1
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.0
Version: 2.1.1
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.2
Stable tag: 2.1.0
Tested up to: 6.5.3
Stable tag: 2.1.1
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.1 ==
Improved
* Update Libraries.

Fixed
* Fixed an issue when activating the plugin for the first time. Default settings now load correctly.
* Library was included internally. This will improve file loading and possible CDN blocking in some countries.

== 2.1.0 ==
Added
* New Backup option added in General Settings. Now the backup works for all tools.
Expand Down
4 changes: 2 additions & 2 deletions admin/Ilove_Pdf_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public function enqueue_scripts() {
global $pagenow;

if ( ( 'upload.php' === $pagenow || 'options-general.php' === $pagenow || 'media-new.php' === $pagenow || 'post.php' === $pagenow ) && get_current_screen()->post_type !== 'product' ) {
wp_enqueue_script( 'ilove-pdf-admin', plugins_url( '/assets/js/main.min.js', __DIR__ ), array( 'wp-color-picker', 'sweetalert-ilovepdf' ), '1.0.0', true );
wp_enqueue_script( 'sweetalert-ilovepdf', 'https://cdn.jsdelivr.net/npm/sweetalert2@11', array(), '11.10', true );
wp_enqueue_script( 'ilove-pdf-admin', plugins_url( '/assets/js/main.min.js', __DIR__ ), array( 'wp-color-picker', 'sweetalert-js-ilovepdf' ), '1.0.0', true );
wp_enqueue_script( 'sweetalert-js-ilovepdf', plugins_url( '/assets/js/sweetalert2.all.min.js', __DIR__ ), array(), '11.11.0', true );
}
}

Expand Down
6 changes: 6 additions & 0 deletions assets/js/sweetalert2.all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ilove-pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: iLovePDF
* Plugin URI: https://developer.ilovepdf.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.0
* Version: 2.1.1
* Requires at least: 5.3
* Requires PHP: 7.4
* Author: ILovePDF
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.0';
$this->version = 'wp.2.1.1';

$this->load_dependencies();
$this->set_locale();
Expand Down
75 changes: 58 additions & 17 deletions includes/Ilove_Pdf_Activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ public static function activate() {
$initial_pdf_size = ilove_pdf_get_all_pdf_current_size();
add_option( 'ilovepdf_initial_pdf_files_size', $initial_pdf_size );

if ( get_option( 'ilovepdf_wordpress_id' ) === null ) {
if ( get_option( 'ilovepdf_wordpress_id' ) === false ) {
add_option( 'ilovepdf_wordpress_id', md5( get_option( 'siteurl' ) . get_option( 'admin_email' ) ) );
}

self::set_default_values_watermark_settings();
self::set_default_values_compress_settings();
self::set_default_values_general_settings();
}

Expand All @@ -69,37 +70,51 @@ public static function activate() {
*/
public static function set_default_values_watermark_settings() {

$get_options = get_option( 'ilove_pdf_display_settings_format_watermark' );
$get_format_options = get_option( 'ilove_pdf_display_settings_format_watermark' );
$get_gral_options = get_option( 'ilove_pdf_display_settings_watermark' );

if ( ! is_array( $get_options ) ) {
$get_options = array();
if ( ! is_array( $get_format_options ) ) {
$get_format_options = array();
}

if ( ! is_array( $get_gral_options ) ) {
$get_gral_options = array();
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_vertical'] ) ) {
$get_options['ilove_pdf_format_watermark_vertical'] = '2';
if ( ! isset( $get_gral_options['ilove_pdf_watermark_active'] ) ) {
$get_gral_options['ilove_pdf_watermark_active'] = 1;
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_horizontal'] ) ) {
$get_options['ilove_pdf_format_watermark_horizontal'] = '2';
if ( ! isset( $get_format_options['ilove_pdf_format_watermark_mode'] ) ) {
$get_format_options['ilove_pdf_format_watermark_mode'] = 0;
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_text'] ) ) {
$get_options['ilove_pdf_format_watermark_text'] = get_bloginfo();
if ( ! isset( $get_format_options['ilove_pdf_format_watermark_vertical'] ) ) {
$get_format_options['ilove_pdf_format_watermark_vertical'] = '2';
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_text_size'] ) ) {
$get_options['ilove_pdf_format_watermark_text_size'] = '22';
if ( ! isset( $get_format_options['ilove_pdf_format_watermark_horizontal'] ) ) {
$get_format_options['ilove_pdf_format_watermark_horizontal'] = '2';
}

if ( ! isset( $get_format_options['ilove_pdf_format_watermark_text'] ) ) {
$get_format_options['ilove_pdf_format_watermark_text'] = get_bloginfo();
}

if ( ! isset( $get_format_options['ilove_pdf_format_watermark_text_size'] ) ) {
$get_format_options['ilove_pdf_format_watermark_text_size'] = '22';
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_font_family'] ) ) {
$get_options['ilove_pdf_format_watermark_font_family'] = 'Verdana';
if ( ! isset( $get_format_options['ilove_pdf_format_watermark_font_family'] ) ) {
$get_format_options['ilove_pdf_format_watermark_font_family'] = 'Verdana';
}

if ( ! isset( $get_options['ilove_pdf_format_watermark_text_color'] ) ) {
$get_options['ilove_pdf_format_watermark_text_color'] = '#dd3333';
if ( ! isset( $get_format_options['ilove_pdf_format_watermark_text_color'] ) ) {
$get_format_options['ilove_pdf_format_watermark_text_color'] = '#dd3333';
}

update_option( 'ilove_pdf_display_settings_format_watermark', $get_options );
update_option( 'ilove_pdf_display_settings_format_watermark', $get_format_options );
update_option( 'ilove_pdf_display_settings_watermark', $get_gral_options );
}

/**
Expand All @@ -123,4 +138,30 @@ public static function set_default_values_general_settings() {

update_option( 'ilove_pdf_display_general_settings', $get_options );
}

/**
* Compress Settings Value.
*
* Set default values.
*
* @since 2.1.1
*/
public static function set_default_values_compress_settings() {

$get_options = get_option( 'ilove_pdf_display_settings_compress' );

if ( ! is_array( $get_options ) ) {
$get_options = array();
}

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

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

update_option( 'ilove_pdf_display_settings_compress', $get_options );
}
}
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.75.0"
"sass": "^1.77.1"
}
}
60 changes: 30 additions & 30 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,17 @@
},
{
"name": "php-stubs/wordpress-stubs",
"version": "v6.5.2",
"version_normalized": "6.5.2.0",
"version": "v6.5.3",
"version_normalized": "6.5.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-stubs/wordpress-stubs.git",
"reference": "379f17a90c01498d4c99a0d15aab6e7aa6a2c840"
"reference": "e611a83292d02055a25f83291a98fadd0c21e092"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/379f17a90c01498d4c99a0d15aab6e7aa6a2c840",
"reference": "379f17a90c01498d4c99a0d15aab6e7aa6a2c840",
"url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/e611a83292d02055a25f83291a98fadd0c21e092",
"reference": "e611a83292d02055a25f83291a98fadd0c21e092",
"shasum": ""
},
"require-dev": {
Expand All @@ -481,7 +481,7 @@
"symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan"
},
"time": "2024-04-14T17:30:14+00:00",
"time": "2024-05-08T02:12:31+00:00",
"type": "library",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
Expand All @@ -497,7 +497,7 @@
],
"support": {
"issues": "https://github.com/php-stubs/wordpress-stubs/issues",
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.5.2"
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.5.3"
},
"install-path": "../php-stubs/wordpress-stubs"
},
Expand Down Expand Up @@ -550,17 +550,17 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.67",
"version_normalized": "1.10.67.0",
"version": "1.11.0",
"version_normalized": "1.11.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493"
"reference": "666cb1703742cea9cc80fee631f0940e1592fa6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493",
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/666cb1703742cea9cc80fee631f0940e1592fa6e",
"reference": "666cb1703742cea9cc80fee631f0940e1592fa6e",
"shasum": ""
},
"require": {
Expand All @@ -569,7 +569,7 @@
"conflict": {
"phpstan/phpstan-shim": "*"
},
"time": "2024-04-16T07:22:02+00:00",
"time": "2024-05-13T06:02:22+00:00",
"bin": [
"phpstan",
"phpstan.phar"
Expand Down Expand Up @@ -666,24 +666,24 @@
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2023-04-10T20:10:41+00:00",
"time": "2024-04-15T12:06:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
Expand All @@ -706,7 +706,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
Expand All @@ -718,7 +718,7 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
"source": "https://github.com/php-fig/http-factory"
},
"install-path": "../psr/http-factory"
},
Expand Down Expand Up @@ -827,27 +827,27 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.4.0",
"version_normalized": "3.4.0.0",
"version": "v3.5.0",
"version_normalized": "3.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf"
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2023-05-23T14:45:45+00:00",
"time": "2024-04-18T09:32:20+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.4-dev"
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down Expand Up @@ -877,7 +877,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
},
"funding": [
{
Expand Down
Loading

0 comments on commit 48862d9

Please sign in to comment.