Skip to content

Commit

Permalink
Merge pull request #41 from ilovepdf/develop
Browse files Browse the repository at this point in the history
v2.1.6
  • Loading branch information
teamcrombie authored Jan 10, 2025
2 parents b91ebaf + e2c2362 commit 9548a34
Show file tree
Hide file tree
Showing 23 changed files with 153 additions and 383 deletions.
9 changes: 7 additions & 2 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.5
Version: 2.1.6
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.7
Stable tag: 2.1.5
Stable tag: 2.1.6
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -81,6 +81,11 @@ We will send you an email before limit is reached. When limit is reached, no mor

== Changelog ==

= 2.1.6 =
Improved
* Update Libraries.
* Improved multisite support.

= 2.1.5 =
Improved
* Update Libraries.
Expand Down
4 changes: 2 additions & 2 deletions assets/js/main.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions ilove-pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );

}
}
Expand Down
49 changes: 29 additions & 20 deletions 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.5';
$this->version = 'wp.2.1.6';

$this->load_dependencies();
$this->set_locale();
Expand Down Expand Up @@ -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 );
}
}

/**
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ parameters:
excludePaths:
analyseAndScan:
- vendor
- node_modules
- node_modules?
analyse:
- vendor/ilovepdf
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit634bd29bd263e33ce5cb3f59c562e5cc::getLoader();
return ComposerAutoloaderInit52f8510a30b66ec23034f2df95e5df31::getLoader();
11 changes: 7 additions & 4 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ private static function getInstalled()
}

$installed = array();
$copiedLocalDir = false;

if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
Expand All @@ -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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $required;
$copiedLocalDir = true;
}
}
}
Expand All @@ -350,7 +353,7 @@ private static function getInstalled()
}
}

if (self::$installed !== array()) {
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}

Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit634bd29bd263e33ce5cb3f59c562e5cc
class ComposerAutoloaderInit52f8510a30b66ec23034f2df95e5df31
{
private static $loader;

Expand All @@ -22,16 +22,16 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit634bd29bd263e33ce5cb3f59c562e5cc', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit52f8510a30b66ec23034f2df95e5df31', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit634bd29bd263e33ce5cb3f59c562e5cc', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit52f8510a30b66ec23034f2df95e5df31', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit52f8510a30b66ec23034f2df95e5df31::getInitializer($loader));

$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit52f8510a30b66ec23034f2df95e5df31::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc
class ComposerStaticInit52f8510a30b66ec23034f2df95e5df31
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
Expand Down Expand Up @@ -83,9 +83,9 @@ class ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit634bd29bd263e33ce5cb3f59c562e5cc::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit52f8510a30b66ec23034f2df95e5df31::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit52f8510a30b66ec23034f2df95e5df31::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit52f8510a30b66ec23034f2df95e5df31::$classMap;

}, null, ClassLoader::class);
}
Expand Down
Loading

0 comments on commit 9548a34

Please sign in to comment.