PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | includes/class-updraft-smush-manager-commands.php +14 -12 4.5.3 → 4.7.0 View file →
@@ -101,9 +101,9 @@
101 101 return new WP_Error('invalid_blog', __('Blog ID is invalid', 'wp-optimize'));
102 102 }
103 103
104 104 // A sub site administrator can only compress their own image. If the blog ID isn't theirs, return an error.
105 - if ($blog && is_multisite() && get_current_blog_id() !== $blog && !current_user_can('manage_network_options')) {
105 + if ($blog && is_multisite() && get_current_blog_id() !== $blog && !WP_Optimize()->current_user_can('manage_network_options')) {
106 106 return new WP_Error('compression_not_permitted', __('The blog ID provided does not match the current blog.', 'wp-optimize'));
107 107 }
108 108
109 109 $server = isset($options['compression_server']) ? sanitize_text_field($options['compression_server']) : $this->task_manager->get_default_webservice();
@@ -128,9 +128,9 @@
128 128
129 129 $success = $this->task_manager->compress_single_image($image, $options, $server);
130 130
131 131 if (!$success) {
132 - return new WP_Error('compress_failed', get_post_meta($image, 'smush-info', true));
132 + return new WP_Error('compress_failed', get_post_meta($image, '_wpo-smush-info', true));
133 133 }
134 134
135 135 $response = array();
136 136 $response['status'] = true;
@@ -138,11 +138,11 @@
138 138 $response['options'] = $options;
139 139 $response['server'] = $server;
140 140 $response['success'] = $success;
141 141 $response['restore_possible'] = $backup;
142 - $response['summary'] = get_post_meta($image, 'smush-info', true);
142 + $response['summary'] = get_post_meta($image, '_wpo-smush-info', true);
143 143
144 - $smush_stats = get_post_meta($image, 'smush-stats', true);
144 + $smush_stats = get_post_meta($image, '_wpo-smush-stats', true);
145 145 if (isset($smush_stats['sizes-info'])) {
146 146 $response['sizes-info'] = WP_Optimize()->include_template('images/smush-details.php', true, array('sizes_info' => $smush_stats['sizes-info']));
147 147 }
148 148
@@ -426,15 +426,15 @@
426 426 if (is_multisite()) switch_to_blog($blog_id);
427 427
428 428 foreach ($selected_images[$blog_id] as $attachment_id) {
429 429 if ($unmark) {
430 - delete_post_meta($attachment_id, 'smush-complete');
431 - delete_post_meta($attachment_id, 'smush-marked');
432 - delete_post_meta($attachment_id, 'smush-info');
430 + delete_post_meta($attachment_id, '_wpo-smush-complete');
431 + delete_post_meta($attachment_id, '_wpo-smush-marked');
432 + delete_post_meta($attachment_id, '_wpo-smush-info');
433 433 } else {
434 - update_post_meta($attachment_id, 'smush-complete', true);
435 - update_post_meta($attachment_id, 'smush-marked', true);
436 - update_post_meta($attachment_id, 'smush-info', $info);
434 + update_post_meta($attachment_id, '_wpo-smush-complete', true);
435 + update_post_meta($attachment_id, '_wpo-smush-marked', true);
436 + update_post_meta($attachment_id, '_wpo-smush-info', $info);
437 437 }
438 438 }
439 439
440 440 if (is_multisite()) restore_current_blog();
@@ -614,9 +614,11 @@
614 614 if (empty($images)) return $this->image_not_found_response();
615 615
616 616 $images['original'] = get_attached_file($attachment_id);
617 617 foreach ($images as $image) {
618 - WPO_WebP_Utils::do_webp_conversion($image);
618 + if (!is_file($image.'.webp')) {
619 + WPO_WebP_Utils::do_webp_conversion($image);
620 + }
619 621 }
620 622
621 623 return array(
622 624 'success' => __('Image is converted to WebP format.', 'wp-optimize'),
@@ -632,9 +634,9 @@
632 634 public function get_smush_settings_form($data) {
633 635 $attachment_id = isset($data['attachment_id']) ? absint($data['attachment_id']) : 0;
634 636 if (0 === $attachment_id) return $this->image_not_found_response();
635 637
636 - $compressed = (bool) get_post_meta($attachment_id, 'smush-complete', true);
638 + $compressed = (bool) get_post_meta($attachment_id, '_wpo-smush-complete', true);
637 639
638 640 $smush_options = Updraft_Smush_Manager()->get_smush_options();
639 641
640 642 $extract = array(