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/class-form.php +3 -104 1.6.261.6.1 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 */
@@ -166,16 +138,12 @@
166 138 $field['enable_no_captcha'] = isset( $field['enable_no_captcha'] ) ? $field['enable_no_captcha'] : '';
167 139 $field['recaptcha_theme'] = isset( $field['recaptcha_theme'] ) ? $field['recaptcha_theme'] : 'light';
168 140 }
169 141
170 - // Check if meta_key has changed when saving form compared current entries
171 - if ( isset( $field['name'] ) ) {
172 - $field['original_name'] = $field['name'];
173 - }
174 - $form_fields[] = apply_filters( 'weforms-get-form-field', $field, $this->id );
142 + $form_fields[] = apply_filters( 'weforms-get-form-field', $field );
175 143 }
176 144
177 - $this->form_fields = apply_filters( 'weforms-get-form-fields', $form_fields, $this->id );
145 + $this->form_fields = apply_filters( 'weforms-get-form-fields', $form_fields );
178 146
179 147 return $this->form_fields;
180 148 }
181 149
@@ -302,9 +270,9 @@
302 270 public function get_settings() {
303 271 $settings = get_post_meta( $this->id, 'wpuf_form_settings', true );
304 272 $default = weforms_get_default_form_settings();
305 273
306 - return apply_filters( 'weforms-get-form-settings', array_merge( $default, $settings ), $this->id );
274 + return array_merge( $default, $settings );
307 275 }
308 276
309 277 /**
310 278 * Check if the form submission is open
@@ -396,77 +364,8 @@
396 364 * @return \WeForms_Form_Entry_Manager
397 365 */
398 366 public function entries() {
399 367 return new WeForms_Form_Entry_Manager( $this->id, $this );
400 - }
401 -
402 - /**
403 - * When a user is editing their form they may change a fields name.
404 - * This method will loop through existing entries to match the new field names.
405 - *
406 - * @since 1.6.9
407 - *
408 - * @param int $form_id
409 - * @param array $form_fields
410 - */
411 - public function maybe_update_entries( $form_fields ) {
412 - $changed_fields = $this->get_changed_fields( $form_fields );
413 - // Loop through changed fields and update entries
414 - foreach ( $changed_fields as $old => $new) {
415 - $updated_fields = $this->rename_field( $old, $new );
416 - }
417 - }
418 -
419 - /**
420 - * When a user is editing their form they may change a fields name.
421 - * This method will loop through all fields that have changed.
422 - *
423 - * @since 1.6.9
424 - *
425 - * @param int $form_id
426 - * @param array $form_fields
427 - *
428 - * @return array
429 - */
430 - public function get_changed_fields( $form_fields ) {
431 - $changed_fields = array();
432 - foreach ( $form_fields as $field ) {
433 - $org_field = $field['original_name'];
434 - // All form fields should have an original name.
435 - if ( empty( $field['original_name'] ) ) {
436 - continue;
437 - }
438 - if ( $field['name'] !== $field['original_name'] ) {
439 - $changed_fields[$field['original_name']] = $field['name'];
440 - } else {
441 - continue;
442 - }
443 - }
444 - return $changed_fields;
445 -
446 - }
447 -
448 - /**
449 - * When a user changes the field names of a form, the existing entries will need updated.
450 - * This method will loop through the existing entries and update them will the new names.
451 - *
452 - * @since 1.6.9
453 - *
454 - * @param int $form_id
455 - * @param array $form_fields
456 - *
457 - * @return array
458 - */
459 - public function rename_field ( $old, $new ) {
460 - global $wpdb;
461 -
462 - $entries = weforms_get_form_entries( $this->id );
463 -
464 - foreach ( $entries as $entry ) {
465 - $entry_id = $entry->id;
466 - $values = weforms_get_entry_meta( $entry_id );
467 - $update_keys = $wpdb->update( $wpdb->weforms_entrymeta, array( 'meta_key' => $new ), array( 'meta_key' => $old, 'weforms_entry_id' => $entry_id ) );
468 - }
469 368 }
470 369
471 370 /**
472 371 * Get number of form entries