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 +13 -41 1.6.261.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 */
@@ -167,11 +139,10 @@
167 139 $field['recaptcha_theme'] = isset( $field['recaptcha_theme'] ) ? $field['recaptcha_theme'] : 'light';
168 140 }
169 141
170 142 // Check if meta_key has changed when saving form compared current entries
171 - if ( isset( $field['name'] ) ) {
172 - $field['original_name'] = $field['name'];
173 - }
143 + $field['original_name'] = $field['name'];
144 +
174 145 $form_fields[] = apply_filters( 'weforms-get-form-field', $field, $this->id );
175 146 }
176 147
177 148 $this->form_fields = apply_filters( 'weforms-get-form-fields', $form_fields, $this->id );
@@ -401,11 +372,11 @@
401 372
402 373 /**
403 374 * When a user is editing their form they may change a fields name.
404 375 * This method will loop through existing entries to match the new field names.
405 - *
376 + *
406 377 * @since 1.6.9
407 - *
378 + *
408 379 * @param int $form_id
409 380 * @param array $form_fields
410 381 */
411 382 public function maybe_update_entries( $form_fields ) {
@@ -414,18 +385,18 @@
414 385 foreach ( $changed_fields as $old => $new) {
415 386 $updated_fields = $this->rename_field( $old, $new );
416 387 }
417 388 }
418 -
389 +
419 390 /**
420 391 * When a user is editing their form they may change a fields name.
421 392 * This method will loop through all fields that have changed.
422 - *
393 + *
423 394 * @since 1.6.9
424 - *
395 + *
425 396 * @param int $form_id
426 397 * @param array $form_fields
427 - *
398 + *
428 399 * @return array
429 400 */
430 401 public function get_changed_fields( $form_fields ) {
431 402 $changed_fields = array();
@@ -430,8 +401,9 @@
430 401 public function get_changed_fields( $form_fields ) {
431 402 $changed_fields = array();
432 403 foreach ( $form_fields as $field ) {
433 404 $org_field = $field['original_name'];
405 + error_log("Org Field" . " = " . print_r($org_field,1));
434 406 // All form fields should have an original name.
435 407 if ( empty( $field['original_name'] ) ) {
436 408 continue;
437 409 }
@@ -447,14 +419,14 @@
447 419
448 420 /**
449 421 * When a user changes the field names of a form, the existing entries will need updated.
450 422 * This method will loop through the existing entries and update them will the new names.
451 - *
423 + *
452 424 * @since 1.6.9
453 - *
425 + *
454 426 * @param int $form_id
455 427 * @param array $form_fields
456 - *
428 + *
457 429 * @return array
458 430 */
459 431 public function rename_field ( $old, $new ) {
460 432 global $wpdb;
@@ -460,9 +432,9 @@
460 432 global $wpdb;
461 433
462 434 $entries = weforms_get_form_entries( $this->id );
463 435
464 - foreach ( $entries as $entry ) {
436 + foreach ( $entries as $entry ) {
465 437 $entry_id = $entry->id;
466 438 $values = weforms_get_entry_meta( $entry_id );
467 439 $update_keys = $wpdb->update( $wpdb->weforms_entrymeta, array( 'meta_key' => $new ), array( 'meta_key' => $old, 'weforms_entry_id' => $entry_id ) );
468 440 }