PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.9
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.9
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/class-form.php +14 -45 1.6.271.6.9 View file →
@@ -28,36 +28,8 @@
28 28 */
29 29 public $data = null;
30 30
31 31 /**
32 - * Derived/formatted stats & metadata used by admin/AJAX/API responses.
33 - * Declared explicitly to avoid PHP 8.2 "dynamic property" deprecations.
34 - *
35 - * @var int
36 - */
37 - public $entries = 0;
38 -
39 - /**
40 - * @var array
41 - */
42 - public $settings = [];
43 -
44 - /**
45 - * @var int
46 - */
47 - public $views = 0;
48 -
49 - /**
50 - * @var int
51 - */
52 - public $payments = 0;
53 -
54 - /**
55 - * @var array
56 - */
57 - public $author = [];
58 -
59 - /**
60 32 * Form fields
61 33 *
62 34 * @var array
63 35 */
@@ -125,12 +97,9 @@
125 97
126 98 $form_fields = [];
127 99
128 100 foreach ( $fields as $key => $content ) {
129 - // Security fix: Prevent PHP Object Injection by restricting allowed classes
130 - $field = is_serialized( $content->post_content )
131 - ? @unserialize( $content->post_content, [ 'allowed_classes' => false ] )
132 - : $content->post_content;
101 + $field = maybe_unserialize( $content->post_content );
133 102
134 103 if ( empty( $field['template'] ) ) {
135 104 continue;
136 105 }
@@ -170,11 +139,10 @@
170 139 $field['recaptcha_theme'] = isset( $field['recaptcha_theme'] ) ? $field['recaptcha_theme'] : 'light';
171 140 }
172 141
173 142 // Check if meta_key has changed when saving form compared current entries
174 - if ( isset( $field['name'] ) ) {
175 - $field['original_name'] = $field['name'];
176 - }
143 + $field['original_name'] = $field['name'];
144 +
177 145 $form_fields[] = apply_filters( 'weforms-get-form-field', $field, $this->id );
178 146 }
179 147
180 148 $this->form_fields = apply_filters( 'weforms-get-form-fields', $form_fields, $this->id );
@@ -404,11 +372,11 @@
404 372
405 373 /**
406 374 * When a user is editing their form they may change a fields name.
407 375 * This method will loop through existing entries to match the new field names.
408 - *
376 + *
409 377 * @since 1.6.9
410 - *
378 + *
411 379 * @param int $form_id
412 380 * @param array $form_fields
413 381 */
414 382 public function maybe_update_entries( $form_fields ) {
@@ -417,18 +385,18 @@
417 385 foreach ( $changed_fields as $old => $new) {
418 386 $updated_fields = $this->rename_field( $old, $new );
419 387 }
420 388 }
421 -
389 +
422 390 /**
423 391 * When a user is editing their form they may change a fields name.
424 392 * This method will loop through all fields that have changed.
425 - *
393 + *
426 394 * @since 1.6.9
427 - *
395 + *
428 396 * @param int $form_id
429 397 * @param array $form_fields
430 - *
398 + *
431 399 * @return array
432 400 */
433 401 public function get_changed_fields( $form_fields ) {
434 402 $changed_fields = array();
@@ -433,8 +401,9 @@
433 401 public function get_changed_fields( $form_fields ) {
434 402 $changed_fields = array();
435 403 foreach ( $form_fields as $field ) {
436 404 $org_field = $field['original_name'];
405 + error_log("Org Field" . " = " . print_r($org_field,1));
437 406 // All form fields should have an original name.
438 407 if ( empty( $field['original_name'] ) ) {
439 408 continue;
440 409 }
@@ -450,14 +419,14 @@
450 419
451 420 /**
452 421 * When a user changes the field names of a form, the existing entries will need updated.
453 422 * This method will loop through the existing entries and update them will the new names.
454 - *
423 + *
455 424 * @since 1.6.9
456 - *
425 + *
457 426 * @param int $form_id
458 427 * @param array $form_fields
459 - *
428 + *
460 429 * @return array
461 430 */
462 431 public function rename_field ( $old, $new ) {
463 432 global $wpdb;
@@ -463,9 +432,9 @@
463 432 global $wpdb;
464 433
465 434 $entries = weforms_get_form_entries( $this->id );
466 435
467 - foreach ( $entries as $entry ) {
436 + foreach ( $entries as $entry ) {
468 437 $entry_id = $entry->id;
469 438 $values = weforms_get_entry_meta( $entry_id );
470 439 $update_keys = $wpdb->update( $wpdb->weforms_entrymeta, array( 'meta_key' => $new ), array( 'meta_key' => $old, 'weforms_entry_id' => $entry_id ) );
471 440 }