PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.21
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.21
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | includes/fields/class-abstract-fields.php +7 -18 1.6.281.6.21 View file →
@@ -530,34 +530,23 @@
530 530 *
531 531 * @return mixed
532 532 */
533 533 public function prepare_entry( $field, $args = [] ) {
534 - if ( $args instanceof WP_REST_Request ) {
535 - $nonce = $args->get_param( '_wpnonce' );
536 - } else {
537 - $nonce = isset( $_POST['_wpnonce'] ) ? $_POST['_wpnonce'] : '';
534 + if( empty( $_POST['_wpnonce'] ) ) {
535 + wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
538 536 }
539 537
540 - if ( empty( $nonce ) ) {
538 + if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'wpuf_form_add' ) ) {
541 539 wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
542 540 }
543 541
544 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $nonce ) ), 'wpuf_form_add' ) ) {
545 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
546 - }
542 + $args = ! empty( $args ) ? $args : weforms_clean( $_POST );
543 + $value = !empty( $args[$field['name']] ) ? $args[$field['name']] : '';
547 544
548 - if ( $args instanceof WP_REST_Request ) {
549 - $args = weforms_clean( $args->get_params() );
550 - } elseif ( empty( $args ) ) {
551 - $args = weforms_clean( $_POST );
552 - }
553 -
554 - $value = ! empty( $args[ $field['name'] ] ) ? $args[ $field['name'] ] : '';
555 -
556 545 if ( is_array( $value ) ) {
557 - $entry_value = implode( WeForms::$field_separator, $value );
546 + $entry_value = implode( WeForms::$field_separator, $args[$field['name']] );
558 547 } else {
559 - $entry_value = sanitize_textarea_field( trim( $value ) );
548 + $entry_value = trim( $value );
560 549 }
561 550
562 551 return $entry_value;
563 552 }