@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $section['function'] = $original; |
116 | 116 | } |
117 | 117 | |
118 | - $sections[ $key ] = $section; |
|
118 | + $sections[$key] = $section; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $sections; |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
129 | 129 | $sections = self::get_settings_tabs(); |
130 | - if ( ! isset( $sections[ $section ] ) ) { |
|
130 | + if ( ! isset( $sections[$section] ) ) { |
|
131 | 131 | wp_die(); |
132 | 132 | } |
133 | 133 | |
134 | - $section = $sections[ $section ]; |
|
134 | + $section = $sections[$section]; |
|
135 | 135 | |
136 | 136 | if ( isset( $section['class'] ) ) { |
137 | 137 | call_user_func( array( $section['class'], $section['function'] ) ); |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | foreach ( $action_controls as $action ) { |
101 | - if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) { |
|
101 | + if ( isset( $groups[$action->id_base] ) || in_array( $action->id_base, $grouped ) ) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | 105 | $this_group = $action->action_options['group']; |
106 | - if ( ! isset( $groups[ $this_group ] ) ) { |
|
106 | + if ( ! isset( $groups[$this_group] ) ) { |
|
107 | 107 | $this_group = 'misc'; |
108 | 108 | } |
109 | 109 | |
110 | - if ( ! isset( $groups[ $this_group ]['actions'] ) ) { |
|
111 | - $groups[ $this_group ]['actions'] = array(); |
|
110 | + if ( ! isset( $groups[$this_group]['actions'] ) ) { |
|
111 | + $groups[$this_group]['actions'] = array(); |
|
112 | 112 | } |
113 | - $groups[ $this_group ]['actions'][] = $action->id_base; |
|
113 | + $groups[$this_group]['actions'][] = $action->id_base; |
|
114 | 114 | |
115 | 115 | unset( $action ); |
116 | 116 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | return $a; |
242 | 242 | } |
243 | 243 | |
244 | - $actions[ $a->id_base ] = $a; |
|
244 | + $actions[$a->id_base] = $a; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $actions; |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | $action_map = array(); |
273 | 273 | |
274 | 274 | foreach ( $action_controls as $key => $control ) { |
275 | - $action_map[ $control->id_base ] = $key; |
|
275 | + $action_map[$control->id_base] = $key; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | foreach ( $form_actions as $action ) { |
279 | - if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { |
|
279 | + if ( ! isset( $action_map[$action->post_excerpt] ) ) { |
|
280 | 280 | // don't try and show settings if action no longer exists |
281 | 281 | continue; |
282 | 282 | } |
283 | 283 | |
284 | - self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values ); |
|
284 | + self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values ); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | } |
490 | 490 | |
491 | 491 | // Store actions so they can be triggered with the correct priority. |
492 | - $stored_actions[ $action->ID ] = $action; |
|
493 | - $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
|
492 | + $stored_actions[$action->ID] = $action; |
|
493 | + $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority']; |
|
494 | 494 | |
495 | 495 | unset( $action ); |
496 | 496 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | new FrmNotification(); |
503 | 503 | |
504 | 504 | foreach ( $action_priority as $action_id => $priority ) { |
505 | - $action = $stored_actions[ $action_id ]; |
|
505 | + $action = $stored_actions[$action_id]; |
|
506 | 506 | do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event ); |
507 | 507 | do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form ); |
508 | 508 | |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | } |
550 | 550 | |
551 | 551 | public function register( $action_class ) { |
552 | - $this->actions[ $action_class ] = new $action_class(); |
|
552 | + $this->actions[$action_class] = new $action_class(); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | public function unregister( $action_class ) { |
556 | - if ( isset( $this->actions[ $action_class ] ) ) { |
|
557 | - unset( $this->actions[ $action_class ] ); |
|
556 | + if ( isset( $this->actions[$action_class] ) ) { |
|
557 | + unset( $this->actions[$action_class] ); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | |
564 | 564 | foreach ( $keys as $key ) { |
565 | 565 | // don't register new action if old action with the same id is already registered |
566 | - if ( ! isset( $this->actions[ $key ] ) ) { |
|
567 | - $this->actions[ $key ]->_register(); |
|
566 | + if ( ! isset( $this->actions[$key] ) ) { |
|
567 | + $this->actions[$key]->_register(); |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | foreach ( (array) $fields as $f ) { |
331 | 331 | FrmAppHelper::unserialize_or_decode( $f->field_options ); |
332 | - $size = $f->field_options['size']; |
|
332 | + $size = $f->field_options['size']; |
|
333 | 333 | $this->maybe_convert_migrated_size( $size ); |
334 | 334 | |
335 | 335 | if ( $size === $f->field_options['size'] ) { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | continue; |
393 | 393 | } |
394 | 394 | |
395 | - $this->maybe_convert_migrated_size( $widgets[ $k ]['size'] ); |
|
395 | + $this->maybe_convert_migrated_size( $widgets[$k]['size'] ); |
|
396 | 396 | } |
397 | 397 | update_option( 'widget_frm_show_form', $widgets ); |
398 | 398 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
492 | 492 | continue; |
493 | 493 | } |
494 | - $this->convert_character_to_px( $widgets[ $k ]['size'] ); |
|
494 | + $this->convert_character_to_px( $widgets[$k]['size'] ); |
|
495 | 495 | } |
496 | 496 | update_option( 'widget_frm_show_form', $widgets ); |
497 | 497 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | global $wpdb; |
56 | 56 | |
57 | - $values = array( |
|
57 | + $values = array( |
|
58 | 58 | 'item_id' => $entry_id, |
59 | 59 | 'field_id' => $field_id, |
60 | 60 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) { |
130 | 130 | // remove blank fields |
131 | - unset( $values[ $field_id ] ); |
|
131 | + unset( $values[$field_id] ); |
|
132 | 132 | } else { |
133 | 133 | // if value exists, then update it |
134 | 134 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public static function get_meta_value( $entry, $field_id ) { |
195 | 195 | if ( isset( $entry->metas ) ) { |
196 | - return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false; |
|
196 | + return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false; |
|
197 | 197 | } else { |
198 | 198 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
199 | 199 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $cached = FrmDb::check_cache( $entry_id, 'frm_entry' ); |
212 | 212 | } |
213 | 213 | |
214 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
215 | - $result = $cached->metas[ $field_id ]; |
|
214 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
215 | + $result = $cached->metas[$field_id]; |
|
216 | 216 | |
217 | 217 | return wp_unslash( $result ); |
218 | 218 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | if ( is_numeric( $field_id ) ) { |
223 | 223 | $query['field_id'] = $field_id; |
224 | 224 | } else { |
225 | - $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
225 | + $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
226 | 226 | $query['fi.field_key'] = $field_id; |
227 | 227 | } |
228 | 228 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'stripslashes' => true, |
241 | 241 | 'is_draft' => false, |
242 | 242 | ); |
243 | - $args = wp_parse_args( $args, $defaults ); |
|
243 | + $args = wp_parse_args( $args, $defaults ); |
|
244 | 244 | |
245 | 245 | $query = array(); |
246 | 246 | self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | foreach ( $values as $k => $v ) { |
257 | 257 | FrmAppHelper::unserialize_or_decode( $v ); |
258 | - $values[ $k ] = $v; |
|
258 | + $values[$k] = $v; |
|
259 | 259 | unset( $k, $v ); |
260 | 260 | } |
261 | 261 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | foreach ( $results as $k => $result ) { |
314 | 314 | FrmAppHelper::unserialize_or_decode( $result->meta_value ); |
315 | - $results[ $k ]->meta_value = wp_unslash( $result->meta_value ); |
|
315 | + $results[$k]->meta_value = wp_unslash( $result->meta_value ); |
|
316 | 316 | unset( $k, $result ); |
317 | 317 | } |
318 | 318 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | 'user_id' => '', |
326 | 326 | 'group_by' => '', |
327 | 327 | ); |
328 | - $args = wp_parse_args( $args, $defaults ); |
|
328 | + $args = wp_parse_args( $args, $defaults ); |
|
329 | 329 | |
330 | 330 | $query = array(); |
331 | 331 | self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
@@ -353,6 +353,7 @@ discard block |
||
353 | 353 | * @param string|array $where |
354 | 354 | * @param string $order_by |
355 | 355 | * @param string $limit |
356 | + * @param boolean $unique |
|
356 | 357 | */ |
357 | 358 | private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
358 | 359 | global $wpdb; |
@@ -423,6 +424,9 @@ discard block |
||
423 | 424 | $query[] = FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
424 | 425 | } |
425 | 426 | |
427 | + /** |
|
428 | + * @param string $field_id |
|
429 | + */ |
|
426 | 430 | public static function search_entry_metas( $search, $field_id, $operator ) { |
427 | 431 | $cache_key = 'search_' . FrmAppHelper::maybe_json_encode( $search ) . $field_id . $operator; |
428 | 432 | $results = wp_cache_get( $cache_key, 'frm_entry' ); |
@@ -136,6 +136,9 @@ |
||
136 | 136 | return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); |
137 | 137 | } |
138 | 138 | |
139 | + /** |
|
140 | + * @param string $message |
|
141 | + */ |
|
139 | 142 | public static function replace_default_message( $message, $atts ) { |
140 | 143 | if ( strpos( $message, '[default-message' ) === false && |
141 | 144 | strpos( $message, '[default_message' ) === false && |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | if ( $_POST ) { |
118 | 118 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
119 | 119 | if ( $repeating ) { |
120 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
120 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
121 | 121 | $value_is_posted = true; |
122 | 122 | } |
123 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
123 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
124 | 124 | $value_is_posted = true; |
125 | 125 | } |
126 | 126 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
151 | 151 | |
152 | 152 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
153 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
153 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
154 | 154 | if ( ! empty( $add_atts ) ) { |
155 | 155 | $this_atts = array_merge( $atts, $add_atts ); |
156 | 156 | } else { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
161 | 161 | |
162 | 162 | // Add the default message. |
163 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
163 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $message; |
167 | 167 | } |
168 | 168 | |
169 | 169 | public static function prepare_display_value( $entry, $field, $atts ) { |
170 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
170 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
171 | 171 | |
172 | 172 | if ( FrmAppHelper::pro_is_installed() ) { |
173 | 173 | $empty = empty( $field_value ); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
191 | 191 | } else { |
192 | 192 | // Get all values for this field. |
193 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
193 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
194 | 194 | |
195 | 195 | if ( $child_values ) { |
196 | 196 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $value = $args['temp_value']; |
309 | 309 | } |
310 | 310 | if ( empty( $args['parent_field_id'] ) ) { |
311 | - $_POST['item_meta'][ $field->id ] = $value; |
|
311 | + $_POST['item_meta'][$field->id] = $value; |
|
312 | 312 | } else { |
313 | 313 | self::set_parent_field_posted_value( $field, $value, $args ); |
314 | 314 | } |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @since 4.01 |
321 | 321 | */ |
322 | 322 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
323 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && |
|
324 | - is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { |
|
323 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && |
|
324 | + is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { |
|
325 | 325 | |
326 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || |
|
327 | - ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { |
|
328 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
326 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || |
|
327 | + ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { |
|
328 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
329 | 329 | } |
330 | 330 | } else { |
331 | 331 | // All of the section was probably removed. |
332 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); |
|
333 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
332 | + $_POST['item_meta'][$args['parent_field_id']] = array(); |
|
333 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
334 | 334 | } |
335 | 335 | |
336 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
336 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | if ( empty( $args['parent_field_id'] ) ) { |
365 | 365 | // Sanitizing is done next. |
366 | 366 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
367 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; |
|
367 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; |
|
368 | 368 | } else { |
369 | 369 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
370 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; |
|
370 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; |
|
371 | 371 | } |
372 | 372 | return $value; |
373 | 373 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | self::set_other_repeating_vals( $field, $value, $args ); |
399 | 399 | |
400 | 400 | // Check if there are any posted "Other" values. |
401 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
401 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
402 | 402 | |
403 | 403 | // Save original value. |
404 | 404 | $args['temp_value'] = $value; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | // Sanitizing is done next. |
408 | 408 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
409 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); |
|
409 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); |
|
410 | 410 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
411 | 411 | |
412 | 412 | // Set the validation value now |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | // Check if there are any other posted "other" values for this field. |
432 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
432 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
433 | 433 | // Save original value |
434 | 434 | $args['temp_value'] = $value; |
435 | 435 | $args['other'] = true; |
436 | 436 | |
437 | 437 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
438 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); |
|
438 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); |
|
439 | 439 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
440 | 440 | |
441 | 441 | // Set the validation value now. |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
463 | 463 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
464 | 464 | foreach ( $other_vals as $k => $v ) { |
465 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
465 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
466 | 466 | // If the other box is checked, but doesn't have a value. |
467 | 467 | $value = ''; |
468 | 468 | break; |
@@ -479,25 +479,25 @@ discard block |
||
479 | 479 | |
480 | 480 | // Multi-select dropdown. |
481 | 481 | if ( is_array( $value ) ) { |
482 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
482 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
483 | 483 | |
484 | 484 | if ( $o_key !== false ) { |
485 | 485 | // Modify the original value so other key will be preserved. |
486 | - $value[ $other_key ] = $value[ $o_key ]; |
|
486 | + $value[$other_key] = $value[$o_key]; |
|
487 | 487 | |
488 | 488 | // By default, the array keys will be numeric for multi-select dropdowns. |
489 | 489 | // If going backwards and forwards between pages, the array key will match the other key. |
490 | 490 | if ( $o_key !== $other_key ) { |
491 | - unset( $value[ $o_key ] ); |
|
491 | + unset( $value[$o_key] ); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | $args['temp_value'] = $value; |
495 | - $value[ $other_key ] = reset( $other_vals ); |
|
496 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
497 | - unset( $value[ $other_key ] ); |
|
495 | + $value[$other_key] = reset( $other_vals ); |
|
496 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
497 | + unset( $value[$other_key] ); |
|
498 | 498 | } |
499 | 499 | } |
500 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
500 | + } elseif ( $field->options[$other_key] == $value ) { |
|
501 | 501 | $value = $other_vals; |
502 | 502 | } |
503 | 503 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
86 | 86 | $to = $this->explode_emails( $to ); |
87 | 87 | |
88 | - $where = array( |
|
88 | + $where = array( |
|
89 | 89 | 'it.field_id !' => 0, |
90 | 90 | 'it.item_id' => $this->entry->id, |
91 | 91 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'entry' => $this->entry, |
96 | 96 | 'form' => $this->form, |
97 | 97 | ); |
98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
99 | 99 | |
100 | 100 | $this->to = array_unique( (array) $to ); |
101 | 101 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | // Add the user info if it isn't already included |
300 | 300 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
301 | - $data = $this->entry->description; |
|
301 | + $data = $this->entry->description; |
|
302 | 302 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
303 | 303 | $this->maybe_add_ip( $mail_body ); |
304 | 304 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
@@ -563,12 +563,12 @@ discard block |
||
563 | 563 | $name = trim( str_replace( $email, '', $val ) ); |
564 | 564 | } else { |
565 | 565 | // If user enters a name without an email |
566 | - unset( $recipients[ $key ] ); |
|
566 | + unset( $recipients[$key] ); |
|
567 | 567 | continue; |
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
571 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | return $recipients; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | ); |
710 | 710 | |
711 | 711 | // Remove phone number from to addresses |
712 | - unset( $this->to[ $key ] ); |
|
712 | + unset( $this->to[$key] ); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | } |
@@ -2,15 +2,15 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmFormAction { |
4 | 4 | |
5 | - public $id_base; // Root id for all actions of this type. |
|
6 | - public $name; // Name for this action type. |
|
5 | + public $id_base; // Root id for all actions of this type. |
|
6 | + public $name; // Name for this action type. |
|
7 | 7 | public $option_name; |
8 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
8 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
9 | 9 | public $control_options; // Option array passed to wp_register_widget_control() |
10 | 10 | |
11 | - public $form_id; // The ID of the form to evaluate |
|
12 | - public $number = false; // Unique ID number of the current instance. |
|
13 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
11 | + public $form_id; // The ID of the form to evaluate |
|
12 | + public $number = false; // Unique ID number of the current instance. |
|
13 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
14 | 14 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
15 | 15 | |
16 | 16 | // Member functions that you must over-ride. |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $groups = FrmFormActionsController::form_action_groups(); |
134 | 134 | $group = 'misc'; |
135 | 135 | |
136 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
136 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
137 | 137 | $group = $action_options['group']; |
138 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
138 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
139 | 139 | $group = $this->id_base; |
140 | 140 | } else { |
141 | 141 | foreach ( $groups as $name => $check_group ) { |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - $groups[ $group ]['id'] = $group; |
|
150 | - return $groups[ $group ]; |
|
149 | + $groups[$group]['id'] = $group; |
|
150 | + return $groups[$group]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return integer $post_id |
250 | 250 | */ |
251 | 251 | public function maybe_create_action( $action, $forms ) { |
252 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
252 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
253 | 253 | // Update action only |
254 | 254 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
255 | 255 | $post_id = $this->save_settings( $action ); |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | $action->menu_order = $form_id; |
269 | 269 | $switch = $this->get_global_switch_fields(); |
270 | 270 | foreach ( (array) $action->post_content as $key => $val ) { |
271 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
272 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
271 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
272 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
273 | 273 | } elseif ( ! is_array( $val ) ) { |
274 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
275 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
274 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
275 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
276 | 276 | // loop through each value if empty |
277 | - if ( empty( $switch[ $key ] ) ) { |
|
278 | - $switch[ $key ] = array_keys( $val ); |
|
277 | + if ( empty( $switch[$key] ) ) { |
|
278 | + $switch[$key] = array_keys( $val ); |
|
279 | 279 | } |
280 | 280 | |
281 | - foreach ( $switch[ $key ] as $subkey ) { |
|
282 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
281 | + foreach ( $switch[$key] as $subkey ) { |
|
282 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -297,20 +297,20 @@ discard block |
||
297 | 297 | foreach ( $subkey as $subkey2 ) { |
298 | 298 | foreach ( (array) $val as $ck => $cv ) { |
299 | 299 | if ( is_array( $cv ) ) { |
300 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
301 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
302 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
300 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
301 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
302 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } else { |
307 | 307 | foreach ( (array) $val as $ck => $cv ) { |
308 | 308 | if ( is_array( $cv ) ) { |
309 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
310 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
311 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
309 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
310 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
311 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
312 | 312 | } elseif ( $ck == $subkey ) { |
313 | - $action[ $ck ] = FrmFieldsHelper::switch_field_ids( $action[ $ck ] ); |
|
313 | + $action[$ck] = FrmFieldsHelper::switch_field_ids( $action[$ck] ); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | return; |
334 | 334 | } |
335 | 335 | |
336 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
336 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
337 | 337 | // Sanitizing removes scripts and <email> type of values. |
338 | 338 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
339 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
339 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
340 | 340 | } else { |
341 | 341 | return; |
342 | 342 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | foreach ( $settings as $number => $new_instance ) { |
347 | 347 | $this->_set( $number ); |
348 | 348 | |
349 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
349 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
350 | 350 | |
351 | 351 | if ( ! isset( $new_instance['post_status'] ) ) { |
352 | 352 | $new_instance['post_status'] = 'draft'; |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
387 | 387 | |
388 | 388 | if ( false !== $instance ) { |
389 | - $all_instances[ $number ] = $instance; |
|
389 | + $all_instances[$number] = $instance; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | $action_ids[] = $this->save_settings( $instance ); |
@@ -462,12 +462,12 @@ discard block |
||
462 | 462 | // some plugins/themes are formatting the post_excerpt |
463 | 463 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
464 | 464 | |
465 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
465 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
466 | 466 | continue; |
467 | 467 | } |
468 | 468 | |
469 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
470 | - $settings[ $action->ID ] = $action; |
|
469 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
470 | + $settings[$action->ID] = $action; |
|
471 | 471 | |
472 | 472 | if ( count( $settings ) >= $limit ) { |
473 | 473 | break; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | 'limit' => 99, |
498 | 498 | 'post_status' => $default_status, |
499 | 499 | ); |
500 | - $args = wp_parse_args( $args, $defaults ); |
|
500 | + $args = wp_parse_args( $args, $defaults ); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | |
559 | 559 | $action = $this->prepare_action( $action ); |
560 | 560 | |
561 | - $settings[ $action->ID ] = $action; |
|
561 | + $settings[$action->ID] = $action; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | if ( 1 === $limit ) { |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | |
596 | 596 | foreach ( $default_values as $k => $vals ) { |
597 | 597 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
598 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
598 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
599 | 599 | continue; |
600 | 600 | } |
601 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
601 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
602 | 602 | } |
603 | 603 | } |
604 | 604 | |
@@ -671,14 +671,14 @@ discard block |
||
671 | 671 | * Migrate settings from form->options into new action. |
672 | 672 | */ |
673 | 673 | public function migrate_to_2( $form, $update = 'update' ) { |
674 | - $action = $this->prepare_new( $form->id ); |
|
674 | + $action = $this->prepare_new( $form->id ); |
|
675 | 675 | FrmAppHelper::unserialize_or_decode( $form->options ); |
676 | 676 | |
677 | 677 | // fill with existing options |
678 | 678 | foreach ( $action->post_content as $name => $val ) { |
679 | - if ( isset( $form->options[ $name ] ) ) { |
|
680 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
681 | - unset( $form->options[ $name ] ); |
|
679 | + if ( isset( $form->options[$name] ) ) { |
|
680 | + $action->post_content[$name] = $form->options[$name]; |
|
681 | + unset( $form->options[$name] ); |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | $stop = $stop ? false : true; |
740 | 740 | } |
741 | 741 | |
742 | - $met[ $stop ] = $stop; |
|
742 | + $met[$stop] = $stop; |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | private static function get_value_from_entry( $entry, $field_id ) { |
782 | 782 | $observed_value = ''; |
783 | 783 | |
784 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
785 | - $observed_value = $entry->metas[ $field_id ]; |
|
784 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
785 | + $observed_value = $entry->metas[$field_id]; |
|
786 | 786 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
787 | 787 | $field = FrmField::getOne( $field_id ); |
788 | 788 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | global $frm_vars; |
66 | 66 | $form_id = FrmForm::get_current_form_id(); |
67 | 67 | |
68 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
69 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
68 | + $columns[$form_id . '_id'] = 'ID'; |
|
69 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
70 | 70 | |
71 | 71 | if ( $form_id ) { |
72 | 72 | self::get_columns_for_form( $form_id, $columns ); |
73 | 73 | } else { |
74 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
75 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
76 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
74 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
75 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
76 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
77 | 77 | } |
78 | 78 | |
79 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
80 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
79 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
80 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
81 | 81 | self::maybe_add_ip_col( $form_id, $columns ); |
82 | 82 | |
83 | 83 | $frm_vars['cols'] = $columns; |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
127 | 127 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
128 | - unset( $sub_form_cols[ $k ] ); |
|
128 | + unset( $sub_form_cols[$k] ); |
|
129 | 129 | continue; |
130 | 130 | } |
131 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
131 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
132 | 132 | unset( $sub_form_col ); |
133 | 133 | } |
134 | 134 | } |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
146 | 146 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
147 | 147 | if ( $has_separate_value && ! $is_post_status ) { |
148 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
148 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
149 | 149 | } |
150 | 150 | |
151 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
151 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
155 | 155 | if ( FrmAppHelper::ips_saved() ) { |
156 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
156 | + $columns[$form_id . '_ip'] = 'IP'; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | foreach ( $meta_value as $mk => $mv ) { |
192 | 192 | // Remove blank values. |
193 | 193 | if ( empty( $mv ) ) { |
194 | - unset( $meta_value[ $mk ] ); |
|
194 | + unset( $meta_value[$mk] ); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | foreach ( $fields as $field ) { |
269 | 269 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
270 | 270 | // Can't sort on checkboxes because they are stored serialized, or post fields |
271 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
271 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $atts['form_id'] . '_item_key' => '', |
333 | 333 | $atts['form_id'] . '_id' => '', |
334 | 334 | ); |
335 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
335 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
336 | 336 | |
337 | 337 | $i = $atts['i']; |
338 | 338 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
345 | 345 | $result[] = $col_key; |
346 | - $i--; |
|
346 | + $i --; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | unset( $col_key, $col ); |
@@ -476,9 +476,9 @@ discard block |
||
476 | 476 | if ( ! isset( $frm_vars['form_params'] ) ) { |
477 | 477 | $frm_vars['form_params'] = array(); |
478 | 478 | } |
479 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
479 | + $frm_vars['form_params'][$form->id] = $params; |
|
480 | 480 | |
481 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
481 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
482 | 482 | return; |
483 | 483 | } |
484 | 484 | |
@@ -494,16 +494,16 @@ discard block |
||
494 | 494 | */ |
495 | 495 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
496 | 496 | |
497 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
497 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
498 | 498 | |
499 | 499 | if ( empty( $errors ) ) { |
500 | 500 | $_POST['frm_skip_cookie'] = 1; |
501 | 501 | $do_success = false; |
502 | 502 | if ( $params['action'] == 'create' ) { |
503 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
504 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
503 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
504 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
505 | 505 | |
506 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
506 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
507 | 507 | $do_success = true; |
508 | 508 | } |
509 | 509 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | protected function get_field_value( $args ) { |
50 | 50 | $user_ID = get_current_user_id(); |
51 | 51 | $user_ID = ( $user_ID ? $user_ID : '' ); |
52 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok. |
|
52 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // WPCS: CSRF ok. |
|
53 | 53 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
54 | 54 | $updating = $action == 'update'; |
55 | 55 | return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID; |