PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.1
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 -20 1.6.281.6.1 View file →
@@ -473,10 +473,8 @@
473 473 public function required_mark( $field ) {
474 474 if ( $this->is_required( $field ) ) {
475 475 return ' <span class="required">*</span>';
476 476 }
477 -
478 - return '';
479 477 }
480 478
481 479 /**
482 480 * Prints help text for a field
@@ -530,34 +528,23 @@
530 528 *
531 529 * @return mixed
532 530 */
533 531 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'] : '';
532 + if( empty( $_POST['_wpnonce'] ) ) {
533 + wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
538 534 }
539 535
540 - if ( empty( $nonce ) ) {
536 + if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'wpuf_form_add' ) ) {
541 537 wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
542 538 }
543 539
544 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $nonce ) ), 'wpuf_form_add' ) ) {
545 - wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
546 - }
540 + $args = ! empty( $args ) ? $args : weforms_clean( $_POST );
541 + $value = !empty( $args[$field['name']] ) ? $args[$field['name']] : '';
547 542
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 543 if ( is_array( $value ) ) {
557 - $entry_value = implode( WeForms::$field_separator, $value );
544 + $entry_value = implode( WeForms::$field_separator, $args[$field['name']] );
558 545 } else {
559 - $entry_value = sanitize_textarea_field( trim( $value ) );
546 + $entry_value = trim( $value );
560 547 }
561 548
562 549 return $entry_value;
563 550 }