PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 3.23.4
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v3.23.4
4.1.0 4.0.3 4.0.2 2.8.1 2.9.1 3.0.0 3.0.1 3.0.2 3.1.1 3.10.1 3.10.2 3.10.3 3.11.1 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.13.1 3.13.2 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.2 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.18.0 3.18.1 3.2.0.1 3.2.1 3.2.2.1 3.2.4 3.20.0 3.21.1 3.22.1 3.22.3 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.24.0 3.24.0-beta.2 3.3.0 3.3.1 3.3.2 3.4.1 3.4.2 3.6.1 3.6.3 3.7.0 3.7.1 3.7.2 3.7.3 3.8.2 3.8.3 3.8.4 3.8.5 3.8.7 3.8.8 3.9.0 3.9.1 3.9.11 3.9.2 3.9.4 3.9.5 3.9.8 3.9.9 trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.5.3 1.6.5.4 1.7 1.7.1 1.7.1.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.6.2 2.0.6.3 2.0.6.5 2.0.7 2.0.7.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.3 2.3.1 2.4 2.4.2 2.4.3 2.4.4 2.4.5 2.5.2 2.5.3 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.4 2.7.4.1 2.7.5 2.7.6 2.7.8 2.7.8.1 2.7.9.1 2.8.0 2.8.0.1
wp-smushit / core / class-core.php
wp-smushit / core Last commit date
api 3 months ago backups 3 months ago cache 3 months ago cli 3 months ago directory 3 months ago external 3 months ago integrations 3 months ago lazy-load 3 months ago media 3 months ago media-library 3 months ago membership 3 months ago modules 3 months ago parser 3 months ago photon 3 months ago resize 3 months ago security 3 months ago smush 3 months ago srcset 3 months ago stats 3 months ago threads 3 months ago transform 3 months ago class-animated-status-controller.php 3 months ago class-array-utils.php 3 months ago class-attachment-id-list.php 3 months ago class-backup-size.php 3 months ago class-configs.php 3 months ago class-controller.php 3 months ago class-core.php 3 months ago class-cron-controller.php 3 months ago class-deprecated-hooks.php 3 months ago class-error-handler.php 3 months ago class-file-system.php 3 months ago class-file-utils.php 3 months ago class-format-utils.php 3 months ago class-helper.php 3 months ago class-hub-connector.php 3 months ago class-installer.php 3 months ago class-keyword-exclusions.php 3 months ago class-modules.php 3 months ago class-optimization-controller.php 3 months ago class-plugin-settings-watcher.php 3 months ago class-product-analytics.php 3 months ago class-rest.php 3 months ago class-server-utils.php 3 months ago class-settings.php 3 months ago class-shim.php 3 months ago class-smush-file.php 3 months ago class-stats.php 3 months ago class-time-utils.php 3 months ago class-timer.php 3 months ago class-upload-dir.php 3 months ago class-url-utils.php 3 months ago class-wp-query-utils.php 3 months ago wp-compat.php 3 months ago
class-core.php
613 lines
1 <?php
2 /**
3 * Core class: Core class.
4 *
5 * @since 2.9.0
6 * @package Smush\Core
7 */
8
9 namespace Smush\Core;
10
11 use Smush\App\Admin;
12 use Smush\Core\Modules\Helpers\WhiteLabel;
13 use WP_Smush;
14
15 if ( ! defined( 'WPINC' ) ) {
16 die;
17 }
18
19 /**
20 * Class Core
21 */
22 class Core extends Stats {
23
24 /**
25 * Animated status.
26 *
27 * @var int
28 */
29 private static $status_animated = 2;
30
31 /**
32 * S3 module
33 *
34 * @var Integrations\S3
35 */
36 public $s3;
37
38 /**
39 * NextGen module.
40 *
41 * @var Integrations\Nextgen
42 */
43 public $nextgen;
44
45 /**
46 * Modules array.
47 *
48 * @var Modules
49 */
50 public $mod;
51
52 /**
53 * Allowed mime types of image.
54 *
55 * @var array $mime_types
56 */
57 public static $mime_types = array(
58 'image/jpg',
59 'image/jpeg',
60 'image/x-citrix-jpeg',
61 'image/gif',
62 'image/png',
63 'image/x-png',
64 );
65
66 /**
67 * List of external pages where smush needs to be loaded.
68 *
69 * @var array $pages
70 */
71 public static $external_pages = array(
72 'nggallery-manage-images',
73 'gallery_page_nggallery-manage-gallery',
74 'gallery_page_wp-smush-nextgen-bulk',
75 'nextgen-gallery_page_nggallery-manage-gallery', // Different since NextGen 3.3.6.
76 'nextgen-gallery_page_wp-smush-nextgen-bulk', // Different since NextGen 3.3.6.
77 'post',
78 'post-new',
79 'page',
80 'edit-page',
81 'upload',
82 );
83
84 /**
85 * Attachment IDs which are smushed.
86 *
87 * @var array $smushed_attachments
88 */
89 public $smushed_attachments = array();
90
91 /**
92 * Unsmushed image IDs.
93 *
94 * @var array $unsmushed_attachments
95 */
96 public $unsmushed_attachments = array();
97
98 /**
99 * Skipped attachment IDs.
100 *
101 * @since 3.0
102 *
103 * @var array $skipped_attachments
104 */
105 public $skipped_attachments = array();
106
107 /**
108 * Smushed attachments out of total attachments.
109 *
110 * @var int $smushed_count
111 */
112 public $smushed_count = 0;
113
114 /**
115 * Smushed attachments out of total attachments.
116 *
117 * @var int $remaining_count
118 */
119 public $remaining_count = 0;
120
121 /**
122 * Images with errors that have been skipped from bulk smushing.
123 *
124 * @since 3.0
125 * @var int $skipped_count
126 */
127 public $skipped_count = 0;
128
129 /**
130 * Super Smushed attachments count.
131 *
132 * @var int $super_smushed
133 */
134 public $super_smushed = 0;
135
136 /**
137 * Total count of attachments for smushing.
138 *
139 * @var int $total_count
140 */
141 public $total_count = 0;
142
143 /**
144 * Limit for allowed number of images per bulk request.
145 *
146 * This is enforced at api level too.
147 *
148 * @var int
149 */
150 private static $max_free_bulk = 50;
151
152 /**
153 * Initialize modules.
154 *
155 * @since 2.9.0
156 */
157 protected function init() {
158 $this->mod = new Modules();
159
160 // Enqueue scripts and initialize variables.
161 add_action( 'admin_init', array( $this, 'init_settings' ) );
162
163 // Load integrations.
164 add_action( 'init', array( $this, 'load_integrations' ) );
165
166 // Big image size threshold (WordPress 5.3+).
167 add_filter( 'big_image_size_threshold', array( $this, 'big_image_size_threshold' ), 10 );
168
169 /**
170 * Load NextGen Gallery, instantiate the Async class. if hooked too late or early, auto Smush doesn't
171 * work, also load after settings have been saved on init action.
172 */
173 add_action( 'plugins_loaded', array( $this, 'load_libs' ), 90 );
174
175 /**
176 * Maybe need to load some modules in REST API mode.
177 * E.g. S3.
178 */
179 add_action( 'rest_api_init', array( $this, 'load_libs_for_rest_api' ), 99 );
180 }
181
182 /**
183 * Load integrations class.
184 *
185 * @since 2.8.0
186 */
187 public function load_integrations() {
188 new Integrations\Common();
189 }
190
191 /**
192 * Load plugin modules.
193 */
194 public function load_libs() {
195 $this->wp_smush_async();
196
197 if ( is_admin() ) {
198 $this->s3 = new Integrations\S3();
199 }
200
201 /**
202 * Load NextGen integration on admin or custom ajax request.
203 *
204 * @since 3.10.0
205 */
206 if ( is_admin() || defined( 'NGG_AJAX_SLUG' ) && ! empty( $_REQUEST[ NGG_AJAX_SLUG ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
207 $this->nextgen = new Integrations\Nextgen();
208 }
209
210 new Integrations\Gutenberg();
211 new Integrations\Composer();
212 new Integrations\Gravity_Forms();
213 $avada = new Integrations\Avada();
214 $avada->init();
215 $divi = new Integrations\Divi();
216 $divi->init();
217 $envira = new Integrations\Envira();
218 $envira->init();
219 $hummingbird = new Integrations\Hummingbird_Integration();
220 $hummingbird->init();
221
222 $woo = new Integrations\WooCommerce();
223 $woo->init();
224
225 $amp = new Integrations\AMP_Integration();
226 $amp->init();
227
228 $essential_grid = new Integrations\Essential_Grid_Integration();
229 $essential_grid->init();
230
231 $elementor = new Integrations\Elementor_Integration();
232 $elementor->init();
233
234 $wp_rocket_integration = new Integrations\WP_Rocket_Integration();
235 $wp_rocket_integration->init();
236
237 $w3tc_integration = new Integrations\W3_Total_Cache_Integration();
238 $w3tc_integration->init();
239
240 $litespeed_integration = new Integrations\Litespeed_Cache_Integration();
241 $litespeed_integration->init();
242
243 $wp_fastest_cache_integration = new Integrations\WP_Fastest_Cache_Integration();
244 $wp_fastest_cache_integration->init();
245
246 $wp_optimize_integration = new Integrations\WP_Optimize_Integration();
247 $wp_optimize_integration->init();
248
249 $wp_super_cache_integration = new Integrations\WP_Super_Cache_Integration();
250 $wp_super_cache_integration->init();
251
252 $oxygen_builder = new Integrations\Oxygen_Builder_Integration();
253 $oxygen_builder->init();
254
255 // Register logger to schedule cronjob.
256 Helper::logger();
257 }
258
259 /**
260 * Load lib for REST API.
261 */
262 public function load_libs_for_rest_api() {
263 // Load S3 if there is media REST API.
264 if ( ! Helper::is_non_rest_media() && ! $this->s3 ) {
265 $this->s3 = new Integrations\S3();
266 }
267 }
268
269 /**
270 * Initialize the Smush Async class.
271 */
272 private function wp_smush_async() {
273 // Check if Async is disabled.
274 if ( defined( 'WP_SMUSH_ASYNC' ) && ! WP_SMUSH_ASYNC ) {
275 return;
276 }
277
278 // Instantiate class.
279 new Modules\Async\Async();
280
281 // Load the Editor Async task only if user logged in or in backend.
282 if ( is_admin() && is_user_logged_in() ) {
283 new Modules\Async\Editor();
284 }
285 }
286
287 /**
288 * Init settings.
289 */
290 public function init_settings() {
291 // Initialize Image dimensions.
292 $this->mod->smush->image_sizes = $this->image_dimensions();
293 }
294
295 public function get_localize_strings() {
296 $whiltelabel = new WhiteLabel();
297 $upgrade_url = add_query_arg(
298 array(
299 'utm_source' => 'smush',
300 'utm_medium' => 'plugin',
301 'utm_campaign' => 'smush_bulksmush_inline_filesizelimit',
302 ),
303 'https://wpmudev.com/project/wp-smush-pro/'
304 );
305
306 $wp_smush_msgs = array(
307 'nonce' => wp_create_nonce( 'wp-smush-ajax' ),
308 'webp_nonce' => wp_create_nonce( 'wp-smush-webp-nonce' ),
309 'settingsUpdated' => esc_html__( 'Your settings have been updated', 'wp-smushit' ),
310 'resmush' => esc_html__( 'Super-Smush', 'wp-smushit' ),
311 'smush_now' => esc_html__( 'Smush Now', 'wp-smushit' ),
312 'error_in_bulk' => esc_html__( '{{smushed}}/{{total}} images smushed successfully, {{errors}} images were not optimized, find out why and how to resolve the issue(s) below.', 'wp-smushit' ),
313 'all_failed' => esc_html__( 'All of your images failed to smush. Find out why and how to resolve the issue(s) below.', 'wp-smushit' ),
314 'all_resmushed' => esc_html__( 'All images are fully optimized.', 'wp-smushit' ),
315 'all_smushed' => esc_html__( 'All attachments have been smushed. Awesome!', 'wp-smushit' ),
316 'error_size_limit' => WP_Smush::is_pro() ? '' : sprintf(
317 /* translators: %1$s - opening a link <a>, %2$s - Close the link </a> */
318 esc_html__( 'Are you hitting the 5MB "size limit exceeded" warning? %1$sUpgrade to Smush Pro%2$s to optimize unlimited image files up to 256Mb each.', 'wp-smushit' ),
319 '<a href="' . esc_url( $upgrade_url ) . '" target="_blank">',
320 '</a>'
321 ),
322 'restore' => esc_html__( 'Restoring image...', 'wp-smushit' ),
323 'smushing' => esc_html__( 'Smushing...', 'wp-smushit' ),
324 'btn_ignore' => esc_html__( 'Ignore', 'wp-smushit' ),
325 'view_detail' => esc_html__( 'View Details', 'wp-smushit' ),
326 'membership_valid' => esc_html__( 'We successfully verified your membership, all the Pro features should work completely. ', 'wp-smushit' ),
327 'membership_invalid' => esc_html__( "Your membership couldn't be verified.", 'wp-smushit' ),
328 'missing_path' => esc_html__( 'Missing file path.', 'wp-smushit' ),
329 'failed_item_smushed' => esc_html__( 'Images smushed successfully, No further action required', 'wp-smushit' ),
330 // Used by Directory Smush.
331 'unfinished_smush_single' => esc_html__( 'image could not be smushed.', 'wp-smushit' ),
332 'unfinished_smush' => esc_html__( 'images could not be smushed.', 'wp-smushit' ),
333 'already_optimised' => esc_html__( 'Already Optimized', 'wp-smushit' ),
334 'ajax_error' => esc_html__( 'Ajax Error', 'wp-smushit' ),
335 'generic_ajax_error' => esc_html__( 'Something went wrong with the request. Please reload the page and try again.', 'wp-smushit' ),
336 'all_done' => esc_html__( 'All Done!', 'wp-smushit' ),
337 'sync_stats' => esc_html__( 'Give us a moment while we sync the stats.', 'wp-smushit' ),
338 // Progress bar text.
339 'progress_smushed' => esc_html__( 'images optimized', 'wp-smushit' ),
340 'bulk_resume' => esc_html__( 'Resume scan', 'wp-smushit' ),
341 'bulk_stop' => esc_html__( 'Stop current bulk smush process.', 'wp-smushit' ),
342 // Errors.
343 'error_ignore' => esc_html__( 'Ignore this image from bulk smushing', 'wp-smushit' ),
344 // Ignore text.
345 'ignored' => esc_html__( 'Ignored', 'wp-smushit' ),
346 'not_processed' => esc_html__( 'Not processed', 'wp-smushit' ),
347 // Notices.
348 'noticeDismiss' => esc_html__( 'Dismiss', 'wp-smushit' ),
349 'noticeDismissTooltip' => esc_html__( 'Dismiss notice', 'wp-smushit' ),
350 'smush_cdn_activation_notice' => WP_Smush::is_pro() && ! Settings::get_instance()->is_cdn_active() ?
351 $whiltelabel->whitelabel_string(
352 sprintf(
353 /* translators: 1 - Number of CDN PoP locations, 2 - opening a tag, 3 - closing a tag */
354 esc_html__( 'Activate CDN to bulk smush and serve animated GIF’s via %1$d worldwide locations. %2$sActivate CDN%3$s', 'wp-smushit' ),
355 Admin::get_cdn_pop_locations(),
356 '<a href="' . esc_url( network_admin_url( 'admin.php?page=smush-cdn' ) ) . '" />',
357 '</a>'
358 )
359 ) : '',
360 // URLs.
361 'smush_url' => network_admin_url( 'admin.php?page=smush' ),
362 'bulk_smush_url' => Helper::get_page_url( 'smush-bulk' ),
363 'nextGenURL' => network_admin_url( 'admin.php?page=smush-next-gen' ),
364 'edit_link' => Helper::get_image_media_link( '{{id}}', null, true ),
365 'debug_mode' => defined( 'WP_DEBUG' ) && WP_DEBUG,
366 'cancel' => esc_html__( 'Cancel', 'wp-smushit' ),
367 'cancelling' => esc_html__( 'Cancelling ...', 'wp-smushit' ),
368 'recheck_images_link' => Helper::get_recheck_images_link(),
369 );
370
371 return apply_filters( 'wp_smush_localize_script_messages', $wp_smush_msgs );
372 }
373
374 /**
375 * Localize translations.
376 */
377 public function localize() {
378 global $current_screen;
379
380 $handle = 'smush-admin';
381
382 wp_localize_script( $handle, 'wp_smush_msgs', $this->get_localize_strings() );
383
384 if ( 'toplevel_page_smush' === $current_screen->id ) {
385 $slug = 'dashboard';
386 } else {
387 $slug = explode( 'page_smush-', $current_screen->id );
388 $slug = isset( $slug[1] ) ? $slug[1] : false;
389 }
390
391 // Load the stats on selected screens only.
392 if ( $slug && isset( WP_Smush::get_instance()->admin()->pages[ $slug ] ) && method_exists( WP_Smush::get_instance()->admin()->pages[ $slug ], 'dashboard_summary_meta_box' ) ) {
393 // Get resmush list, If we have a resmush list already, localize those IDs.
394 $resmush_ids = $this->get_resmush_ids();
395 if ( $resmush_ids ) {
396 // Get the attachments, and get lossless count.
397 $this->resmush_ids = $resmush_ids;
398 }
399
400 // Get attachments if all the images are not smushed.
401 $this->unsmushed_attachments = $this->remaining_count > 0 ? $this->get_unsmushed_attachments() : array();
402 $this->unsmushed_attachments = ! empty( $this->unsmushed_attachments ) && is_array( $this->unsmushed_attachments ) ? array_values( $this->unsmushed_attachments ) : $this->unsmushed_attachments;
403
404 $data = $this->get_global_stats();
405 } else {
406 $data = array(
407 'count_supersmushed' => '',
408 'count_smushed' => '',
409 'count_total' => '',
410 'count_images' => '',
411 'unsmushed' => '',
412 'resmush' => '',
413 'savings_bytes' => '',
414 'savings_resize' => '',
415 'savings_conversion' => '',
416 'savings_supersmush' => '',
417 'savings_percent' => '',
418 'percent_grade' => '',
419 'percent_metric' => '',
420 'percent_optimized' => '',
421 );
422 }
423
424 // Check if scanner class is available.
425 $scanner_ready = isset( $this->mod->dir->scanner );
426
427 $data['dir_smush'] = array(
428 'currentScanStep' => $scanner_ready ? $this->mod->dir->scanner->get_current_scan_step() : 0,
429 'totalSteps' => $scanner_ready ? $this->mod->dir->scanner->get_scan_steps() : 0,
430 );
431
432 $data['resize_sizes'] = $this->get_max_image_dimensions();
433
434 // Convert it into ms.
435 $data['timeout'] = WP_SMUSH_TIMEOUT * 1000;
436
437 wp_localize_script( $handle, 'wp_smushit_data', apply_filters( 'wp_smush_script_data', $data ) );
438 }
439
440 /**
441 * Check bulk sent count, whether to allow further smushing or not
442 *
443 * @param bool $reset To hard reset the transient.
444 * @param string $key Transient Key - bulk_sent_count/dir_sent_count.
445 *
446 * TODO: remove this (and all related code) because the limit has been lifted in 3.12.0
447 *
448 * @return bool
449 */
450 public static function check_bulk_limit( $reset = false, $key = 'bulk_sent_count' ) {
451 $is_pre_3_12_6_site = get_site_option( 'wp_smush_pre_3_12_6_site' );
452 if ( $is_pre_3_12_6_site ) {
453 return true;
454 }
455
456 $transient_name = 'wp-smush-' . $key;
457
458 // If we JUST need to reset the transient.
459 if ( $reset ) {
460 set_transient( $transient_name, 0, 60 );
461 return false;
462 }
463
464 $bulk_sent_count = (int) get_transient( $transient_name );
465
466 // Check if bulk smush limit is less than limit.
467 if ( ! $bulk_sent_count || $bulk_sent_count < self::$max_free_bulk ) {
468 $continue = true;
469 } elseif ( $bulk_sent_count === self::$max_free_bulk ) {
470 // If user has reached the limit, reset the transient.
471 $continue = false;
472 $reset = true;
473 } else {
474 $continue = false;
475 }
476
477 // If we need to reset the transient.
478 if ( $reset ) {
479 set_transient( $transient_name, 0, 60 );
480 }
481
482 return $continue;
483 }
484
485 /**
486 * Get registered image sizes with dimension
487 *
488 * @return array
489 */
490 public function image_dimensions() {
491 return Helper::get_image_sizes();
492 }
493
494 /**
495 * Get the Maximum Width and Height settings for WrodPress
496 *
497 * @return array, Array of Max. Width and Height for image.
498 */
499 public function get_max_image_dimensions() {
500 global $_wp_additional_image_sizes;
501
502 $width = 0;
503 $height = 0;
504 $limit = 9999; // Post-thumbnail.
505
506 $image_sizes = get_intermediate_image_sizes();
507
508 // If image sizes are filtered and no image size list is returned.
509 if ( empty( $image_sizes ) ) {
510 return array(
511 'width' => $width,
512 'height' => $height,
513 );
514 }
515
516 // Create the full array with sizes and crop info.
517 foreach ( $image_sizes as $size ) {
518 if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
519 $size_width = get_option( "{$size}_size_w" );
520 $size_height = get_option( "{$size}_size_h" );
521 } elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
522 $size_width = $_wp_additional_image_sizes[ $size ]['width'];
523 $size_height = $_wp_additional_image_sizes[ $size ]['height'];
524 }
525
526 // Skip if no width and height.
527 if ( ! isset( $size_width, $size_height ) ) {
528 continue;
529 }
530
531 // If within te limit, check for a max value.
532 if ( $size_width <= $limit ) {
533 $width = max( $width, $size_width );
534 }
535
536 if ( $size_height <= $limit ) {
537 $height = max( $height, $size_height );
538 }
539 }
540
541 return array(
542 'width' => $width,
543 'height' => $height,
544 );
545 }
546
547 /**
548 * Update the image smushed count in transient
549 *
550 * @param string $key Database key.
551 */
552 public static function update_smush_count( $key = 'bulk_sent_count' ) {
553 $transient_name = 'wp-smush-' . $key;
554
555 $bulk_sent_count = get_transient( $transient_name );
556
557 // If bulk sent count is not set.
558 if ( false === $bulk_sent_count ) {
559 // Start transient at 0.
560 set_transient( $transient_name, 1, 200 );
561 } elseif ( $bulk_sent_count < self::$max_free_bulk ) {
562 // If lte max_free_bulk images are sent, increment.
563 set_transient( $transient_name, $bulk_sent_count + 1, 200 );
564 }
565 }
566
567 /**
568 * Set the big image threshold.
569 *
570 * @param int $threshold The threshold value in pixels. Default 2560.
571 *
572 * @return int|bool New threshold. False if scaling is disabled.
573 * @since 3.3.2
574 *
575 */
576 public function big_image_size_threshold( $threshold ) {
577 if ( Settings::get_instance()->get( 'no_scale' ) ) {
578 return false;
579 }
580
581 if ( ! $this->mod->resize->is_active() ) {
582 return $threshold;
583 }
584
585 $resize_sizes = Settings::get_instance()->get_setting( 'wp-smush-resize_sizes' );
586 if ( ! $resize_sizes || ! is_array( $resize_sizes ) ) {
587 return $threshold;
588 }
589
590 return $resize_sizes['width'] > $resize_sizes['height'] ? $resize_sizes['width'] : $resize_sizes['height'];
591 }
592
593 /**
594 * Get max_free_bulk.
595 *
596 * @return int
597 */
598 public static function get_max_free_bulk() {
599 return self::$max_free_bulk;
600 }
601
602
603 /**
604 * Get status_animated.
605 *
606 * @return int
607 */
608 public static function get_status_animated() {
609 return self::$status_animated;
610 }
611
612 }
613