| @@ -1,80 +1,40 @@ | ||
| 1 | -<?php if (!defined('WPO_VERSION')) die('No direct access.'); ?> | |
| 1 | +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> | |
| 2 | 2 | <div id='smush-metabox-inside-wrapper'> |
| 3 | - <div class='wpo_restore_single_image' <?php echo $restore_display; ?>> | |
| 4 | - <div class='restore_possible' <?php echo $restore_action; ?>> | |
| 5 | - <label for='wpo_restore_single_image_<?php echo $post_id; ?>'> | |
| 6 | - <span class='alignleft'> <?php _e('Restore original', 'wp-optimize'); ?></span> | |
| 7 | - </label> | |
| 8 | - <input type='button' id='wpo_restore_single_image_<?php echo $post_id; ?>' data-blog='<?php echo get_current_blog_id(); ?>' data-id="<?php echo $post_id; ?>" class='button-primary button alignright' value="<?php esc_attr_e('Restore', 'wp-optimize');?>"> | |
| 3 | + <div class='wpo_restore_single_image' style="<?php echo esc_attr($restore_display); ?>"> | |
| 4 | + <div class='restore_possible' style="<?php echo esc_attr($restore_action); ?>"> | |
| 5 | + <div class="alignleft restore-icon"> | |
| 6 | + <label> | |
| 7 | + <span> <?php esc_html_e('Restore original', 'wp-optimize'); ?></span> | |
| 8 | + | |
| 9 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php echo esc_attr($restore_tooltip);?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 10 | + </label> | |
| 11 | + </div> | |
| 12 | + | |
| 13 | + <div class='alignright'> | |
| 14 | + <input type='button' id='wpo_restore_single_image_<?php echo esc_attr($post_id); ?>' data-blog='<?php echo esc_attr(get_current_blog_id()); ?>' data-id="<?php echo esc_attr($post_id); ?>" class='button-primary button' value="<?php esc_attr_e('Restore', 'wp-optimize');?>"> | |
| 15 | + </div> | |
| 9 | 16 | </div> |
| 10 | - <p id='smush_info' class='wpo_restore_single_image'><?php echo $smush_info; ?></p> | |
| 11 | - <div id="wpo_smush_details"><?php echo $smush_details; ?></div> | |
| 17 | + <p id='smush_info'><?php echo esc_html($smush_info); ?></p> | |
| 18 | + <div id="wpo_smush_details"><?php echo $smush_details; // phpcs:ignore WordPress.Security.EscapeOutput -- Output is already escaped ?></div> | |
| 12 | 19 | </div> |
| 13 | - <div class='wpo_smush_single_image compression_level' <?php echo $smush_display; ?>> | |
| 14 | - <label for="enable_lossy_compression"> | |
| 15 | - <input type="radio" id="enable_lossy_compression" name="compression_level" class="smush-options compression_level" <?php checked($smush_options['image_quality'], 60); ?>> | |
| 16 | - <?php _e('Prioritize maximum compression', 'wp-optimize');?> | |
| 17 | - <span tabindex="0" data-tooltip="<?php _e('Potentially uses lossy compression to ensure maximum savings per image, the resulting images are of a slightly lower quality', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 18 | - </label> | |
| 19 | - <label for="enable_lossless_compression"> | |
| 20 | - <input type="radio" id="enable_lossless_compression" name="compression_level" class="smush-options compression_level" <?php checked($smush_options['image_quality'], 100); ?>> | |
| 21 | - <?php _e('Prioritize retention of detail', 'wp-optimize');?> | |
| 22 | - <span tabindex="0" data-tooltip="<?php _e('Uses lossless compression, which results in much better image quality but lower filesize savings per image', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 23 | - </label> | |
| 24 | - <label for="enable_custom_compression"> | |
| 25 | - <input id="enable_custom_compression" type="radio" name="compression_level" class="smush-options compression_level" <?php checked($custom); ?>> | |
| 26 | - <?php _e('Custom', 'wp-optimize');?> | |
| 27 | - </label> | |
| 28 | - <div class="smush-options custom_compression" <?php if (!$custom) echo 'style="display:none;"';?>> | |
| 29 | - <span class="alignleft"><?php _e('Maximum compression', 'wp-optimize');?></span> | |
| 30 | - <input id="custom_compression_slider" class="compression_level" data-max="Maximum Compression" type="range" step="5" value="<?php echo intval($smush_options['image_quality']); ?>" min="65" max="85" list="number" /> | |
| 31 | - <datalist id="number"> | |
| 32 | - <option value="65"/> | |
| 33 | - <option value="70"/> | |
| 34 | - <option value="75"/> | |
| 35 | - <option value="80"/> | |
| 36 | - <option value="85"/> | |
| 37 | - </datalist> | |
| 38 | - <span class="alignright"><?php _e('Best image quality', 'wp-optimize');?></span> | |
| 39 | - </div> | |
| 40 | - </div> | |
| 41 | - <a href="#" class="wpo-toggle-advanced-options wpo_smush_single_image" <?php echo $smush_display; ?>><?php _e('Show advanced options', 'wp-optimize');?></a> | |
| 42 | - <div class='smush-advanced wpo-advanced-options'> | |
| 43 | - <h4><?php _e('Service provider', 'wp-optimize');?></h4> | |
| 44 | - <fieldset class="compression_server"> | |
| 45 | - <label for="resmushit"> | |
| 46 | - <input type="radio" id="resmushit" name="compression_server_<?php echo $post_id; ?>" value="resmushit" <?php checked($smush_options['compression_server'], 'resmushit'); ?>> | |
| 47 | - <a href="http://resmush.it" target="_blank"><?php _e('reSmush.it', 'wp-optimize');?></a> | |
| 48 | - </label> | |
| 49 | - </fieldset> | |
| 50 | - <h4><?php _e('Other options', 'wp-optimize');?></h4> | |
| 51 | - <fieldset class="other_options"> | |
| 52 | - <label for='smush_backup_<?php echo $post_id; ?>'> | |
| 53 | - <input type='checkbox' name='smush_backup_<?php echo $post_id; ?>' id='smush_backup_<?php echo $post_id; ?>' <?php checked($smush_options['back_up_original']); ?>> | |
| 54 | - <span><?php _e('Backup original', 'wp-optimize'); ?></span> | |
| 55 | - </label> | |
| 56 | - <label for='smush_exif_<?php echo $post_id; ?>'> | |
| 57 | - <input type='checkbox' name='smush_exif_<?php echo $post_id; ?>' id='smush_exif_<?php echo $post_id; ?>' class="preserve_exif" <?php checked($smush_options['preserve_exif']); ?>> | |
| 58 | - <span><?php _e('Keep EXIF data', 'wp-optimize'); ?></span> | |
| 59 | - </label> | |
| 60 | - </fieldset> | |
| 61 | - </div> | |
| 62 | 20 | |
| 63 | - <?php if ($compressed_by_another_plugin) { ?> | |
| 64 | - <p><b><?php _e('Note: This image is already compressed by another plugin', 'wp-optimize'); ?></b></p> | |
| 21 | + <?php echo $smush_settings_form; // phpcs:ignore WordPress.Security.EscapeOutput -- Output is already escaped ?> | |
| 22 | + | |
| 23 | + <?php if ($compressed_by_another_plugin && !$smush_marked) { ?> | |
| 24 | + <p><b><?php esc_html_e('Note: This image is already compressed by another plugin', 'wp-optimize'); ?></b></p> | |
| 65 | 25 | <?php } ?> |
| 66 | 26 | |
| 67 | - <div class='wpo_smush_single_image action_button' <?php echo $smush_display; ?> > | |
| 68 | - <input type='button' data-blog='<?php echo get_current_blog_id(); ?>' data-id="<?php echo $post_id; ?>" id='smush_compress_<?php echo $post_id; ?>' class='button-primary button' value='<?php _e('Compress', 'wp-optimize'); ?>'/> | |
| 27 | + <div class='wpo_smush_single_image action_button' style="<?php echo esc_attr($smush_display); ?>" > | |
| 28 | + <input type='button' data-blog='<?php echo esc_attr(get_current_blog_id()); ?>' data-id="<?php echo esc_attr($post_id); ?>" id='smush_compress_<?php echo esc_attr($post_id); ?>' class='button-primary button' value='<?php esc_attr_e('Compress', 'wp-optimize'); ?>'/> | |
| 69 | 29 | </div> |
| 70 | 30 | |
| 71 | - <div class='wpo_smush_mark_single_image action_button' <?php echo $smush_mark; ?> > | |
| 72 | - <input type='button' data-blog='<?php echo get_current_blog_id(); ?>' data-id="<?php echo $post_id; ?>" id='smush_mark_<?php echo $post_id; ?>' class='button' value='<?php _e('Mark as already compressed', 'wp-optimize'); ?>'/> | |
| 31 | + <div class='wpo_smush_mark_single_image action_button' style="<?php echo esc_attr($smush_mark); ?>" > | |
| 32 | + <input type='button' data-blog='<?php echo esc_attr(get_current_blog_id()); ?>' data-id="<?php echo esc_attr($post_id); ?>" id='smush_mark_<?php echo esc_attr($post_id); ?>' class='button' value='<?php esc_attr_e('Mark as already compressed', 'wp-optimize'); ?>'/> | |
| 73 | 33 | </div> |
| 74 | 34 | |
| 75 | - <div class='wpo_smush_unmark_single_image action_button' <?php echo $smush_unmark; ?> > | |
| 76 | - <input type='button' data-blog='<?php echo get_current_blog_id(); ?>' data-id="<?php echo $post_id; ?>" id='smush_unmark_<?php echo $post_id; ?>' class='button' value='<?php _e('Mark as uncompressed', 'wp-optimize'); ?>'/> | |
| 35 | + <div class='wpo_smush_unmark_single_image action_button' style="<?php echo esc_attr($smush_unmark); ?>" > | |
| 36 | + <input type='button' data-blog='<?php echo esc_attr(get_current_blog_id()); ?>' data-id="<?php echo esc_attr($post_id); ?>" id='smush_unmark_<?php echo esc_attr($post_id); ?>' class='button' value='<?php esc_attr_e('Mark as uncompressed', 'wp-optimize'); ?>'/> | |
| 77 | 37 | </div> |
| 78 | 38 | |
| 79 | 39 | <?php |
| 80 | 40 | |
| @@ -88,9 +48,9 @@ | ||
| 88 | 48 | $menu_page_url = network_admin_url('admin.php?page=wpo_images'); |
| 89 | 49 | } |
| 90 | 50 | ?> |
| 91 | 51 | <div class="smush-metabox-dashboard-link"> |
| 92 | - <a href="<?php echo $menu_page_url; ?>"><?php _e('WP-Optimize image settings', 'wp-optimize'); ?></a> | |
| 52 | + <a href="<?php echo esc_url($menu_page_url); ?>"><?php esc_html_e('WP-Optimize image settings', 'wp-optimize'); ?></a> | |
| 93 | 53 | </div> |
| 94 | 54 | </div> |
| 95 | 55 | |
| 96 | 56 | <div id="smush-information-modal" class="wp-core-ui" style="display:none;"> |