| @@ -995,10 +995,13 @@ | ||
| 995 | 995 | } |
| 996 | 996 | } |
| 997 | 997 | } |
| 998 | 998 | $meta_key_table = apply_filters( 'usces_filter_uploadcsv_delete_postmeta', $meta_key_table ); |
| 999 | - $query = $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_key IN ( %s ) AND post_id = %d", implode( "','", $meta_key_table ), $post_id ); | |
| 1000 | - $query = stripslashes( $query ); | |
| 999 | + $meta_key_table = array_values( $meta_key_table ); | |
| 1000 | + $placeholders = implode( ', ', array_fill( 0, count( $meta_key_table ), '%s' ) ); | |
| 1001 | + $prepare_args = $meta_key_table; | |
| 1002 | + $prepare_args[] = $post_id; | |
| 1003 | + $query = $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_key IN ( {$placeholders} ) AND post_id = %d", $prepare_args ); | |
| 1001 | 1004 | $db_res = $wpdb->query( $query ); |
| 1002 | 1005 | if ( false === $db_res ) { |
| 1003 | 1006 | ++$err_num; |
| 1004 | 1007 | $pre_code = $item_code; |
| @@ -2513,9 +2516,9 @@ | ||
| 2513 | 2516 | |
| 2514 | 2517 | $product = wel_get_product( $row['ID'] ); |
| 2515 | 2518 | $metas = $product['_ext']; |
| 2516 | 2519 | foreach ( $metas as $key => $value ) { |
| 2517 | - if ( '' === $key || '_' === substr( $key, 0, 1 ) || is_array( maybe_unserialize( $key ) ) ) { | |
| 2520 | + if ( '' === $key || '_' === substr( $key, 0, 1 ) || is_array( wel_safe_maybe_unserialize( $key ) ) ) { | |
| 2518 | 2521 | continue; |
| 2519 | 2522 | } |
| 2520 | 2523 | $meta_keys[ $key ] = 'null'; |
| 2521 | 2524 | } |
| @@ -2532,9 +2535,9 @@ | ||
| 2532 | 2535 | $new['item_code'] = $product['itemCode']; |
| 2533 | 2536 | $new['item_name'] = $product['itemName']; |
| 2534 | 2537 | |
| 2535 | 2538 | foreach ( $metas as $key => $values ) { |
| 2536 | - if ( '' === $key || '_' === substr( $key, 0, 1 ) || is_array( maybe_unserialize( $key ) ) ) { | |
| 2539 | + if ( '' === $key || '_' === substr( $key, 0, 1 ) || is_array( wel_safe_maybe_unserialize( $key ) ) ) { | |
| 2537 | 2540 | continue; |
| 2538 | 2541 | } |
| 2539 | 2542 | $vc = is_array( $values ) ? count( $values ) : 0; |
| 2540 | 2543 | if ( is_array( $values ) && 1 < $vc ) { |