PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.15
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.15
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmEntryValues.php +26 -57 6.255.0.15 View file →
@@ -8,11 +8,11 @@
8 8 */
9 9 class FrmEntryValues {
10 10
11 11 /**
12 - * @var stdClass|null
12 + * @var stdClass
13 13 */
14 - protected $entry;
14 + protected $entry = null;
15 15
16 16 /**
17 17 * @var int
18 18 */
@@ -48,9 +48,9 @@
48 48 *
49 49 * @since 2.04
50 50 *
51 51 * @param int|string $entry_id
52 - * @param array $atts
52 + * @param array $atts
53 53 */
54 54 public function __construct( $entry_id, $atts = array() ) {
55 55 if ( isset( $atts['entry'] ) && is_object( $atts['entry'] ) && ! empty( $atts['entry']->metas ) ) {
56 56 $this->entry = $atts['entry'];
@@ -75,10 +75,8 @@
75 75 *
76 76 * @since 2.04
77 77 *
78 78 * @param int|string $entry_id
79 - *
80 - * @return void
81 79 */
82 80 protected function init_entry( $entry_id ) {
83 81 $this->entry = FrmEntry::getOne( $entry_id, true );
84 82 }
@@ -83,23 +81,11 @@
83 81 $this->entry = FrmEntry::getOne( $entry_id, true );
84 82 }
85 83
86 84 /**
87 - * Gets entry property.
88 - *
89 - * @since 5.0.16
90 - * @return stdClass
91 - */
92 - public function get_entry() {
93 - return $this->entry;
94 - }
95 -
96 - /**
97 85 * Set the form_id property
98 86 *
99 87 * @since 2.04
100 - *
101 - * @return void
102 88 */
103 89 protected function init_form_id() {
104 90 $this->form_id = (int) $this->entry->form_id;
105 91 }
@@ -109,25 +95,27 @@
109 95 *
110 96 * @since 2.04
111 97 *
112 98 * @param array $atts
113 - *
114 - * @return void
115 99 */
116 100 protected function init_include_fields( $atts ) {
117 101
118 - // For reverse compatibility with the fields parameter.
119 - if ( empty( $atts['include_fields'] ) && ! empty( $atts['fields'] ) ) {
120 - if ( ! is_array( $atts['fields'] ) ) {
121 - $atts['include_fields'] = $atts['fields'];
122 - } else {
123 - $atts['include_fields'] = '';
102 + // For reverse compatibility with the fields parameter
103 + if ( ! isset( $atts['include_fields'] ) || empty( $atts['include_fields'] ) ) {
124 104
125 - foreach ( $atts['fields'] as $included_field ) {
126 - $atts['include_fields'] .= $included_field->id . ',';
105 + if ( isset( $atts['fields'] ) && ! empty( $atts['fields'] ) ) {
106 +
107 + if ( ! is_array( $atts['fields'] ) ) {
108 + $atts['include_fields'] = $atts['fields'];
109 + } else {
110 + $atts['include_fields'] = '';
111 +
112 + foreach ( $atts['fields'] as $included_field ) {
113 + $atts['include_fields'] .= $included_field->id . ',';
114 + }
115 +
116 + $atts['include_fields'] = rtrim( $atts['include_fields'], ',' );
127 117 }
128 -
129 - $atts['include_fields'] = rtrim( $atts['include_fields'], ',' );
130 118 }
131 119 }
132 120
133 121 $this->include_fields = $this->prepare_array_property( 'include_fields', $atts );
@@ -148,10 +136,8 @@
148 136 *
149 137 * @since 2.04
150 138 *
151 139 * @param array $atts
152 - *
153 - * @return void
154 140 */
155 141 protected function init_exclude_fields( $atts ) {
156 142 $this->exclude_fields = $this->prepare_array_property( 'exclude_fields', $atts );
157 143
@@ -171,14 +157,14 @@
171 157 *
172 158 * @since 2.04
173 159 *
174 160 * @param string $index
175 - * @param array $atts
161 + * @param array $atts
176 162 *
177 163 * @return array
178 164 */
179 165 private function prepare_array_property( $index, $atts ) {
180 - if ( ! empty( $atts[ $index ] ) ) {
166 + if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) {
181 167
182 168 if ( is_array( $atts[ $index ] ) ) {
183 169 $property = $atts[ $index ];
184 170 } else {
@@ -194,10 +180,8 @@
194 180 /**
195 181 * Set the fields property
196 182 *
197 183 * @since 2.04
198 - *
199 - * @return void
200 184 */
201 185 protected function init_fields() {
202 186 $this->fields = FrmField::get_all_for_form( $this->form_id, '', 'exclude', 'exclude' );
203 187
@@ -222,10 +206,8 @@
222 206 /**
223 207 * Set the field_values property
224 208 *
225 209 * @since 2.04
226 - *
227 - * @return void
228 210 */
229 211 protected function init_field_values() {
230 212 foreach ( $this->fields as $field ) {
231 213 if ( $this->is_field_included( $field ) ) {
@@ -248,10 +230,8 @@
248 230 /**
249 231 * Set the user_info property
250 232 *
251 233 * @since 2.04
252 - *
253 - * @return void
254 234 */
255 235 protected function init_user_info() {
256 236 if ( isset( $this->entry->description ) ) {
257 237 $entry_description = (array) $this->entry->description;
@@ -261,32 +241,23 @@
261 241 'referrer' => '',
262 242 );
263 243 }
264 244
265 - $ip = array(
245 + $ip = array(
266 246 'label' => __( 'IP Address', 'formidable' ),
267 247 'value' => $this->entry->ip,
268 248 );
269 - $browser = array(
249 +
250 + $browser = array(
270 251 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ),
271 - 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '',
252 + 'value' => FrmEntriesHelper::get_browser( $entry_description['browser'] ),
272 253 );
254 +
273 255 $referrer = array(
274 256 'label' => __( 'Referrer', 'formidable' ),
275 - 'value' => $entry_description['referrer'] ?? '',
257 + 'value' => $entry_description['referrer'],
276 258 );
277 259
278 - /**
279 - * Allow the referrer to be modified.
280 - *
281 - * @since 5.5.1
282 - *
283 - * @param array $referrer
284 - * @param array $entry_description
285 - * @param object $entry
286 - */
287 - $referrer = apply_filters( 'frm_user_info_referrer', $referrer, $entry_description, $this->entry );
288 -
289 260 $this->user_info = array(
290 261 'ip' => $ip,
291 262 'browser' => $browser,
292 263 'referrer' => $referrer,
@@ -334,9 +305,9 @@
334 305 *
335 306 * @since 2.04
336 307 *
337 308 * @param stdClass $field
338 - * @param array $array
309 + * @param array $array
339 310 *
340 311 * @return bool
341 312 */
342 313 protected function is_field_in_array( $field, $array ) {
@@ -348,10 +319,8 @@
348 319 *
349 320 * @since 2.04
350 321 *
351 322 * @param stdClass $field
352 - *
353 - * @return void
354 323 */
355 324 protected function add_field_values( $field ) {
356 325 $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry );
357 326 }