Plugin Directory

Changeset 2344285


Ignore:
Timestamp:
07/21/2020 06:56:27 PM (6 years ago)
Author:
swain.tara
Message:

Supports 5.4.2

Location:
find-and-replace-all/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • find-and-replace-all/trunk/frform.php

    r1771708 r2344285  
    33    die;
    44}
     5
    56$findstr = isset($_POST['findstr']) ? stripslashes_deep($_POST['findstr']) : '';
    67$replacestr = isset($_POST['replacestr']) ? stripslashes_deep($_POST['replacestr']) : '';
     
    3334                            $unserialized = array_value_replace($unserialized, $findstr, $replacestr);
    3435                            $updatesql = $wpdb->prepare("UPDATE $table SET `$field` = %s WHERE `$primary_column`='$primary_id'", array(serialize($unserialized)));
     36                            $wpdb->get_results($updatesql);
     37                        }
     38                    } else if (fra_is_JSON($cresult->$field)) {
     39                        $jsondata = @json_decode($cresult->$field);
     40                        if (is_array($jsondata)) {
     41                            $jsondata = array_value_replace($jsondata, $findstr, $replacestr);
     42                            $updatesql = $wpdb->prepare("UPDATE $table SET `$field` = %s WHERE `$primary_column`='$primary_id'", array(json_encode($jsondata)));
    3543                            $wpdb->get_results($updatesql);
    3644                        }
  • find-and-replace-all/trunk/functions.php

    r1771715 r2344285  
    5858
    5959}
     60
     61if (!function_exists('fra_is_JSON')) {
     62
     63    function fra_is_JSON($string) {
     64        return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false;
     65    }
     66
     67}
  • find-and-replace-all/trunk/readme.txt

    r2182871 r2344285  
    11=== Plugin Name ===
    22Contributors: swain.tara
    3 Donate link: https://www.taraprasad.com
     3Donate link: http://taraprasad.com
    44Tags: find and replace, replace all, all tables, all fields, string replace, URL replace
    5 Requires at least: 4.6
    6 Tested up to: 5.2
     5Requires at least: 5.4
     6Tested up to: 5.4.2
    77Stable tag: 1.2
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.