`;n(".btn-restore").on("click",function(e){var i=n(this);e.preventDefault(),n(this).parent().append(c);const t=document.getElementById("ilovepdf-restore-dialog");var e=document.getElementById("ilovepdf-dialog-aceptted"),s=document.getElementById("ilovepdf-dialog-close");t.showModal(),e.addEventListener("click",e=>{e.preventDefault(),t.close(),n(this).hide(),n(this).prev().hide(),n(this).nextAll(".loading").show(),n(this).parent().prevAll(".row-compress-tool").hide(),n(this).parent().prevAll(".row-watermark-tool").hide(),n.post(n(this).prop("href")+"&ajax=1",function(e){var t;i.nextAll(".loading").hide(),(""===e?i.nextAll(".success"):((t=document.createElement("div")).innerHTML=e,i.nextAll(".error").html(t.innerText))).show()})}),s.addEventListener("click",e=>{e.preventDefault(),t.close()})}),n(".ilovepdf--meta-box-container .link-restore, .compat-field-iLovePDF-tools .link-restore").on("click",function(e){const t=n(this)[0].href,i=(e.preventDefault(),n(".ilovepdf--meta-box-container").append(c),document.getElementById("ilovepdf-restore-dialog"));var e=document.getElementById("ilovepdf-dialog-aceptted"),s=document.getElementById("ilovepdf-dialog-close");i.showModal(),e.addEventListener("click",e=>{e.preventDefault(),i.close(),location.href=t}),s.addEventListener("click",e=>{e.preventDefault(),i.close()})})}(jQuery);
\ No newline at end of file
+ `;n(".btn-restore").on("click",function(e){var i=n(this);e.preventDefault(),n(this).parent().append(c);let t=document.getElementById("ilovepdf-restore-dialog");var e=document.getElementById("ilovepdf-dialog-aceptted"),s=document.getElementById("ilovepdf-dialog-close");t.showModal(),e.addEventListener("click",e=>{e.preventDefault(),t.close(),n(this).hide(),n(this).prev().hide(),n(this).nextAll(".loading").show(),n(this).parent().prevAll(".row-compress-tool").hide(),n(this).parent().prevAll(".row-watermark-tool").hide(),n.post(n(this).prop("href")+"&ajax=1",function(e){var t;i.nextAll(".loading").hide(),(""===e?i.nextAll(".success"):((t=document.createElement("div")).innerHTML=e,i.nextAll(".error").html(t.innerText))).show()})}),s.addEventListener("click",e=>{e.preventDefault(),t.close()})}),n(".ilovepdf--meta-box-container .link-restore, .compat-field-iLovePDF-tools .link-restore").on("click",function(e){let t=n(this),i=t[0].href,s=(e.preventDefault(),n(".ilovepdf--meta-box-container").append(c),document.getElementById("ilovepdf-restore-dialog"));var e=document.getElementById("ilovepdf-dialog-aceptted"),r=document.getElementById("ilovepdf-dialog-close");s.showModal(),e.addEventListener("click",e=>{e.preventDefault(),s.close(),location.href=i}),r.addEventListener("click",e=>{e.preventDefault(),s.close()})})})(jQuery);
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 65714aa..ef01b50 100644
--- a/composer.json
+++ b/composer.json
@@ -15,8 +15,8 @@
"ilovepdf/ilovepdf-php": "^1.2"
},
"require-dev": {
- "phpstan/phpstan": "^1.12",
- "szepeviktor/phpstan-wordpress": "^1.3",
+ "phpstan/phpstan": "^2.1",
+ "szepeviktor/phpstan-wordpress": "^2.0",
"phpstan/extension-installer": "^1.4",
"wp-coding-standards/wpcs": "^3.0"
},
diff --git a/ilove-pdf.php b/ilove-pdf.php
index fddc6e0..57d93d0 100644
--- a/ilove-pdf.php
+++ b/ilove-pdf.php
@@ -10,7 +10,7 @@
* Plugin Name: iLovePDF
* 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.5
+ * Version: 2.1.6
* Requires at least: 5.3
* Requires PHP: 7.4
* Author: ILovePDF
@@ -74,7 +74,7 @@ function ilove_pdf_upgrade_plugin( $upgrader_object, $options ) {
$get_options['ilove_pdf_general_backup'] = 1;
}
- Ilove_Pdf::update_option( 'ilove_pdf_display_general_settings', $get_options );
+ Ilove_Pdf::update_option( 'ilove_pdf_display_general_settings', $get_options, true );
}
}
diff --git a/includes/Ilove_Pdf.php b/includes/Ilove_Pdf.php
index 56dfd4a..46cba9e 100644
--- a/includes/Ilove_Pdf.php
+++ b/includes/Ilove_Pdf.php
@@ -74,7 +74,7 @@ class Ilove_Pdf {
public function __construct() {
$this->plugin_name = 'ilove-pdf';
- $this->version = 'wp.2.1.5';
+ $this->version = 'wp.2.1.6';
$this->load_dependencies();
$this->set_locale();
@@ -179,37 +179,31 @@ public function get_version() {
return $this->version;
}
- /**
- * Determines whether Multisite is enabled.
- *
- * @since 2.1.5
- * @return bool True if Multisite is enabled, false otherwise.
- */
- public static function is_multisite() {
- return is_multisite();
- }
-
/**
* Update option, works with multisite if enabled
*
* @since 2.1.5
* @param string $option Name of the option to update. Expected to not be SQL-escaped.
* @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
+ * @param bool $update_all_sites Optional. Whether to update all sites in the network.
* @param bool|null $autoload Optional. Whether to load the option when WordPress starts up. Accepts a boolean, or null.
*/
- public static function update_option( $option, $value, $autoload = null ) {
+ public static function update_option( $option, $value, $update_all_sites = false, $autoload = null ) {
- if ( ! self::is_multisite() ) {
+ if ( ! is_multisite() ) {
update_option( $option, $value, $autoload );
return;
}
- $sites = get_sites();
- foreach ( $sites as $site ) {
- switch_to_blog( (int) $site->blog_id );
- update_option( $option, $value, $autoload );
- restore_current_blog();
- }
+ if ( ! $update_all_sites ) {
+ self::switch_update_blog( get_current_blog_id(), $option, $value, $autoload );
+ return;
+ }
+
+ $sites = get_sites();
+ foreach ( $sites as $site ) {
+ self::switch_update_blog( (int) $site->blog_id, $option, $value, $autoload );
+ }
}
/**
@@ -224,7 +218,7 @@ public static function create_dir( $directories ) {
$directories = array( $directories );
}
- if ( ! self::is_multisite() ) {
+ if ( ! is_multisite() ) {
foreach ( $directories as $directory ) {
$upload_dir = wp_upload_dir();
$directory = $upload_dir['basedir'] . $directory;
@@ -252,4 +246,19 @@ public static function create_dir( $directories ) {
restore_current_blog();
}
}
+
+ /**
+ * Switch to blog and update option
+ *
+ * @since 2.1.6
+ * @param int $blog_id ID of the blog to switch to.
+ * @param string $option Name of the option to update.
+ * @param mixed $value Option value.
+ * @param bool|null $autoload Whether to load the option when WordPress starts up.
+ */
+ private static function switch_update_blog( $blog_id, $option, $value, $autoload ) {
+ switch_to_blog( $blog_id );
+ update_option( $option, $value, $autoload );
+ restore_current_blog();
+ }
}
diff --git a/package.json b/package.json
index a95cf2f..5bb90a0 100644
--- a/package.json
+++ b/package.json
@@ -13,9 +13,9 @@
"gulp-autoprefixer": "^9.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-rename": "^2.0.0",
- "gulp-sass": "^5.1.0",
+ "gulp-sass": "^6.0.0",
"gulp-uglify": "^3.0.2",
"merge-stream": "^2.0.0",
- "sass": "^1.80"
+ "sass": "^1.83"
}
}
diff --git a/phpstan.neon b/phpstan.neon
index 00b3825..0935c56 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -8,6 +8,6 @@ parameters:
excludePaths:
analyseAndScan:
- vendor
- - node_modules
+ - node_modules?
analyse:
- vendor/ilovepdf
\ No newline at end of file
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 47d3c3f..5c7da03 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -22,4 +22,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit634bd29bd263e33ce5cb3f59c562e5cc::getLoader();
+return ComposerAutoloaderInit52f8510a30b66ec23034f2df95e5df31::getLoader();
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php
index 51e734a..07b32ed 100644
--- a/vendor/composer/InstalledVersions.php
+++ b/vendor/composer/InstalledVersions.php
@@ -322,6 +322,7 @@ private static function getInstalled()
}
$installed = array();
+ $copiedLocalDir = false;
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
@@ -330,9 +331,11 @@ private static function getInstalled()
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array