rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions

View File

@@ -1,6 +0,0 @@
# Security Policy
## Reporting Security Bugs
Please report security bugs found in the site-reviews plugin's source code through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/imagify). The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin.
---

View File

@@ -1125,15 +1125,4 @@ window.imagify = window.imagify || {};
w.imagify.bulk.init();
if (imagifyBulk.isOverQuota) {
w.imagify.bulk.displayError( {
title: imagifyBulk.labels.overQuotaTitle,
html: $( '#tmpl-imagify-overquota-alert' ).html(),
type: 'info',
customClass: 'imagify-swal-has-subtitle imagify-swal-error-header',
showConfirmButton: false
} );
}
} )(jQuery, document, window);

File diff suppressed because one or more lines are too long

View File

@@ -413,14 +413,13 @@ class Bulk {
*
* @since 1.9
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
* @return string
*/
public function get_context( $method = 'GET', $parameter = 'context' ) {
$context = 'POST' === $method ? wp_unslash( $_POST[ $parameter ] ) : wp_unslash( $_GET[ $parameter ] ); //phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$context = htmlspecialchars( $context );
$method = 'POST' === $method ? INPUT_POST : INPUT_GET;
$context = filter_input( $method, $parameter, FILTER_SANITIZE_STRING );
return imagify_sanitize_context( $context );
}
@@ -558,7 +557,7 @@ class Bulk {
public function bulk_get_stats_callback() {
imagify_check_nonce( 'imagify-bulk-optimize' );
$folder_types = filter_input( INPUT_GET, 'types', FILTER_REQUIRE_ARRAY );
$folder_types = filter_input( INPUT_GET, 'types', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
$folder_types = is_array( $folder_types ) ? array_filter( $folder_types, 'is_string' ) : [];
if ( ! $folder_types ) {

View File

@@ -95,7 +95,6 @@ class CustomFolders extends AbstractBulk {
$files_table = Imagify_Files_DB::get_instance()->get_table_name();
$folders_table = Imagify_Folders_DB::get_instance()->get_table_name();
$mime_types = Imagify_DB::get_mime_types( 'image' );
$mime_types = str_replace( ",'image/webp'", '', $mime_types );
$webp_suffix = constant( imagify_get_optimization_process_class_name( 'custom-folders' ) . '::WEBP_SUFFIX' );
$files = $wpdb->get_results( $wpdb->prepare( // WPCS: unprepared SQL ok.
"

View File

@@ -184,7 +184,6 @@ class WP extends AbstractBulk {
$this->set_no_time_limit();
$mime_types = Imagify_DB::get_mime_types( 'image' );
$mime_types = str_replace( ",'image/webp'", '', $mime_types );
$statuses = Imagify_DB::get_post_statuses();
$nodata_join = Imagify_DB::get_required_wp_metadata_join_clause();
$nodata_where = Imagify_DB::get_required_wp_metadata_where_clause( [

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Imagify\Notices;
use Imagify\Traits\InstanceGetterTrait;
use Imagify\User\User;
/**
* Class that handles the admin notices.
@@ -468,7 +467,7 @@ class Notices {
return $display;
}
$user = new User();
$user = new \Imagify_User();
// Don't display the notice if the user's unconsumed quota is superior to 20%.
if ( $user->get_percent_unconsumed_quota() > 20 ) {

View File

@@ -1,266 +0,0 @@
<?php
namespace Imagify\User;
use Date;
use Imagify_Data;
use WP_Error;
/**
* Imagify User class.
*
* @since 1.0
*/
class User {
/**
* The Imagify user ID.
*
* @since 1.0
*
* @var string
*/
public $id;
/**
* The user email.
*
* @since 1.0
*
* @var string
*/
public $email;
/**
* The plan ID.
*
* @since 1.0
*
* @var int
*/
public $plan_id;
/**
* The plan label.
*
* @since 1.2
*
* @var string
*/
public $plan_label;
/**
* The total quota.
*
* @since 1.0
*
* @var int
*/
public $quota;
/**
* The total extra quota (Imagify Pack).
*
* @since 1.0
*
* @var int
*/
public $extra_quota;
/**
* The extra quota consumed.
*
* @since 1.0
*
* @var int
*/
public $extra_quota_consumed;
/**
* The current month consumed quota.
*
* @since 1.0
*
* @var int
*/
public $consumed_current_month_quota;
/**
* The next month date to credit the account.
*
* @since 1.1.1
*
* @var Date
*/
public $next_date_update;
/**
* If the account is activate or not.
*
* @since 1.0.1
*
* @var bool
*/
public $is_active;
/**
* Store a \WP_Error object if the request to fetch the user data failed.
* False overwise.
*
* @var bool|WP_Error
* @since 1.9.9
*/
private $error;
/**
* The constructor.
*
* @since 1.0
*
* @return void
*/
public function __construct() {
$user = get_imagify_user();
if ( is_wp_error( $user ) ) {
$this->error = $user;
return;
}
$this->id = $user->id;
$this->email = $user->email;
$this->plan_id = (int) $user->plan_id;
$this->plan_label = ucfirst( $user->plan_label );
$this->quota = $user->quota;
$this->extra_quota = $user->extra_quota;
$this->extra_quota_consumed = $user->extra_quota_consumed;
$this->consumed_current_month_quota = $user->consumed_current_month_quota;
$this->next_date_update = $user->next_date_update;
$this->is_active = $user->is_active;
$this->error = false;
}
/**
* Get the possible error returned when fetching user data.
*
* @return bool|WP_Error A \WP_Error object if the request to fetch the user data failed. False overwise.
* @since 1.9.9
*/
public function get_error() {
return $this->error;
}
/**
* Percentage of consumed quota, including extra quota.
*
* @since 1.0
*
* @return float|int
*/
public function get_percent_consumed_quota() {
static $done = false;
if ( $this->get_error() ) {
return 0;
}
$quota = $this->quota;
$consumed_quota = $this->consumed_current_month_quota;
if ( imagify_round_half_five( $this->extra_quota_consumed ) < $this->extra_quota ) {
$quota += $this->extra_quota;
$consumed_quota += $this->extra_quota_consumed;
}
if ( ! $quota || ! $consumed_quota ) {
$percent = 0;
} else {
$percent = 100 * $consumed_quota / $quota;
$percent = round( $percent, 1 );
$percent = min( max( 0, $percent ), 100 );
}
$percent = (float) $percent;
if ( $done ) {
return $percent;
}
$previous_percent = Imagify_Data::get_instance()->get( 'previous_quota_percent' );
// Percent is not 100% anymore.
if ( 100.0 === (float) $previous_percent && $percent < 100 ) {
/**
* Triggered when the consumed quota percent decreases below 100%.
*
* @since 1.7
* @author Grégory Viguier
*
* @param float|int $percent The current percentage of consumed quota.
*/
do_action( 'imagify_not_over_quota_anymore', $percent );
}
// Percent is not >= 80% anymore.
if ( ( (float) $previous_percent >= 80.0 && $percent < 80 ) ) {
/**
* Triggered when the consumed quota percent decreases below 80%.
*
* @since 1.7
* @author Grégory Viguier
*
* @param float|int $percent The current percentage of consumed quota.
* @param float|int $previous_percent The previous percentage of consumed quota.
*/
do_action( 'imagify_not_almost_over_quota_anymore', $percent, $previous_percent );
}
if ( (float) $previous_percent !== (float) $percent ) {
Imagify_Data::get_instance()->set( 'previous_quota_percent', $percent );
}
$done = true;
return $percent;
}
/**
* Count percent of unconsumed quota.
*
* @since 1.0
*
* @return float|int
*/
public function get_percent_unconsumed_quota() {
return 100 - $this->get_percent_consumed_quota();
}
/**
* Check if the user has a free account.
*
* @since 1.1.1
*
* @return bool
*/
public function is_free() {
return 1 === $this->plan_id;
}
/**
* Check if the user has consumed all his/her quota.
*
* @since 1.1.1
* @since 1.9.9 Return false if the request to fetch the user data failed.
*
* @return bool
*/
public function is_over_quota() {
if ( $this->get_error() ) {
return false;
}
return (
$this->is_free()
&&
floatval( 100 ) === round( $this->get_percent_consumed_quota() )
);
}
}

View File

@@ -3,7 +3,6 @@ namespace Imagify\Webp\RewriteRules;
use Imagify\Notices\Notices;
use Imagify\Traits\InstanceGetterTrait;
use Imagify\WriteFile\AbstractWriteDirConfFile;
/**
* Display WebP images on the site with rewrite rules.
@@ -13,13 +12,6 @@ use Imagify\WriteFile\AbstractWriteDirConfFile;
class Display {
use InstanceGetterTrait;
/**
* Configuration file writer.
*
* @var AbstractWriteDirConfFile
*/
protected $server_conf;
/**
* Option value.
*

View File

@@ -3,7 +3,7 @@
* Plugin Name: Imagify
* Plugin URI: https://wordpress.org/plugins/imagify/
* Description: Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
* Version: 2.1.2
* Version: 2.1.1
* Requires at least: 5.3
* Requires PHP: 7.0
* Author: Imagify Optimize Images & Convert WebP
@@ -13,13 +13,13 @@
* Text Domain: imagify
* Domain Path: languages
*
* Copyright 2023 WP Media
* Copyright 2022 WP Media
*/
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
// Imagify defines.
define( 'IMAGIFY_VERSION', '2.1.2' );
define( 'IMAGIFY_VERSION', '2.1.1' );
define( 'IMAGIFY_SLUG', 'imagify' );
define( 'IMAGIFY_FILE', __FILE__ );
define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );

View File

@@ -123,9 +123,7 @@ function _imagify_sort_attachments_by_status( $vars ) {
),
) );
if ( ! key_exists( 'post_mime_type', $vars ) ) {
$vars['post_mime_type'] = imagify_get_mime_types();
}
$vars['post_mime_type'] = imagify_get_mime_types();
return $vars;
}

View File

@@ -18,13 +18,6 @@ abstract class Imagify_Abstract_Background_Process extends Imagify_WP_Background
*/
protected $prefix = 'imagify';
/**
* URL to query on.
*
* @var string
*/
protected $query_url = '';
/**
* Set to true to automatically displatch at the end of the page.
*

View File

@@ -1,7 +1,6 @@
<?php
use Imagify\Traits\InstanceGetterTrait;
use Imagify\User\User;
/**
* Class that handles admin ajax/post callbacks.
@@ -221,13 +220,13 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
$process = imagify_get_optimization_process( $media_id, $context );
if ( ! $process->is_valid() ) {
return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) );
}
$data = $process->get_data();
if ( ! $data->is_already_optimized() ) {
return new WP_Error( 'not_already_optimized', __( 'This media does not have the right optimization status.', 'imagify' ) );
return new \WP_Error( 'not_already_optimized', __( 'This media does not have the right optimization status.', 'imagify' ) );
}
if ( ! $process->has_webp() ) {
@@ -238,7 +237,7 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
$deleted = $process->delete_webp_files();
if ( is_wp_error( $deleted ) ) {
return new WP_Error( 'webp_not_deleted', __( 'Previous WebP files could not be deleted.', 'imagify' ) );
return new \WP_Error( 'webp_not_deleted', __( 'Previous WebP files could not be deleted.', 'imagify' ) );
}
return true;
@@ -842,7 +841,7 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
imagify_die();
}
$user = new User();
$user = new Imagify_User();
$views = Imagify_Views::get_instance();
$unconsumed_quota = $views->get_quota_percent();
$message = '';
@@ -1149,7 +1148,7 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
imagify_die();
}
$notice = htmlspecialchars( wp_unslash( $_GET['ad'] ) );
$notice = filter_input( INPUT_GET, 'ad', FILTER_SANITIZE_STRING );
if ( ! $notice ) {
imagify_maybe_redirect();
@@ -1216,8 +1215,8 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
* @return string
*/
public function get_context( $method = 'GET', $parameter = 'context' ) {
$context = 'POST' === $method ? wp_unslash( $_POST[ $parameter ] ) : wp_unslash( $_GET[ $parameter ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$context = htmlspecialchars( $context );
$method = 'POST' === $method ? INPUT_POST : INPUT_GET;
$context = filter_input( $method, $parameter, FILTER_SANITIZE_STRING );
return imagify_sanitize_context( $context );
}
@@ -1247,15 +1246,14 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
*
* @since 1.9
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
* @return string
*/
public function get_folder_type( $method = 'GET', $parameter = 'folder_type' ) {
$folder_type = 'POST' === $method ? wp_unslash( $_POST[ $parameter ] ) : wp_unslash( $_GET[ $parameter ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$method = 'POST' === $method ? INPUT_POST : INPUT_GET;
return htmlspecialchars( $folder_type );
return filter_input( $method, $parameter, FILTER_SANITIZE_STRING );
}
/**
@@ -1263,14 +1261,13 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
*
* @since 1.9
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
*
* @param string $method The method used: 'GET' (default), or 'POST'.
* @param string $parameter The name of the parameter to look for.
* @return string
*/
public function get_imagify_action( $method = 'GET', $parameter = 'imagify_action' ) {
$action = 'POST' === $method ? wp_unslash( $_POST[ $parameter ] ) : wp_unslash( $_GET[ $parameter ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$action = htmlspecialchars( $action );
$method = 'POST' === $method ? INPUT_POST : INPUT_GET;
$action = filter_input( $method, $parameter, FILTER_SANITIZE_STRING );
return $action ? $action : 'optimize';
}

View File

@@ -4,54 +4,62 @@ defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
* Class that display the "custom folders" files.
*
* @since 1.7
* @package Imagify
* @since 1.7
* @author Grégory Viguier
*/
class Imagify_Files_List_Table extends WP_List_Table {
/**
* Class version.
*
* @var string
* @var string
* @since 1.7
* @author Grégory Viguier
*/
const VERSION = '1.1';
/**
* Class version.
*
* @var string
* @var string
* @since 1.7
* @author Grégory Viguier
*/
const PER_PAGE_OPTION = 'imagify_files_per_page';
/**
* List of the folders containing the listed files.
*
* @var array
* @since 1.7
* @var array
* @since 1.7
* @author Grégory Viguier
*/
protected $folders = array();
/**
* Filesystem object.
*
* @var Imagify_Filesystem
* @since 1.7.1
* @var object Imagify_Filesystem
* @since 1.7.1
* @author Grégory Viguier
*/
protected $filesystem;
/**
* Views object.
*
* @var Imagify_Views
* @since 1.9
* @var object Imagify_Views
* @since 1.9
* @author Grégory Viguier
*/
protected $views;
/**
* Constructor.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param array $args An associative array of arguments.
*/
@@ -72,7 +80,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prepares the list of items for displaying.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*/
public function prepare_items() {
global $wpdb;
@@ -99,8 +108,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
$file_ids = array();
$where = '';
$sent_orderby = isset( $_GET['orderby'] ) ? htmlspecialchars( wp_unslash( $_GET['orderby'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$sent_order = isset( $_GET['order'] ) ? htmlspecialchars( wp_unslash( $_GET['order'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$sent_orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
$sent_order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING );
$folder_filter = self::get_folder_filter();
$status_filter = self::get_status_filter();
@@ -218,7 +227,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Message to be displayed when there are no items.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*/
public function no_items() {
if ( self::get_status_filter() ) {
@@ -285,7 +295,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Display views.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*/
public function views() {
global $wpdb;
@@ -401,7 +412,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return array
*/
@@ -415,7 +427,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
* Get a list of columns. The format is:
* 'internal-name' => 'Title'
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return array
*/
@@ -439,7 +452,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
*
* The second format will make the initial sorting order be descending.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return array
*/
@@ -455,7 +469,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get a column contents.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param string $column The column "name": "cb", "title", "optimization_level", etc.
* @param object $item The current item. It must contain at least a $process property.
@@ -474,7 +489,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the checkbox column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -489,7 +505,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the title column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -538,7 +555,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the parent folder column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -572,7 +590,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the optimization data column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -623,7 +642,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the status column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -657,7 +677,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the optimization level column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -672,7 +693,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Handles the actions column output.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -708,7 +730,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to optimize the file.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -735,7 +758,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to retry to optimize the file.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -765,7 +789,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints buttons to re-optimize the file to other levels.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -808,7 +833,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to generate WebP versions if they are missing.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -823,7 +849,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to delete WebP versions when the status is "already_optimized".
*
* @since 1.9.6
* @since 1.9.6
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -838,7 +865,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to restore the file.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -860,7 +888,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button to check if the file has been modified or not.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -876,7 +905,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Prints a button for the comparison tool (before / after optimization).
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
*/
@@ -922,7 +952,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
* Add the folder_id and folder_path properties to the $item if not set yet.
* It may happen if the $item doesn't come from the prepare() method.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param object $item The current item. It must contain at least a $process property.
* @return object The current item.
@@ -957,7 +988,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get the name of the default primary column.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return string Name of the default primary column, in this case, 'title'.
*/
@@ -968,7 +1000,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get a list of CSS classes for the WP_List_Table table tag.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return array List of CSS classes for the table tag.
*/
@@ -979,7 +1012,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Allow to save the screen options when submitted by the user.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @param bool|int $status Screen option value. Default false to skip.
* @param string $option The option name.
@@ -997,7 +1031,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get the requested folder filter.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return string
*/
@@ -1015,7 +1050,8 @@ class Imagify_Files_List_Table extends WP_List_Table {
/**
* Get the requested status filter.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*
* @return string
*/
@@ -1031,7 +1067,7 @@ class Imagify_Files_List_Table extends WP_List_Table {
'unoptimized' => 1,
'errors' => 1,
);
$filter = isset( $_GET['status-filter'] ) ? trim( htmlspecialchars( wp_unslash( $_GET['status-filter'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$filter = trim( filter_input( INPUT_GET, 'status-filter', FILTER_SANITIZE_STRING ) );
$filter = isset( $values[ $filter ] ) ? $filter : '';
return $filter;

View File

@@ -1,7 +1,4 @@
<?php
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
@@ -306,7 +303,7 @@ class Imagify_Requirements {
return self::$supports['over_quota'];
}
$user = new User();
$user = new Imagify_User();
self::$supports['over_quota'] = $user->get_error() ? false : $user->is_over_quota();

View File

@@ -131,13 +131,10 @@ class Imagify_Settings {
* @return bool
*/
public function is_form_submit() {
if ( ! isset( $_POST['option_page'], $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
return false;
}
return htmlspecialchars( wp_unslash( $_POST['option_page'] ) ) === $this->settings_group && htmlspecialchars( wp_unslash( $_POST['action'] ) ) === 'update'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
return filter_input( INPUT_POST, 'option_page', FILTER_SANITIZE_STRING ) === $this->settings_group && filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) === 'update';
}
/** ----------------------------------------------------------------------------------------- */
/** ON FORM SUBMIT ========================================================================== */
/** ----------------------------------------------------------------------------------------- */

View File

@@ -1,10 +1,9 @@
<?php
/**
* Deprecated class that handles Imagify User class.
* Imagify User class.
*
* @since 1.0
* @deprecated
*/
class Imagify_User {
/**
@@ -154,6 +153,7 @@ class Imagify_User {
*/
public function get_percent_consumed_quota() {
static $done = false;
if ( $this->get_error() ) {
return 0;
}
@@ -176,15 +176,12 @@ class Imagify_User {
$percent = (float) $percent;
$percent = 100;
if ( $done ) {
return $percent;
}
$previous_percent = Imagify_Data::get_instance()->get( 'previous_quota_percent' );
// Percent is not 100% anymore.
if ( 100.0 === (float) $previous_percent && $percent < 100 ) {
/**

View File

@@ -1,20 +1,18 @@
<?php
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
* Class that handles templates and menus.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
*/
class Imagify_Views {
/**
* Class version.
*
* @var string
* @var string
* @since 1.7
*/
const VERSION = '1.1';
@@ -22,56 +20,64 @@ class Imagify_Views {
/**
* Slug used for the settings page URL.
*
* @var string
* @since 1.7
* @var string
* @since 1.7
* @access protected
*/
protected $slug_settings;
/**
* Slug used for the bulk optimization page URL.
*
* @var string
* @since 1.7
* @var string
* @since 1.7
* @access protected
*/
protected $slug_bulk;
/**
* Slug used for the "custom folders" page URL.
*
* @var string
* @since 1.7
* @var string
* @since 1.7
* @access protected
*/
protected $slug_files;
/**
* A list of JS templates to print at the end of the page.
*
* @var array
* @since 1.9
* @var array
* @since 1.9
* @access protected
*/
protected $templates_in_footer = [];
/**
* Stores the "custom folders" files list instance.
*
* @var Imagify_Files_List_Table
* @since 1.7
* @var object Imagify_Files_List_Table
* @since 1.7
* @access protected
*/
protected $list_table;
/**
* Filesystem object.
*
* @var Imagify_Filesystem
* @since 1.7.1
* @var object Imagify_Filesystem
* @since 1.7.1
* @access protected
* @author Grégory Viguier
*/
protected $filesystem;
/**
* The single instance of the class.
*
* @var object
* @since 1.7
* @var object
* @since 1.7
* @access protected
*/
protected static $_instance;
@@ -83,7 +89,9 @@ class Imagify_Views {
/**
* The constructor.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access protected
*/
protected function __construct() {
$this->slug_settings = IMAGIFY_SLUG;
@@ -95,7 +103,9 @@ class Imagify_Views {
/**
* Get the main Instance.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @return object Main instance.
*/
@@ -110,7 +120,9 @@ class Imagify_Views {
/**
* Launch the hooks.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function init() {
// Menu items.
@@ -140,7 +152,9 @@ class Imagify_Views {
/**
* Add sub-menus for all sites.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function add_site_menus() {
$wp_context = imagify_get_context( 'wp' );
@@ -173,7 +187,9 @@ class Imagify_Views {
/**
* Add menu and sub-menus in the network admin when Imagify is network-activated.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function add_network_menus() {
global $submenu;
@@ -216,7 +232,9 @@ class Imagify_Views {
/**
* Add links to the plugin row in the plugins list.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @param array $actions An array of action links.
* @return array
@@ -236,7 +254,9 @@ class Imagify_Views {
/**
* The main settings page.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function display_settings_page() {
$this->print_template( 'page-settings' );
@@ -245,7 +265,9 @@ class Imagify_Views {
/**
* The bulk optimization page.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function display_bulk_page() {
$types = array();
@@ -341,7 +363,9 @@ class Imagify_Views {
/**
* The page displaying the "custom folders" files.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function display_files_list() {
$this->print_template( 'page-files-list' );
@@ -350,7 +374,9 @@ class Imagify_Views {
/**
* Initiate the "custom folders" list table data.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*/
public function load_files_list() {
// Instantiate the list.
@@ -370,7 +396,9 @@ class Imagify_Views {
/**
* Get the settings page slug.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @return string
*/
@@ -381,7 +409,9 @@ class Imagify_Views {
/**
* Get the bulk optimization page slug.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @return string
*/
@@ -392,7 +422,9 @@ class Imagify_Views {
/**
* Get the "custom folders" files page slug.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @return string
*/
@@ -408,14 +440,16 @@ class Imagify_Views {
/**
* Tell if were displaying the settings page.
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*
* @return bool
*/
public function is_settings_page() {
global $pagenow;
$page = htmlspecialchars( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
if ( $this->get_settings_page_slug() !== $page ) {
return false;
@@ -431,14 +465,16 @@ class Imagify_Views {
/**
* Tell if were displaying the bulk optimization page.
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*
* @return bool
*/
public function is_bulk_page() {
global $pagenow;
$page = htmlspecialchars( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
return 'upload.php' === $pagenow && $this->get_bulk_page_slug() === $page;
}
@@ -446,14 +482,16 @@ class Imagify_Views {
/**
* Tell if were displaying the custom files list page.
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*
* @return bool
*/
public function is_files_page() {
global $pagenow;
$page = htmlspecialchars( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
return 'upload.php' === $pagenow && $this->get_files_page_slug() === $page;
}
@@ -461,20 +499,26 @@ class Imagify_Views {
/**
* Tell if were displaying the WP media library page.
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*
* @return bool
*/
public function is_wp_library_page() {
global $pagenow;
return 'upload.php' === $pagenow && ! isset( $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
return 'upload.php' === $pagenow && ! $page;
}
/**
* Tell if were displaying a media page.
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*
* @return bool
*/
@@ -492,7 +536,9 @@ class Imagify_Views {
/**
* Get the remaining quota in percent.
*
* @since 1.8.1
* @since 1.8.1
* @author Grégory Viguier
* @access public
*
* @return int
*/
@@ -503,7 +549,7 @@ class Imagify_Views {
return $quota;
}
$user = new User();
$user = new Imagify_User();
$quota = $user->get_percent_unconsumed_quota();
return $quota;
@@ -512,7 +558,9 @@ class Imagify_Views {
/**
* Get the HTML class used for the quota (to change the color when out of quota for example).
*
* @since 1.8.1
* @since 1.8.1
* @author Grégory Viguier
* @access public
*
* @return string
*/
@@ -540,7 +588,9 @@ class Imagify_Views {
/**
* Get the HTML tag used for the quota (the weather-like icon).
*
* @since 1.8.1
* @since 1.8.1
* @author Grégory Viguier
* @access public
*
* @return string
*/
@@ -572,7 +622,9 @@ class Imagify_Views {
/**
* Get a template contents.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @param string $template The template name.
* @param mixed $data Some data to pass to the template.
@@ -596,7 +648,9 @@ class Imagify_Views {
/**
* Print a template.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @param string $template The template name.
* @param mixed $data Some data to pass to the template.
@@ -608,7 +662,9 @@ class Imagify_Views {
/**
* Add a template to the list of JS templates to print at the end of the page.
*
* @since 1.7
* @since 1.7
* @author Grégory Viguier
* @access public
*
* @param string $template The template name.
*/
@@ -635,7 +691,9 @@ class Imagify_Views {
/**
* Print the JS templates that have been added to the "queue".
*
* @since 1.9
* @since 1.9
* @author Grégory Viguier
* @access public
*/
public function print_js_templates() {
if ( ! $this->templates_in_footer ) {
@@ -659,7 +717,9 @@ class Imagify_Views {
/**
* Create HTML attributes from an array.
*
* @since 1.9
* @since 1.9
* @access public
* @author Grégory Viguier
*
* @param array $attributes A list of attribute pairs.
* @return string HTML attributes.

View File

@@ -1,7 +1,4 @@
<?php
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
if ( class_exists( 'C_NextGEN_Bootstrap' ) && class_exists( 'Mixin' ) && get_site_option( 'ngg_options' ) ) :
@@ -63,7 +60,7 @@ if ( class_exists( 'C_NextGEN_Bootstrap' ) && class_exists( 'Mixin' ) && get_sit
add_filter( 'imagify_count_saving_data', 'imagify_ngg_count_saving_data', 8 );
$saving_data = imagify_count_saving_data();
$user = new User();
$user = new Imagify_User();
$response['imagify_bulk_data'] = array(
// User account.

View File

@@ -1,6 +1,5 @@
<?php
use Imagify\Notices\Notices;
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
@@ -401,7 +400,7 @@ function imagify_cache_user() {
return false;
}
$user = new User();
$user = new Imagify_User();
$data = (object) get_object_vars( $user );
$methods = get_class_methods( $user );

View File

@@ -1,8 +1,8 @@
=== Imagify Optimize Images & Convert WebP | Compress Images Easily ===
Contributors: wp_rocket, imagify
Tags: optimize images, convert webp, webp, image optimization, compress images, image compressor, resize images, reduce image size, performance, image optimizer, core web vitals, best image optimization plugin
Tested up to: 6.3
Stable tag: 2.1.2
Tested up to: 6.1
Stable tag: 2.1.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -243,10 +243,6 @@ Yes, and no credit card is required.
No. However, you get 20MB of quota per month for free to optimize your images (around 200 images).
= Where do I report security bugs found in this plugin? =
You can report any security bugs found in the source code of the site-reviews plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/imagify). The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin.
== Screenshots ==
1. Bulk Optimization
@@ -258,13 +254,6 @@ You can report any security bugs found in the source code of the site-reviews pl
4. Other Media Page
== Changelog ==
= 2.1.2 =
- Bugfix: Prevent deprecation notice with PHP 8.1 & 8.2 (#721, #723)
- Bugfix: Escape error message before display (#729)
- Bugfix: Don't count WebP images in the generate missing WebP images versions (#713)
- Bugfix: Improve information related to out of quota on bulk optimization (#714)
- Bugfix: Fix optimization filter type working with file filters on media library (#670)
= 2.1.1 =
- Enhancement: Allow WebP images to be optimized by Imagify from the plugin (#611)
- Enhancement: Improve error message displayed when an unknown error occured (#637)

View File

@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit799f24bb49776382616b035efaf242fe::getLoader();
return ComposerAutoloaderInit4ba6376c0ffc3020053ab8c93bad1e1e::getLoader();

View File

@@ -45,34 +45,35 @@ class ClassLoader
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
@@ -80,7 +81,8 @@ class ClassLoader
private $useIncludePath = false;
/**
* @var array<string, string>
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
@@ -88,20 +90,21 @@ class ClassLoader
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
/** @var ?string */
private $apcuPrefix;
/**
* @var array<string, self>
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
@@ -110,7 +113,7 @@ class ClassLoader
}
/**
* @return array<string, list<string>>
* @return string[]
*/
public function getPrefixes()
{
@@ -122,7 +125,8 @@ class ClassLoader
}
/**
* @return array<string, list<string>>
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
@@ -130,7 +134,8 @@ class ClassLoader
}
/**
* @return list<string>
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
@@ -138,7 +143,8 @@ class ClassLoader
}
/**
* @return list<string>
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
@@ -146,7 +152,8 @@ class ClassLoader
}
/**
* @return array<string, string> Array of classname => path
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap()
{
@@ -154,7 +161,8 @@ class ClassLoader
}
/**
* @param array<string, string> $classMap Class to filename map
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
*/
@@ -171,25 +179,24 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
(array) $paths
);
}
@@ -198,19 +205,19 @@ class ClassLoader
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
(array) $paths
);
}
}
@@ -219,9 +226,9 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
@@ -229,18 +236,17 @@ class ClassLoader
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@@ -250,18 +256,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
(array) $paths
);
}
}
@@ -270,8 +276,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/
@@ -288,8 +294,8 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
@@ -423,8 +429,7 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
(self::$includeFile)($file);
return true;
}
@@ -475,9 +480,9 @@ class ClassLoader
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return array<string, self>
* @return self[]
*/
public static function getRegisteredLoaders()
{
@@ -555,10 +560,7 @@ class ClassLoader
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
private static function initializeIncludeClosure(): void
{
if (self::$includeFile !== null) {
return;
@@ -572,8 +574,8 @@ class ClassLoader
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
self::$includeFile = static function($file) {
include $file;
}, null, null);
};
}
}

View File

@@ -98,7 +98,7 @@ class InstalledVersions
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
@@ -119,7 +119,7 @@ class InstalledVersions
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
@@ -328,9 +328,7 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} 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;
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
@@ -342,17 +340,12 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @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 __DIR__ . '/installed.php';
self::$installed = $required;
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
$installed[] = self::$installed;
return $installed;
}

View File

@@ -46,7 +46,7 @@ return array(
'Imagify_Regenerate_Thumbnails_Deprecated' => $baseDir . '/inc/deprecated/classes/class-imagify-regenerate-thumbnails-deprecated.php',
'Imagify_Requirements' => $baseDir . '/inc/classes/class-imagify-requirements.php',
'Imagify_Settings' => $baseDir . '/inc/classes/class-imagify-settings.php',
'Imagify_User' => $baseDir . '/inc/deprecated/classes/class-imagify-user.php',
'Imagify_User' => $baseDir . '/inc/classes/class-imagify-user.php',
'Imagify_Views' => $baseDir . '/inc/classes/class-imagify-views.php',
'Imagify_WP_Async_Request' => $baseDir . '/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-async-request.php',
'Imagify_WP_Background_Process' => $baseDir . '/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-background-process.php',

View File

@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit799f24bb49776382616b035efaf242fe
class ComposerAutoloaderInit4ba6376c0ffc3020053ab8c93bad1e1e
{
private static $loader;
@@ -24,12 +24,12 @@ class ComposerAutoloaderInit799f24bb49776382616b035efaf242fe
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit799f24bb49776382616b035efaf242fe', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit4ba6376c0ffc3020053ab8c93bad1e1e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit799f24bb49776382616b035efaf242fe', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit4ba6376c0ffc3020053ab8c93bad1e1e', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit799f24bb49776382616b035efaf242fe::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit4ba6376c0ffc3020053ab8c93bad1e1e::getInitializer($loader));
$loader->register(true);

View File

@@ -7,7 +7,7 @@ namespace Composer\Autoload;
use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
class ComposerStaticInit799f24bb49776382616b035efaf242fe
class ComposerStaticInit4ba6376c0ffc3020053ab8c93bad1e1e
{
public static $prefixLengthsPsr4 = array (
'I' =>
@@ -115,7 +115,7 @@ class ComposerStaticInit799f24bb49776382616b035efaf242fe
'Imagify_Regenerate_Thumbnails_Deprecated' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-regenerate-thumbnails-deprecated.php',
'Imagify_Requirements' => __DIR__ . '/../..' . '/inc/classes/class-imagify-requirements.php',
'Imagify_Settings' => __DIR__ . '/../..' . '/inc/classes/class-imagify-settings.php',
'Imagify_User' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-user.php',
'Imagify_User' => __DIR__ . '/../..' . '/inc/classes/class-imagify-user.php',
'Imagify_Views' => __DIR__ . '/../..' . '/inc/classes/class-imagify-views.php',
'Imagify_WP_Async_Request' => __DIR__ . '/../..' . '/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-async-request.php',
'Imagify_WP_Background_Process' => __DIR__ . '/../..' . '/inc/classes/Dependencies/deliciousbrains/wp-background-processing/classes/wp-background-process.php',
@@ -124,9 +124,9 @@ class ComposerStaticInit799f24bb49776382616b035efaf242fe
public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit799f24bb49776382616b035efaf242fe::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit799f24bb49776382616b035efaf242fe::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit799f24bb49776382616b035efaf242fe::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit4ba6376c0ffc3020053ab8c93bad1e1e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4ba6376c0ffc3020053ab8c93bad1e1e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4ba6376c0ffc3020053ab8c93bad1e1e::$classMap;
}, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
}

View File

@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'wp-media/imagify-plugin',
'pretty_version' => 'v2.1.2',
'version' => '2.1.2.0',
'reference' => '41c64f2a6a85049272b4a32dc1dbb6e68ab37182',
'pretty_version' => 'v2.1.1',
'version' => '2.1.1.0',
'reference' => '46f9df25cc18fe7a8609d1a94bec039e169282da',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -29,9 +29,9 @@
'dev_requirement' => false,
),
'wp-media/imagify-plugin' => array(
'pretty_version' => 'v2.1.2',
'version' => '2.1.2.0',
'reference' => '41c64f2a6a85049272b4a32dc1dbb6e68ab37182',
'pretty_version' => 'v2.1.1',
'version' => '2.1.1.0',
'reference' => '46f9df25cc18fe7a8609d1a94bec039e169282da',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

View File

@@ -15,7 +15,7 @@ foreach ( $notices as $type => $type_notices ) {
?>
<div class="<?php echo $type; ?> settings-error notice is-dismissible">
<?php foreach ( $type_notices as $details ) { ?>
<p><strong><?php echo wp_kses( $details['message'], [ 'code' => [] ] ); ?></strong></p>
<p><strong><?php echo $details['message']; ?></strong></p>
<?php } ?>
</div>
<?php

View File

@@ -1,7 +1,4 @@
<?php
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
?>
<div class="wrap imagify-settings imagify-bulk">
@@ -89,7 +86,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
<?php
if ( ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT ) && Imagify_Requirements::is_api_key_valid() ) {
$user = new User();
$user = new Imagify_User();
?>
<div class="imagify-options-title">
<div class="imagify-th-titles imagify-flex imagify-vcenter">

View File

@@ -1,7 +1,4 @@
<?php
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
@@ -33,7 +30,7 @@ if ( Imagify_Requirements::is_api_key_valid() ) {
<div class="imagify-settings-section">
<?php
$imagify_user = new User();
$imagify_user = new Imagify_User();
if (
$imagify_user->is_free()