Enable Media Replace - Version 3.2.5

Version Description

  • remove the leftover setcookie and the plugins recommendations.
Download this release

Release Info

Developer ShortPixel
Plugin Icon 128x128 Enable Media Replace
Version 3.2.5
Comparing to
See all releases

Code changes from version 3.2.4 to 3.2.5

class-emr-smart-notification.php DELETED
@@ -1,327 +0,0 @@
1
- <?php
2
-
3
- class EMR_Smart_Notification {
4
-
5
- private static $_instance = null;
6
- private $plugins;
7
- private $options;
8
- private $plugin_dir;
9
-
10
- function __construct( $args ) {
11
-
12
- if ( defined( WP_PLUGIN_DIR ) ) {
13
- $this->plugin_dir = WP_PLUGIN_DIR . '/';
14
- }else{
15
- $this->plugin_dir = WP_CONTENT_DIR . '/plugins/';
16
- }
17
-
18
- $this->container_id = 'emr-smart-notification';
19
- $this->options = get_option( 'sp-recommended-plugin', array() );
20
- $this->plugins = $this->parse_plugins( $args['plugins'] );
21
-
22
- if ( is_admin() && $this->show_notice() ) {
23
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
24
- add_action( 'admin_notices', array( $this, 'notification' ) );
25
- add_action( 'wp_ajax_emr_smart_notitification', array( $this, 'ajax' ) );
26
- add_action('admin_footer', array( $this, 'emr_script' ) );
27
- }
28
-
29
- }
30
-
31
- private function parse_plugins( $need_check ) {
32
- $plugins = array();
33
-
34
- $shortpixel_extra_check = get_option( 'emr_news', false );
35
- if ( $shortpixel_extra_check ) {
36
- $this->options[] = 'shortpixel-image-optimiser';
37
- }
38
-
39
- foreach ( $need_check as $slug => $plugin ) {
40
-
41
- if ( in_array( $slug, $this->options ) ) {
42
- continue;
43
- }
44
-
45
- $plugin_info = $this->check_plugin( $slug );
46
- if ( 'deactivate' == $plugin_info['needs'] ) {
47
- continue;
48
- }
49
-
50
- $plugins[ $slug ] = array_merge( $plugin, $plugin_info );
51
- }
52
-
53
- return $plugins;
54
-
55
- }
56
-
57
- private function show_notice() {
58
-
59
- if ( ! empty( $this->plugins ) ) {
60
- return true;
61
- }
62
-
63
- return false;
64
-
65
- }
66
-
67
- /**
68
- * @since 1.0.0
69
- * @return emr_Smart_Notification
70
- */
71
- public static function get_instance( $args ) {
72
- if ( is_null( self::$_instance ) ) {
73
- self::$_instance = new self( $args );
74
- }
75
- return self::$_instance;
76
- }
77
-
78
- public function notification() {
79
- $notice_html = '';
80
-
81
- foreach ( $this->plugins as $slug => $plugin ) {
82
- $notice_html .= '<div class="emr-plugin-card">';
83
- $url = $this->create_plugin_link( $plugin['needs'], $slug );
84
- if ( '' != $plugin['image'] ) {
85
- $notice_html .= '<div style="padding-right: 10px;">';
86
- $notice_html .= '<img src="' . esc_url( $plugin['image'] ) . '" width="75" height="75">';
87
- $notice_html .= '</div>';
88
- }
89
- $notice_html .= '<div style="align-self: center;flex-grow: 1;">';
90
- $notice_html .= '<h3 style="margin:0;">' . $plugin['name'] . '</h3>';
91
- $notice_html .= '<p>' . $plugin['description'] . '</p>';
92
- $notice_html .= '</div>';
93
- $notice_html .= '<div>';
94
- $notice_html .= '<a href="#" class="emr-dismiss" data-dismiss="' . esc_attr( $slug ) . '"><span class="screen-reader-text">Dismiss this notice.</span></a>';
95
- $notice_html .= '<span class="plugin-card-' . esc_attr( $slug ) . ' action_button ' . $plugin['needs'] . '">';
96
- $notice_html .= '<a data-slug="' . esc_attr( $slug ) . '" data-action="' . esc_attr( $plugin['needs'] ) . '" class="emr-plugin-button ' . esc_attr( $plugin['class'] ) . '" href="' . esc_url( $url ) . '">' . esc_attr( $plugin['label'] ) . '</a>';
97
- $notice_html .= '</span>';
98
- $notice_html .= '</div>';
99
- $notice_html .= '</div>';
100
- }
101
-
102
- $class = "emr-one-column";
103
- if ( count( $this->plugins ) > 1 ) {
104
- $class = "emr-two-column";
105
- }
106
- echo '<div id="' . $this->container_id . '" class="emr-custom-notice notice ' . $class . '" style="background:transparent;border: 0 none;box-shadow: none;padding: 0;display: flex;">';
107
- echo $notice_html;
108
- echo '<style>.emr-plugin-card {display: flex;background: #fff;border-left: 4px solid #46b450;padding: .5em 12px;box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);position:relative;align-items:center;}.emr-one-column .emr-plugin-card{ width:100%; }.emr-two-column .emr-plugin-card{width:49%;}.emr-two-column .emr-plugin-card:nth-child( 2n + 1 ){margin-right:2%;}.emr-dismiss { position: absolute;top: 0;right: 1px;border: none;margin: 0;padding: 9px;background: 0 0;color: #72777c;cursor: pointer;text-decoration:none; }.emr-dismiss:before { background: 0 0;color: #72777c;content: "\f153";display: block;font: 400 16px/20px dashicons; speak: none;height: 20px;text-align: center;width: 20px;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale; }.emr-dismiss:active:before, .emr-dismiss:focus:before, .emr-dismiss:hover:before { color: #c00; }</style>';
109
- echo '</div>';
110
-
111
-
112
- }
113
-
114
- public function ajax() {
115
-
116
- check_ajax_referer( 'emr-smart-notitification', 'security' );
117
-
118
- if ( isset( $_POST['slug'] ) ) {
119
- $this->options[] = sanitize_text_field( $_POST['slug'] );
120
- update_option( 'sp-recommended-plugin', $this->options );
121
- }
122
-
123
- wp_die( 'ok' );
124
-
125
- }
126
-
127
- public function enqueue() {
128
- wp_enqueue_script( 'updates' );
129
- wp_enqueue_script( 'jquery' );
130
- }
131
-
132
- private function get_plugins( $plugin_folder = '' ) {
133
- if ( ! function_exists( 'get_plugins' ) ) {
134
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
135
- }
136
-
137
- return get_plugins( $plugin_folder );
138
- }
139
-
140
- private function _get_plugin_basename_from_slug( $slug ) {
141
- $keys = array_keys( $this->get_plugins() );
142
-
143
- foreach ( $keys as $key ) {
144
- if ( preg_match( '|^' . $slug . '/|', $key ) ) {
145
- return $key;
146
- }
147
- }
148
-
149
- return $slug;
150
- }
151
-
152
- /**
153
- * @return bool
154
- */
155
- private function check_plugin_is_installed( $slug ) {
156
-
157
- $plugin_path = $this->_get_plugin_basename_from_slug( $slug );
158
-
159
- if ( file_exists( $this->plugin_dir . $plugin_path ) ) {
160
- return true;
161
- }
162
-
163
- return false;
164
- }
165
-
166
- /**
167
- * @return bool
168
- */
169
- private function check_plugin_is_active( $slug ) {
170
- $plugin_path = $this->_get_plugin_basename_from_slug( $slug );
171
- if ( file_exists( $this->plugin_dir . $plugin_path ) ) {
172
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
173
-
174
- return is_plugin_active( $plugin_path );
175
- }
176
- }
177
-
178
- private function create_plugin_link( $state, $slug ) {
179
- $string = '';
180
-
181
- switch ( $state ) {
182
- case 'install':
183
- $string = wp_nonce_url(
184
- add_query_arg(
185
- array(
186
- 'action' => 'install-plugin',
187
- 'plugin' => $this->_get_plugin_basename_from_slug( $slug ),
188
- ),
189
- network_admin_url( 'update.php' )
190
- ),
191
- 'install-plugin_' . $slug
192
- );
193
- break;
194
- case 'deactivate':
195
- $string = add_query_arg(
196
- array(
197
- 'action' => 'deactivate',
198
- 'plugin' => rawurlencode( $this->_get_plugin_basename_from_slug( $slug ) ),
199
- 'plugin_status' => 'all',
200
- 'paged' => '1',
201
- '_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $this->_get_plugin_basename_from_slug( $slug ) ),
202
- ),
203
- admin_url( 'plugins.php' )
204
- );
205
- break;
206
- case 'activate':
207
- $string = add_query_arg(
208
- array(
209
- 'action' => 'activate',
210
- 'plugin' => rawurlencode( $this->_get_plugin_basename_from_slug( $slug ) ),
211
- 'plugin_status' => 'all',
212
- 'paged' => '1',
213
- '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $this->_get_plugin_basename_from_slug( $slug ) ),
214
- ),
215
- admin_url( 'plugins.php' )
216
- );
217
- break;
218
- default:
219
- $string = '';
220
- break;
221
- }// End switch().
222
-
223
- return $string;
224
- }
225
-
226
- private function check_plugin( $slug = '' ) {
227
- $arr = array(
228
- 'installed' => $this->check_plugin_is_installed( $slug ),
229
- 'active' => $this->check_plugin_is_active( $slug ),
230
- 'needs' => 'install',
231
- 'class' => 'button button-primary',
232
- 'label' => __( 'Install and Activate', 'enable-media-replace' ),
233
- );
234
-
235
- if ( $arr['installed'] ) {
236
- $arr['needs'] = 'activate';
237
- $arr['class'] = 'button button-primary';
238
- $arr['label'] = __( 'Activate now', 'enable-media-replace' );
239
- }
240
-
241
- if ( $arr['active'] ) {
242
- $arr['needs'] = 'deactivate';
243
- $arr['class'] = 'deactivate-now button';
244
- $arr['label'] = __( 'Deactivate now', 'enable-media-replace' );
245
- }
246
-
247
- return $arr;
248
- }
249
-
250
- public function emr_script() {
251
-
252
- $ajax_nonce = wp_create_nonce( 'emr-smart-notitification' );
253
-
254
- ?>
255
- <script type="text/javascript">
256
-
257
-
258
- function emrActivatePlugin( url, el ) {
259
-
260
- jQuery.ajax( {
261
- async: true,
262
- type: 'GET',
263
- dataType: 'html',
264
- url: url,
265
- success: function() {
266
- location.reload();
267
- }
268
- } );
269
- }
270
-
271
- var emrContainer = jQuery( '#<?php echo $this->container_id ?>' );
272
- emrContainer.on( 'click', '.emr-plugin-button', function( event ) {
273
- var action = jQuery( this ).data( 'action' ),
274
- url = jQuery( this ).attr( 'href' ),
275
- slug = jQuery( this ).data( 'slug' );
276
-
277
- jQuery(this).addClass( 'updating-message' );
278
- jQuery(this).attr( 'disabled', 'disabled' );
279
-
280
- event.preventDefault();
281
-
282
- if ( 'install' === action ) {
283
-
284
- wp.updates.installPlugin( {
285
- slug: slug
286
- } );
287
-
288
- } else if ( 'activate' === action ) {
289
-
290
- emrActivatePlugin( url, jQuery( this ) );
291
-
292
- }
293
-
294
- } );
295
-
296
- emrContainer.on( 'click', '.emr-dismiss', function( event ) {
297
- var container = jQuery(this).parents( '.emr-plugin-card' ),
298
- data = jQuery(this).data(),
299
- ajaxData = {
300
- action: 'emr_smart_notitification',
301
- security: '<?php echo $ajax_nonce; ?>',
302
- };
303
-
304
- event.preventDefault();
305
-
306
- ajaxData.slug = data.dismiss;
307
-
308
- jQuery.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', ajaxData, function( response ) {
309
- container.slideUp( 'fast', function() {
310
- jQuery( this ).remove();
311
- } );
312
- });
313
-
314
- });
315
-
316
- jQuery( document ).on( 'wp-plugin-install-success', function( response, data ) {
317
- var el = emrContainer.find( '.emr-plugin-button[data-slug="' + data.slug + '"]' );
318
- event.preventDefault();
319
- emrActivatePlugin( data.activateUrl, el );
320
- } );
321
-
322
- </script>
323
-
324
- <?php
325
- }
326
-
327
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
enable-media-replace.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/enable-media-replace
5
  Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
- Version: 3.2.4
7
  Author: ShortPixel
8
  Author URI: https://shortpixel.com
9
 
@@ -26,24 +26,18 @@ add_action('admin_init', 'enable_media_replace_init');
26
  add_action('admin_menu', 'emr_menu');
27
  add_filter('attachment_fields_to_edit', 'enable_media_replace', 10, 2);
28
  add_filter('media_row_actions', 'add_media_action', 10, 2);
29
- add_filter('upload_mimes', 'dat_mime_types', 1, 1);
 
 
 
 
 
30
 
31
  add_shortcode('file_modified', 'emr_get_modified_date');
32
 
33
  if(!defined("SHORTPIXEL_AFFILIATE_CODE")) {
34
  define("SHORTPIXEL_AFFILIATE_CODE", 'VKG6LYN28044');
35
  }
36
-
37
- /**
38
- * @param array $mime_types
39
- * @return array
40
- */
41
- function dat_mime_types($mime_types) {
42
- $mime_types['dat'] = 'text/plain'; // Adding .dat extension
43
-
44
- return $mime_types;
45
- }
46
-
47
  /**
48
  * Register this file in WordPress so we can call it with a ?page= GET var.
49
  * To suppress it in the menu we give it an empty menu title.
@@ -173,47 +167,37 @@ function ua_admin_date_replaced_media_on_edit_media_screen() {
173
  }
174
  add_action( 'attachment_submitbox_misc_actions', 'ua_admin_date_replaced_media_on_edit_media_screen', 91 );
175
 
176
- function emr_install_plugin() {
177
- $slug = isset($_GET['slug']) ? trim($_GET['slug']) : null;
178
- if($slug == 'shortpixel-image-optimiser') {
179
- $response = json_encode(wp_remote_get('https://shortpixel.com/h/af/YXA6CHO28044', array(
180
- 'method' => 'GET',
181
- 'timeout' => 15,
182
- 'redirection' => 3,
183
- 'sslverify' => false,
184
- 'httpversion' => '1.0',
185
- 'blocking' => true,
186
- 'headers' => array(),
187
- 'body' => null,
188
- 'cookies' => array()
189
- )));
190
-
191
- setcookie("AffiliateShortPixel", "YXA6CHO28044", time() + 2592000, parse_url(get_admin_url(),PHP_URL_PATH), parse_url(get_admin_url(),PHP_URL_HOST));//30 days
192
- /*
193
- $spCookie = isset($response['cookies']['AffiliateShortPixel']) ? $response['cookies']['AffiliateShortPixel'] : false;
194
- if($spCookie) {
195
- setcookie("AffiliateShortPixel", $spCookie, time() + 2592000, "/", parse_url(get_site_url(),PHP_URL_HOST));//30 days
196
- }
197
- */
198
-
199
- exit(json_encode(array("Status" => 2)));
200
  }
201
  }
202
 
203
- // Add Epsilon Smart Notification
204
- require_once 'class-emr-smart-notification.php';
205
- EMR_Smart_Notification::get_instance( array(
206
- 'plugins' => array(
207
- 'shortpixel-image-optimiser' => array(
208
- 'name' => __( 'ShortPixel Image Optimizer', 'enable-media-replace' ),
209
- 'description' => __( 'A freemium easy to use, comprehensive, stable and frequently updated image compression plugin supported by the friendly team that created it.', 'enable-media-replace' ),
210
- 'image' => plugins_url('/img/shortpixel.png',__FILE__),
211
- ),
212
- 'modula-best-grid-gallery' => array(
213
- 'name' => __( 'Modula WordPress Photo Gallery', 'enable-media-replace' ),
214
- 'description' => __( 'Modula is currently the easiest and fastest photo gallery plugin for WordPress. With its wizard you are able to build an image gallery in a few seconds, unlike many other WordPress gallery plugins.', 'enable-media-replace' ),
215
- 'image' => plugins_url('/img/wp-modula.jpg',__FILE__),
216
- ),
217
- ),
218
-
219
- ) );
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/enable-media-replace
5
  Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
+ Version: 3.2.5
7
  Author: ShortPixel
8
  Author URI: https://shortpixel.com
9
 
26
  add_action('admin_menu', 'emr_menu');
27
  add_filter('attachment_fields_to_edit', 'enable_media_replace', 10, 2);
28
  add_filter('media_row_actions', 'add_media_action', 10, 2);
29
+
30
+ add_action('admin_notices', 'emr_display_notices');
31
+ add_action('network_admin_notices', 'emr_display_network_notices');
32
+ add_action('wp_ajax_emr_dismiss_notices', 'emr_dismiss_notices');
33
+ //add_action('wp_ajax_emr_install_plugin', 'emr_install_plugin');
34
+ //add_action( 'admin_enqueue_scripts', 'emr_add_js' );
35
 
36
  add_shortcode('file_modified', 'emr_get_modified_date');
37
 
38
  if(!defined("SHORTPIXEL_AFFILIATE_CODE")) {
39
  define("SHORTPIXEL_AFFILIATE_CODE", 'VKG6LYN28044');
40
  }
 
 
 
 
 
 
 
 
 
 
 
41
  /**
42
  * Register this file in WordPress so we can call it with a ?page= GET var.
43
  * To suppress it in the menu we give it an empty menu title.
167
  }
168
  add_action( 'attachment_submitbox_misc_actions', 'ua_admin_date_replaced_media_on_edit_media_screen', 91 );
169
 
170
+ /*----------------------------------------------------------------------------------------------------------
171
+ Display/dismiss admin notices if needed
172
+ -----------------------------------------------------------------------------------------------------------*/
173
+
174
+ function emr_display_notices() {
175
+ $current_screen = get_current_screen();
176
+
177
+ $crtScreen = function_exists("get_current_screen") ? get_current_screen() : (object)array("base" => false);
178
+
179
+ if(current_user_can( 'activate_plugins' ) && !get_option( 'emr_news') && !is_plugin_active('shortpixel-image-optimiser/wp-shortpixel.php')
180
+ && ($crtScreen->base == "upload" || $crtScreen->base == "plugins")
181
+ //for network installed plugins, don't display the message on subsites.
182
+ && !(function_exists('is_multisite') && is_multisite() && is_plugin_active_for_network('enable-media-replace/enable-media-replace.php') && !is_main_site()))
183
+ {
184
+ require_once( str_replace("enable-media-replace.php", "notice.php", __FILE__) );
185
+ }
186
+ }
187
+
188
+ function emr_display_network_notices() {
189
+ if(current_user_can( 'activate_plugins' ) && !get_option( 'emr_news') && !is_plugin_active_for_network('shortpixel-image-optimiser/wp-shortpixel.php')) {
190
+ require_once( str_replace("enable-media-replace.php", "notice.php", __FILE__) );
 
 
 
191
  }
192
  }
193
 
194
+ function emr_dismiss_notices() {
195
+ update_option( 'emr_news', true);
196
+ exit(json_encode(array("Status" => 0)));
197
+ }
198
+
199
+ /*function emr_add_js($hook) {
200
+ if("media_page_enable-media-replace/enable-media-replace" == $hook) {
201
+ wp_enqueue_script('emr-plugin-install', plugins_url('/js/plugin-install.js',__FILE__), array( 'jquery', 'updates' ), '1.0.0', 'all' );
202
+ }
203
+ }*/
 
 
 
 
 
 
 
img/wp-modula.jpg DELETED
Binary file
js/plugin-install.js DELETED
@@ -1,71 +0,0 @@
1
- (function( wp, $ ) {
2
- 'use strict';
3
-
4
- if ( ! wp ) {
5
- return;
6
- }
7
-
8
- function activatePlugin( url, el ,elInfo) {
9
- var message = el.data( 'message' );
10
- var link = el.data( 'add-link' );
11
- el.removeClass('emr-plugin-button');
12
- var linkName = el.data( 'add-link-name' );
13
-
14
- $.ajax( {
15
- async: true,
16
- type: 'GET',
17
- dataType: 'html',
18
- url: url,
19
- success: function() {
20
- el.removeClass( 'emr-updating' );
21
- el.text( message );
22
- elInfo.after("<br><br><a href='" + link + "' target='_blank'>" + linkName + "</a>");
23
- }
24
- } );
25
- }
26
-
27
- function emrInstallPlugin(slug) {
28
- var data = { action : 'emr_install_plugin', slug: slug};
29
- jQuery.get(ajaxurl, data, function(response) {
30
- console.log(response);
31
- });
32
- }
33
-
34
- $( function() {
35
- $( document ).on( 'click', '.emr-plugin-button', function( event ) {
36
- var action = $( this ).data( 'action' ),
37
- url = $( this ).attr( 'href' ),
38
- slug = $( this ).data( 'slug' );
39
-
40
- event.preventDefault();
41
-
42
- if ( 'install' === action ) {
43
-
44
- $( this ).addClass( 'emr-updating disabled' );
45
-
46
- wp.updates.installPlugin( {
47
- slug: slug
48
- } );
49
-
50
- } else if ( 'activate' === action ) {
51
-
52
- $( this ).addClass( 'emr-updating disabled' );
53
- emrInstallPlugin(slug);
54
- activatePlugin( url, $( this ), $("#" + slug +"-info"));
55
-
56
- }
57
-
58
- } );
59
-
60
- $( document ).on( 'wp-plugin-install-success', function( response, data ) {
61
- var el = $( '.emr-plugin-button[data-slug="' + data.slug + '"]' );
62
- emrInstallPlugin(data.slug);
63
- activatePlugin( data.activateUrl, el , $("#" + data.slug + "-info"));
64
- if(typeof event !== 'undefined') {
65
- event.preventDefault();
66
- }
67
- } );
68
-
69
- } );
70
- })( window.wp, jQuery );
71
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
popup.php CHANGED
@@ -74,10 +74,7 @@ $current_filename = substr($current_filename, (strrpos($current_filename, "/") +
74
  <?php _e("Get more Google love by compressing your site's images! Check out how much ShortPixel can save your site and get +50% credits when signing up as an Enable Media Replace user! Forever!", "enable-media-replace"); ?>
75
  </div>
76
  <div class=""><div style="text-align: right;">
77
- <a href="#" data-action="install" data-slug="shortpixel-image-optimiser" data-message="Activated" data-add-link="options-general.php?page=wp-shortpixel" data-add-link-name="ShortPixel options" class="button-primary emr-plugin-button ">
78
- <?php _e("Install &amp; Activate", "enable-media-replace"); ?>
79
- </a>
80
- <a class="button button-secondary" id="shortpixel-image-optimiser-info" href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
81
  <?php _e("More info", "enable-media-replace"); ?></p>
82
  </a>
83
  </div>
74
  <?php _e("Get more Google love by compressing your site's images! Check out how much ShortPixel can save your site and get +50% credits when signing up as an Enable Media Replace user! Forever!", "enable-media-replace"); ?>
75
  </div>
76
  <div class=""><div style="text-align: right;">
77
+ <a class="button button-primary" id="shortpixel-image-optimiser-info" href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
 
 
 
78
  <?php _e("More info", "enable-media-replace"); ?></p>
79
  </a>
80
  </div>
readme.txt CHANGED
@@ -42,6 +42,9 @@ If you want more control over the format used to display the time, you can use t
42
 
43
  == Changelog ==
44
 
 
 
 
45
  = 3.2.4 =
46
  * Fix PDF thumbnails not replaced when replacing a PDF
47
  * Fix not replacing text files with .dat extension
42
 
43
  == Changelog ==
44
 
45
+ = 3.2.5 =
46
+ * remove the leftover setcookie and the plugins recommendations.
47
+
48
  = 3.2.4 =
49
  * Fix PDF thumbnails not replaced when replacing a PDF
50
  * Fix not replacing text files with .dat extension
upload.php CHANGED
@@ -37,12 +37,6 @@ function emr_delete_current_files( $current_file, $metadta = null ) {
37
  // Delete old resized versions if this was an image
38
  $suffix = substr($current_file, (strlen($current_file)-4));
39
  $prefix = substr($current_file, 0, (strlen($current_file)-4));
40
-
41
- if (strtolower($suffix) === ".pdf") {
42
- $prefix .= "-pdf";
43
- $suffix = ".jpg";
44
- }
45
-
46
  $imgAr = array(".png", ".gif", ".jpg");
47
  if (in_array($suffix, $imgAr)) {
48
  // It's a png/gif/jpg based on file name
@@ -200,9 +194,8 @@ function emr_normalize_file_urls( $old, $new ) {
200
  }
201
 
202
  // Get old guid and filetype from DB
203
- $sql = "SELECT post_mime_type FROM $table_name WHERE ID = '" . (int) $_POST["ID"] . "'";
204
- list($current_filetype) = $wpdb->get_row($sql, ARRAY_N);
205
- $current_filename = wp_get_attachment_url($_POST['ID']);
206
 
207
  // Massage a bunch of vars
208
  $current_guid = $current_filename;
37
  // Delete old resized versions if this was an image
38
  $suffix = substr($current_file, (strlen($current_file)-4));
39
  $prefix = substr($current_file, 0, (strlen($current_file)-4));
 
 
 
 
 
 
40
  $imgAr = array(".png", ".gif", ".jpg");
41
  if (in_array($suffix, $imgAr)) {
42
  // It's a png/gif/jpg based on file name
194
  }
195
 
196
  // Get old guid and filetype from DB
197
+ $sql = "SELECT guid, post_mime_type FROM $table_name WHERE ID = '" . (int) $_POST["ID"] . "'";
198
+ list($current_filename, $current_filetype) = $wpdb->get_row($sql, ARRAY_N);
 
199
 
200
  // Massage a bunch of vars
201
  $current_guid = $current_filename;