Enable Media Replace - Version 3.3.10

Version Description

Download this release

Release Info

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

Code changes from version 3.3.9 to 3.3.10

Files changed (3) hide show
  1. classes/replacer.php +9 -8
  2. enable-media-replace.php +2 -2
  3. readme.txt +5 -0
classes/replacer.php CHANGED
@@ -508,16 +508,17 @@ class Replacer
508
509
if ($isJson)
510
{
511
$content = json_decode($content);
512
}
513
514
if (is_string($content)) // let's check the normal one first.
515
{
516
- return str_replace($search, $replace, $content);
517
}
518
elseif (is_wp_error($content)) // seen this.
519
{
520
- return $content; // do nothing.
521
}
522
elseif (is_array($content) ) // array metadata and such.
523
{
@@ -525,7 +526,7 @@ class Replacer
525
{
526
$content[$index] = $this->replaceContent($value, $search, $replace); //str_replace($value, $search, $replace);
527
}
528
- return $content;
529
}
530
elseif(is_object($content)) // metadata objects, they exist.
531
{
@@ -533,13 +534,15 @@ class Replacer
533
{
534
$content->{$key} = $this->replaceContent($value, $search, $replace); //str_replace($value, $search, $replace);
535
}
536
- return $content;
537
}
538
539
if ($isJson) // convert back to JSON, if this was JSON. Different than serialize which does WP automatically.
540
{
541
Log::addDebug('Value was found to be JSON, encoding');
542
- $content = json_encode($content);
543
}
544
545
return $content;
@@ -571,9 +574,7 @@ class Replacer
571
return false; // can never be.
572
573
$json = json_decode($content);
574
- $json = is_string($content) && json_decode($content);
575
-
576
- return $json && $content != $json;
577
}
578
579
// Get REL Urls of both source and target.
508
509
if ($isJson)
510
{
511
+ Log::addDebug('Found JSON Content');
512
$content = json_decode($content);
513
}
514
515
if (is_string($content)) // let's check the normal one first.
516
{
517
+ $content = str_replace($search, $replace, $content);
518
}
519
elseif (is_wp_error($content)) // seen this.
520
{
521
+ //return $content; // do nothing.
522
}
523
elseif (is_array($content) ) // array metadata and such.
524
{
526
{
527
$content[$index] = $this->replaceContent($value, $search, $replace); //str_replace($value, $search, $replace);
528
}
529
+ //return $content;
530
}
531
elseif(is_object($content)) // metadata objects, they exist.
532
{
534
{
535
$content->{$key} = $this->replaceContent($value, $search, $replace); //str_replace($value, $search, $replace);
536
}
537
+ //return $content;
538
}
539
540
if ($isJson) // convert back to JSON, if this was JSON. Different than serialize which does WP automatically.
541
{
542
Log::addDebug('Value was found to be JSON, encoding');
543
+ // wp-slash -> WP does stripslashes_deep which destroys JSON
544
+ $content = wp_slash(json_encode($content, JSON_UNESCAPED_SLASHES));
545
+ Log::addDebug('Content returning', array($content));
546
}
547
548
return $content;
574
return false; // can never be.
575
576
$json = json_decode($content);
577
+ return $json && $json != $content;
578
}
579
580
// Get REL Urls of both source and target.
enable-media-replace.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Enable Media Replace
4
Plugin URI: https://wordpress.org/plugins/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.3.9
7
Author: ShortPixel
8
Author URI: https://shortpixel.com
9
Text Domain: enable-media-replace
@@ -25,7 +25,7 @@ http://www.gnu.org/licenses/gpl.html
25
*/
26
27
namespace EnableMediaReplace;
28
- define('EMR_VERSION', '3.3.9');
29
30
if ( ! defined( 'ABSPATH' ) ) {
31
exit; // Exit if accessed directly.
3
Plugin Name: Enable Media Replace
4
Plugin URI: https://wordpress.org/plugins/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.3.10
7
Author: ShortPixel
8
Author URI: https://shortpixel.com
9
Text Domain: enable-media-replace
25
*/
26
27
namespace EnableMediaReplace;
28
+ define('EMR_VERSION', '3.3.10');
29
30
if ( ! defined( 'ABSPATH' ) ) {
31
exit; // Exit if accessed directly.
readme.txt CHANGED
@@ -49,8 +49,13 @@ If you want more control over the format used to display the time, you can use t
49
50
= 3.3.9 =
51
52
Release date: 19th February 2020
53
* Fix issue with search/replacing non-image attachments and query
54
55
= 3.3.8 =
56
49
50
= 3.3.9 =
51
52
+ Release date: 23rd February 2020
53
+ * Fix issue with JSON encoded strings
54
+ * Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted
55
+
56
Release date: 19th February 2020
57
* Fix issue with search/replacing non-image attachments and query
58
+ * Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted
59
60
= 3.3.8 =
61