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-entry-manager.php +40 -89 1.6.211.6.1 View file →
@@ -6,98 +6,49 @@
6 6 * @since 1.1.0
7 7 */
8 8 class WeForms_Form_Entry_Manager {
9 9
10 - /**
11 - * The form id
12 - *
13 - * @var int
14 - */
15 - private $id = 0;
10 + /**
11 + * The form id
12 + *
13 + * @var int
14 + */
15 + private $id = 0;
16 16
17 - /**
18 - * The form object
19 - *
20 - * @var \WeForms_Form
21 - */
22 - private $form;
17 + /**
18 + * The form object
19 + *
20 + * @var \WeForms_Form
21 + */
22 + private $form;
23 23
24 - /**
25 - * The constructor
26 - *
27 - * @param int $form_id
28 - * @param \WeForms_Form $form
29 - */
30 - public function __construct( $form_id, $form ) {
31 - $this->id = $form_id;
32 - $this->form = $form;
33 - }
24 + /**
25 + * The constructor
26 + *
27 + * @param int $form_id
28 + * @param \WeForms_Form $form
29 + */
30 + public function __construct( $form_id, $form ) {
31 + $this->id = $form_id;
32 + $this->form = $form;
33 + }
34 34
35 - /**
36 - * Get all the form entries
37 - *
38 - * @return array
39 - */
40 - public function all() {
41 - return weforms_get_form_entries( $this->id );
42 - }
35 + /**
36 + * Get all the form entries
37 + *
38 + * @return array
39 + */
40 + public function all() {
41 + return weforms_get_form_entries( $this->id );
42 + }
43 43
44 - /**
45 - * Get a single entry
46 - *
47 - * @param int $entry_id
48 - *
49 - * @return mixed
50 - */
51 - public function get( $entry_id ) {
52 - return new WeForms_Form_Entry( $entry_id, $this->form );
53 - }
54 -
55 - /**
56 - * Format Entry Value.
57 - *
58 - * @param array $field Form Field data.
59 - *
60 - * @return array $field Formatted field data values.
61 - */
62 - public static function format_entry_value( $field ) {
63 - switch ( $field['template'] ) {
64 -
65 - case 'radio_field':
66 - $value = array_search( $field['value'], $field['options'], true );
67 - $field['value'] = esc_html( 'Option: ' . $field['value'] . ' - ' . 'Value: ' . $value );
68 -
69 - break;
70 -
71 - case 'checkbox_field':
72 - $field_formatted = array();
73 - foreach ( $field['value'] as $option ) {
74 - $value = array_search( $option, $field['options'], true );
75 - $field_formatted[] = esc_html( 'Option: ' . $option . ' - ' . 'Value: ' . $value );
76 - }
77 - $field['value'] = array_replace( $field['value'], $field_formatted );
78 -
79 - break;
80 -
81 - case 'multiple_select':
82 - $field_formatted = array();
83 - foreach ( $field['value'] as $option ) {
84 - $value = array_search( $option, $field['options'], true );
85 - $field_formatted[] = esc_html( 'Option: ' . $option . ' - ' . 'Value: ' . $value );
86 - }
87 - $field['value'] = array_replace( $field['value'], $field_formatted );
88 -
89 - break;
90 -
91 - case 'dropdown_field':
92 - $value = array_search( $field['value'], $field['options'], true );
93 - $field['value'] = esc_html( 'Option: ' . $field['value'] . ' - ' . 'Value: ' . $value );
94 -
95 - break;
96 -
97 - default:
98 - // Do nothing if value format does not need to be changed.
99 - break;
100 - }
101 - return $field;
102 - }
44 + /**
45 + * Get a single entry
46 + *
47 + * @param int $entry_id
48 + *
49 + * @return mixed
50 + */
51 + public function get( $entry_id ) {
52 + return new WeForms_Form_Entry( $entry_id, $this->form );
53 + }
103 54 }