Plugin Directory

Changeset 3378767


Ignore:
Timestamp:
10/15/2025 09:39:02 AM (3 months ago)
Author:
wssoffice21
Message:

fixed new code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ymc-smart-filter/trunk/ymc2/src/frontend/FG_Ajax_Responder.php

    r3378741 r3378767  
    4545        check_ajax_referer('get_filtered_posts-ajax-nonce', 'nonce_code');
    4646
    47         $params = isset($_POST['params']) ? json_decode(stripslashes($_POST['params']), true) : [];
     47        //$params = isset($_POST['params']) ? json_decode(stripslashes($_POST['params']), true) : [];
     48
     49        $params = [];
     50        if (isset($_POST['params'])) {
     51            $raw_params = wp_unslash($_POST['params']);
     52            $params = json_decode($raw_params, true);
     53            if (json_last_error() !== JSON_ERROR_NONE) {
     54                wp_send_json_error([
     55                    'message' => __('Invalid JSON format in request.', 'ymc-smart-filter')
     56                ], 400);
     57            }
     58        }
    4859
    4960        if (empty($params) || !is_array($params) || empty($params['filter_id'])) {
Note: See TracChangeset for help on using the changeset viewer.