enqueue_lib_scanner_scripts(); } protected function enqueue_lib_scanner_scripts() { wp_enqueue_script( 'smush-library-scanner', WP_SMUSH_URL . 'app/assets/js/smush-library-scanner.min.js', array( 'wp-i18n' ), WP_SMUSH_VERSION, true ); wp_localize_script( 'smush-library-scanner', 'mediaLibraryScan', array( 'nonce' => wp_create_nonce( 'wp_smush_media_library_scanner' ), ) ); } /** * Register meta boxes. */ public function register_meta_boxes() { if ( ! is_network_admin() ) { $this->add_meta_box( 'recheck-images-notice', null, array( $this, 'recheck_images_notice_meta_box' ), null, null, 'main', array( 'box_class' => 'sui-box wp-smush-recheck-images-notice-box sui-hidden', 'box_content_class' => false, ) ); } parent::register_meta_boxes(); if ( ! is_network_admin() ) { $this->add_meta_box( 'bulk', __( 'Bulk Smush', 'wp-smushit' ), array( $this, 'bulk_smush_metabox' ), null, null, 'main', array( 'box_class' => 'sui-box bulk-smush-wrapper', ) ); } $class = WP_Smush::is_pro() ? 'wp-smush-pro' : ''; $this->add_meta_box( 'bulk-settings', __( 'Settings', 'wp-smushit' ), array( $this, 'bulk_settings_meta_box' ), null, array( $this, 'common_meta_box_footer' ), 'main', array( 'box_class' => "sui-box smush-settings-wrapper {$class}", ) ); $this->modals['restore-images'] = array(); } /** * Prints Dimensions required for Resizing * * @param string $name Setting name. */ public function resize_settings( $name = '' ) { // Add only to full size settings. if ( 'resize' !== $name ) { return; } // Dimensions. $resize_sizes = $this->settings->get_setting( 'wp-smush-resize_sizes', array( 'width' => '', 'height' => '', ) ); // Get max dimensions. $max_sizes = WP_Smush::get_instance()->core()->get_max_image_dimensions(); $setting_status = $this->settings->get( 'resize' ); ?>
', esc_html( $max_sizes['width'] ), '×', esc_html( $max_sizes['height'] ), '' ); ?>

http://gifgifs.com/resizer/' ); ?>

2: */ printf( esc_html__( 'Note: Any PNGs with transparency will be ignored. Smush will only convert PNGs if it results in a smaller file size. The original PNG file will be deleted, and the resulting file will have a new filename and extension (JPEG). %1$sAny hard-coded URLs on your site that contain the original PNG filename will need to be updated manually.%2$s', 'wp-smushit' ), '', '' ); ?>
2: */ printf( esc_html__( '%1$sBackup original images%2$s must be enabled if you wish to retain the original PNG image as a backup.', 'wp-smushit' ), '', '' ); ?>

' ) ) { esc_html_e( 'As of WordPress 5.3, large image uploads are resized down to a specified max width and height. If you require images larger than 2560px, you can override this setting here.', 'wp-smushit' ); } else { esc_html_e( 'Save a ton of space by not storing over-sized images on your server. Set a maximum height and width for all images uploaded to your site so that any unnecessarily large images are automatically resized before they are added to the media gallery. This setting does not apply to images smushed using Directory Smush feature.', 'wp-smushit' ); } break; case 'original': esc_html_e( 'By default, WordPress will only compress the generated attachments when you upload images, not the original ones. Enable this feature to compress the original images.', 'wp-smushit' ); break; case 'strip_exif': esc_html_e( 'Note: This data adds to the size of the image. While this information might be important to photographers, it’s unnecessary for most users and safe to remove.', 'wp-smushit' ); break; case 'background_email': $bg_optimization = WP_Smush::get_instance()->core()->mod->bg_optimization; if ( $bg_optimization->can_use_background() ) { /* translators: %s: Email address. */ $bg_email_desc = sprintf( __( 'You will receive an email at %s when the bulk smush has completed.', 'wp-smushit' ), $bg_optimization->get_mail_recipient() ); } else { $bulk_upgrade_url = $this->get_utm_link( array( 'utm_campaign' => 'smush_bulk_smush_BO_email_toggle', ) ); $bg_email_desc = sprintf( /* translators: 1: Open link tag , 2: Close link tag */ esc_html__( 'Get the email notification as part of the Background Optimization feature. You don’t have to keep the bulk smush page open when it is in progress. Be notified when Background Optimization completes. %1$sUnlock now with Pro%2$s', 'wp-smushit' ), '', '' ); } echo wp_kses_post( $bg_email_desc ); break; default: break; } ?>

settings->get_setting( 'wp-smush-image_sizes' ); $sizes = WP_Smush::get_instance()->core()->image_dimensions(); $all_selected = false === $image_sizes || count( $image_sizes ) === count( $sizes ); ?>
$size ) { // If image sizes array isn't set, mark all checked ( Default Values ). if ( false === $image_sizes ) { $checked = true; } else { // WPMDUDEV hosting support: cast $size_k to string to properly work with object cache. $checked = is_array( $image_sizes ) && in_array( (string) $size_k, $image_sizes, true ); } ?>
settings->get( 'backup' ); ?>

, %2$s - */ esc_html__( '%1$sCompress original images%2$s is disabled, which means that enabling %1$sBackup original images%2$s won’t yield additional benefits and will use more storage space. We recommend enabling %1$sBackup original images%2$s only if %1$sCompress original images%2$s is also enabled.', 'wp-smushit' ), '', '' ); ?>

settings->get( 'no_scale' ); ?>
view( 'meta-box-footer', array(), 'common' ); } /** * Bulk smush meta box. * * Container box to handle bulk smush actions. Show progress bars, * bulk smush action buttons etc. in this box. */ public function bulk_smush_metabox() { $core = WP_Smush::get_instance()->core(); $global_stats = $core->get_global_stats(); $array_utils = new Array_Utils(); $bulk_upgrade_url = $this->get_utm_link( array( 'utm_campaign' => 'smush_bulk_smush_complete_global', ) ); $in_progress_upsell_url = $this->get_utm_link( array( 'utm_campaign' => 'smush_bulk_smush_progress_BO', ) ); $upsell_cdn_url = $this->get_utm_link( array( 'utm_campaign' => 'smush_bulksmush_cdn', ) ); $bg_optimization = WP_Smush::get_instance()->core()->mod->bg_optimization; $background_processing_enabled = $bg_optimization->should_use_background(); $background_in_processing = $background_processing_enabled && $bg_optimization->is_in_processing(); if ( $bg_optimization->can_use_background() ) { $upsell_text = ''; } else { $upsell_text = sprintf( /* translators: %s: Upsell Link */ __( 'Want to exit the page? Background Optimization is available with Smush Pro, allowing you to leave while Smush continues to work its magic. %s', 'wp-smushit' ), '' . esc_html__( 'Upgrade to Pro and get 60% off', 'wp-smushit' ) . '' ); } $in_processing_notice = sprintf( /* translators: %s: Upsell text */ __( 'Bulk Smush is currently running. Please keep this page open until the process is complete. %s', 'wp-smushit' ), $upsell_text ); $this->view( 'bulk/meta-box', array( 'core' => $core, 'can_use_background' => $bg_optimization->can_use_background(), 'is_pro' => WP_Smush::is_pro(), 'unsmushed_count' => (int) $array_utils->get_array_value( $global_stats, 'count_unsmushed' ), 'resmush_count' => (int) $array_utils->get_array_value( $global_stats, 'count_resmush' ), 'remaining_count' => (int) $array_utils->get_array_value( $global_stats, 'remaining_count' ), 'total_count' => (int) $array_utils->get_array_value( $global_stats, 'count_total' ), 'bulk_upgrade_url' => $bulk_upgrade_url, 'upsell_cdn_url' => $upsell_cdn_url, 'background_processing_enabled' => $background_processing_enabled, 'background_in_processing' => $background_in_processing, 'background_in_processing_notice' => $bg_optimization->get_in_process_notice(), 'in_processing_notice' => $in_processing_notice, ) ); } /** * Settings meta box. * * Free and pro version settings are shown in same section. For free users, pro settings won't be shown. * To print full size smush, resize and backup in group, we hook at `smush_setting_column_right_end`. */ public function bulk_settings_meta_box() { $fields = $this->settings->get_bulk_fields(); // Remove backups setting, as it's added separately. $key = array_search( 'backup', $fields, true ); if ( false !== $key ) { unset( $fields[ $key ] ); } // Remove no_scale setting, as it's added separately. $key = array_search( 'no_scale', $fields, true ); if ( false !== $key ) { unset( $fields[ $key ] ); } $backups = new Backups(); $backup_exists = $backups->items_with_backup_exist(); $this->view( 'bulk-settings/meta-box', array( 'basic_features' => Settings::$basic_features, 'cdn_enabled' => $this->settings->get( 'cdn' ), 'grouped_settings' => $fields, 'settings' => $this->settings->get(), 'backup_exists' => $backup_exists, ) ); } /** * Show a "new" tag near the super-smush option for free users. * * @since 3.10.0 * @since 3.14.0 Showing the new tag for all users after adding Ultra level. * * @param string $name Option name. * * @return void */ public function add_lossy_new_tag( $name ) { if ( 'lossy' !== $name ) { return; } ?> is_pro_field( $name ) || $settings->can_access_pro_field( $name ) ) { return; } ?> core()->mod->bg_optimization; $is_background_enabled = $bg_optimization->should_use_background(); if ( ! $is_background_enabled && $bg_optimization->can_use_background() ) { ?> view( 'recheck-images-notice', array(), 'common' ); } }