@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
235 | 235 | |
236 | 236 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
237 | - $new_values[ $col ] = $values[ $col ]; |
|
237 | + $new_values[$col] = $values[$col]; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
246 | 246 | |
247 | 247 | if ( isset( $values['id'] ) ) { |
248 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
248 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
249 | 249 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
250 | 250 | } |
251 | 251 | |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | foreach ( $new_values as $k => $v ) { |
255 | 255 | if ( is_array( $v ) ) { |
256 | 256 | if ( $k === 'default_value' ) { |
257 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
257 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
258 | 258 | } else { |
259 | - $new_values[ $k ] = serialize( $v ); |
|
259 | + $new_values[$k] = serialize( $v ); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | unset( $k, $v ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | if ( $query_results ) { |
277 | 277 | if ( isset( $values['id'] ) ) { |
278 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
278 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | return $new_id; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
339 | 339 | global $frm_duplicate_ids; |
340 | 340 | |
341 | - $where = array( |
|
341 | + $where = array( |
|
342 | 342 | array( |
343 | 343 | 'or' => 1, |
344 | 344 | 'fi.form_id' => $old_form_id, |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | |
385 | 385 | $values = apply_filters( 'frm_duplicated_field', $values ); |
386 | 386 | $new_id = self::create( $values ); |
387 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
388 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
387 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
388 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
389 | 389 | unset( $field ); |
390 | 390 | } |
391 | 391 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | |
418 | 418 | // serialize array values |
419 | 419 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
420 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
420 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
421 | 421 | if ( 'field_options' === $opt ) { |
422 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
422 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
423 | 423 | } |
424 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
424 | + $values[$opt] = serialize( $values[$opt] ); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | 'id' => $id, |
574 | 574 | 'field_key' => $id, |
575 | 575 | ); |
576 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
576 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | return $type; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | |
602 | - $fields[ $result->id ] = $result; |
|
602 | + $fields[$result->id] = $result; |
|
603 | 603 | $count ++; |
604 | 604 | if ( $limit == 1 ) { |
605 | 605 | $fields = $result; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $count = 0; |
646 | 646 | foreach ( $results as $result ) { |
647 | 647 | $count ++; |
648 | - $fields[ $result->id ] = $result; |
|
648 | + $fields[$result->id] = $result; |
|
649 | 649 | if ( ! empty( $limit ) && $count >= $limit ) { |
650 | 650 | break; |
651 | 651 | } |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | } |
715 | 715 | |
716 | 716 | if ( ! empty( $sub_fields ) ) { |
717 | - $index = $k + $index_offset; |
|
717 | + $index = $k + $index_offset; |
|
718 | 718 | $index_offset += count( $sub_fields ); |
719 | 719 | array_splice( $results, $index, 0, $sub_fields ); |
720 | 720 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
760 | 760 | |
761 | 761 | if ( is_array( $where ) ) { |
762 | - $args = array( |
|
762 | + $args = array( |
|
763 | 763 | 'order_by' => $order_by, |
764 | 764 | 'limit' => $limit, |
765 | 765 | ); |
@@ -790,9 +790,9 @@ discard block |
||
790 | 790 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
791 | 791 | |
792 | 792 | self::prepare_options( $result ); |
793 | - $results[ $r_key ]->field_options = $result->field_options; |
|
794 | - $results[ $r_key ]->options = $result->options; |
|
795 | - $results[ $r_key ]->default_value = $result->default_value; |
|
793 | + $results[$r_key]->field_options = $result->field_options; |
|
794 | + $results[$r_key]->options = $result->options; |
|
795 | + $results[$r_key]->default_value = $result->default_value; |
|
796 | 796 | |
797 | 797 | unset( $r_key, $result ); |
798 | 798 | } |
@@ -994,23 +994,23 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | public static function is_option_true_in_array( $field, $option ) { |
997 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
997 | + return isset( $field[$option] ) && $field[$option]; |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | public static function is_option_true_in_object( $field, $option ) { |
1001 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
1001 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | public static function is_option_empty_in_array( $field, $option ) { |
1005 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
1005 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | public static function is_option_empty_in_object( $field, $option ) { |
1009 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
1009 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | public static function is_option_value_in_object( $field, $option ) { |
1013 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
1013 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | /** |
@@ -1028,10 +1028,10 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | public static function get_option_in_array( $field, $option ) { |
1030 | 1030 | |
1031 | - if ( isset( $field[ $option ] ) ) { |
|
1032 | - $this_option = $field[ $option ]; |
|
1033 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
1034 | - $this_option = $field['field_options'][ $option ]; |
|
1031 | + if ( isset( $field[$option] ) ) { |
|
1032 | + $this_option = $field[$option]; |
|
1033 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
1034 | + $this_option = $field['field_options'][$option]; |
|
1035 | 1035 | } else { |
1036 | 1036 | $this_option = ''; |
1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | public static function get_option_in_object( $field, $option ) { |
1043 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
1043 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
96 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
97 | 97 | // Don't replace messages unless required. |
98 | 98 | return; |
99 | 99 | } |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
105 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
105 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
106 | 106 | // Move up and mark as new. |
107 | - unset( self::$messages[ $message['key'] ] ); |
|
107 | + unset( self::$messages[$message['key']] ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $this->fill_message( $message ); |
111 | - self::$messages[ $message['key'] ] = $message; |
|
111 | + self::$messages[$message['key']] = $message; |
|
112 | 112 | |
113 | 113 | $this->update_list(); |
114 | 114 | |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | private function clean_messages() { |
137 | 137 | $removed = false; |
138 | 138 | foreach ( self::$messages as $t => $message ) { |
139 | - $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
140 | - $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
139 | + $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
140 | + $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
141 | 141 | $expired = $this->is_expired( $message ); |
142 | 142 | if ( $read || $expired || $dismissed ) { |
143 | - unset( self::$messages[ $t ] ); |
|
143 | + unset( self::$messages[$t] ); |
|
144 | 144 | $removed = true; |
145 | 145 | } |
146 | 146 | } |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | private function filter_messages( &$messages ) { |
154 | 154 | $user_id = get_current_user_id(); |
155 | 155 | foreach ( $messages as $k => $message ) { |
156 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
156 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
157 | 157 | if ( empty( $k ) || $this->is_expired( $message ) || $dismissed ) { |
158 | - unset( $messages[ $k ] ); |
|
158 | + unset( $messages[$k] ); |
|
159 | 159 | } elseif ( ! $this->is_for_user( $message ) ) { |
160 | - unset( $messages[ $k ] ); |
|
160 | + unset( $messages[$k] ); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | * @param string $key |
197 | 197 | */ |
198 | 198 | public function mark_read( $key ) { |
199 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
199 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
203 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
204 | - self::$messages[ $key ]['read'] = array(); |
|
203 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
204 | + self::$messages[$key]['read'] = array(); |
|
205 | 205 | } |
206 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
206 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
207 | 207 | |
208 | 208 | $this->update_list(); |
209 | 209 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * @since 4.05.02 |
215 | 215 | */ |
216 | 216 | public function mark_unread( $key ) { |
217 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
217 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
218 | 218 | if ( $is_read ) { |
219 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
219 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
220 | 220 | $this->update_list(); |
221 | 221 | } |
222 | 222 | } |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
233 | + if ( ! isset( self::$messages[$key] ) ) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
238 | - self::$messages[ $key ]['dismissed'] = array(); |
|
237 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
238 | + self::$messages[$key]['dismissed'] = array(); |
|
239 | 239 | } |
240 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
240 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
241 | 241 | |
242 | 242 | $this->update_list(); |
243 | 243 | } |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | $user_id = get_current_user_id(); |
250 | 250 | foreach ( self::$messages as $key => $message ) { |
251 | 251 | if ( ! isset( $message['dismissed'] ) ) { |
252 | - self::$messages[ $key ]['dismissed'] = array(); |
|
252 | + self::$messages[$key]['dismissed'] = array(); |
|
253 | 253 | } |
254 | 254 | |
255 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
256 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
255 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
256 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | $this->update_list(); |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | $messages = $this->get_messages( 'filter' ); |
264 | 264 | $user_id = get_current_user_id(); |
265 | 265 | foreach ( $messages as $t => $message ) { |
266 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
267 | - unset( $messages[ $t ] ); |
|
266 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
267 | + unset( $messages[$t] ); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | return $messages; |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | * @since 4.05.02 |
289 | 289 | */ |
290 | 290 | public function remove( $key ) { |
291 | - if ( isset( self::$messages[ $key ] ) ) { |
|
292 | - unset( self::$messages[ $key ] ); |
|
291 | + if ( isset( self::$messages[$key] ) ) { |
|
292 | + unset( self::$messages[$key] ); |
|
293 | 293 | $this->update_list(); |
294 | 294 | } |
295 | 295 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); |
98 | 98 | if ( ! empty( $cats ) ) { |
99 | - unset( $addons[ $k ] ); |
|
99 | + unset( $addons[$k] ); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | return $addon; |
139 | 139 | } |
140 | 140 | } |
141 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
142 | - $plugin = $addons[ $download_id ]; |
|
141 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
142 | + $plugin = $addons[$download_id]; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $plugin; |
@@ -42,7 +42,8 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | // Only do this for single site installs. |
45 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
45 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
46 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
46 | 47 | return; |
47 | 48 | } |
48 | 49 |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | ), |
444 | 444 | ); |
445 | 445 | |
446 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
446 | + if ( ! isset( $available_status[$status] ) ) { |
|
447 | 447 | return; |
448 | 448 | } |
449 | 449 | |
450 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
450 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
451 | 451 | |
452 | 452 | $params = FrmForm::list_page_params(); |
453 | 453 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | check_admin_referer( $status . '_form_' . $params['id'] ); |
456 | 456 | |
457 | 457 | $count = 0; |
458 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
458 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
459 | 459 | $count ++; |
460 | 460 | } |
461 | 461 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
473 | 473 | $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); |
474 | 474 | |
475 | - $message = $available_status[ $status ]['message']; |
|
475 | + $message = $available_status[$status]['message']; |
|
476 | 476 | |
477 | 477 | self::display_forms_list( $params, $message ); |
478 | 478 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'type' => 'request', |
494 | 494 | ) |
495 | 495 | ); |
496 | - $message = sprintf( |
|
496 | + $message = sprintf( |
|
497 | 497 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
498 | 498 | _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), |
499 | 499 | $count, |
@@ -861,11 +861,11 @@ discard block |
||
861 | 861 | } |
862 | 862 | |
863 | 863 | foreach ( $template['categories'] as $category ) { |
864 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
865 | - $templates_by_category[ $category ] = array(); |
|
864 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
865 | + $templates_by_category[$category] = array(); |
|
866 | 866 | } |
867 | 867 | |
868 | - $templates_by_category[ $category ][] = $template; |
|
868 | + $templates_by_category[$category][] = $template; |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | unset( $template ); |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $forms = FrmForm::get_published_forms( $where ); |
895 | 895 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
896 | 896 | |
897 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
897 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
898 | 898 | |
899 | 899 | unset( $pricing, $license_type, $where ); |
900 | 900 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $section['id'] = $section['anchor']; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | - $sections[ $key ] = $section; |
|
1131 | + $sections[$key] = $section; |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | return $sections; |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | if ( ! empty( $user_fields ) ) { |
1232 | 1232 | $user_helpers = array(); |
1233 | 1233 | foreach ( $user_fields as $uk => $uf ) { |
1234 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
1234 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1235 | 1235 | unset( $uk, $uf ); |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
1362 | 1362 | $frm_vars['js_validate_forms'] = array(); |
1363 | 1363 | } |
1364 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
1364 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | public static function get_email_html() { |
@@ -1482,7 +1482,7 @@ discard block |
||
1482 | 1482 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
1483 | 1483 | } else { |
1484 | 1484 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
1485 | - $action = $vars[ $action ]; |
|
1485 | + $action = $vars[$action]; |
|
1486 | 1486 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1487 | 1487 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1488 | 1488 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | $actions = array(); |
1609 | 1609 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
1610 | 1610 | if ( is_object( $form ) ) { |
1611 | - $actions[ $form->id ] = $form->name; |
|
1611 | + $actions[$form->id] = $form->name; |
|
1612 | 1612 | } |
1613 | 1613 | unset( $form ); |
1614 | 1614 | } |
@@ -1817,8 +1817,8 @@ discard block |
||
1817 | 1817 | private static function get_saved_errors( $form, $params ) { |
1818 | 1818 | global $frm_vars; |
1819 | 1819 | |
1820 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1821 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
1820 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1821 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
1822 | 1822 | } else { |
1823 | 1823 | $errors = array(); |
1824 | 1824 | } |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | public static function just_created_entry( $form_id ) { |
1833 | 1833 | global $frm_vars; |
1834 | 1834 | |
1835 | - return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0; |
|
1835 | + return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0; |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | 1838 | /** |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | */ |
1841 | 1841 | private static function get_confirmation_method( $atts ) { |
1842 | 1842 | $opt = 'success_action'; |
1843 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
1843 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
1844 | 1844 | $method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' ); |
1845 | 1845 | |
1846 | 1846 | if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) { |
@@ -1853,7 +1853,7 @@ discard block |
||
1853 | 1853 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
1854 | 1854 | if ( ! isset( $params['id'] ) ) { |
1855 | 1855 | global $frm_vars; |
1856 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
1856 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
1857 | 1857 | } |
1858 | 1858 | |
1859 | 1859 | $conf_method = self::get_confirmation_method( |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | $opt = ( ! isset( $args['action'] ) || $args['action'] === 'create' ) ? 'success' : 'edit'; |
1898 | 1898 | |
1899 | 1899 | $args['success_opt'] = $opt; |
1900 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
1900 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
1901 | 1901 | self::load_page_after_submit( $args ); |
1902 | 1902 | } elseif ( $args['conf_method'] === 'redirect' ) { |
1903 | 1903 | self::redirect_after_submit( $args ); |
@@ -1912,8 +1912,8 @@ discard block |
||
1912 | 1912 | private static function load_page_after_submit( $args ) { |
1913 | 1913 | global $post; |
1914 | 1914 | $opt = $args['success_opt']; |
1915 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
1916 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
1915 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
1916 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
1917 | 1917 | $old_post = $post; |
1918 | 1918 | $post = $page; |
1919 | 1919 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -1931,11 +1931,11 @@ discard block |
||
1931 | 1931 | add_filter( 'frm_use_wpautop', '__return_false' ); |
1932 | 1932 | |
1933 | 1933 | $opt = $args['success_opt']; |
1934 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
1934 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
1935 | 1935 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
1936 | 1936 | $success_url = do_shortcode( $success_url ); |
1937 | 1937 | |
1938 | - $success_msg = isset( $args['form']->options[ $opt . '_msg' ] ) ? $args['form']->options[ $opt . '_msg' ] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
1938 | + $success_msg = isset( $args['form']->options[$opt . '_msg'] ) ? $args['form']->options[$opt . '_msg'] : __( 'Please wait while you are redirected.', 'formidable' ); |
|
1939 | 1939 | |
1940 | 1940 | $redirect_msg = self::get_redirect_message( $success_url, $success_msg, $args ); |
1941 | 1941 | |
@@ -2073,7 +2073,7 @@ discard block |
||
2073 | 2073 | 'description' => false, |
2074 | 2074 | 'reset' => false, |
2075 | 2075 | ); |
2076 | - $args = wp_parse_args( $args, $defaults ); |
|
2076 | + $args = wp_parse_args( $args, $defaults ); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | /** |
@@ -1465,7 +1465,8 @@ discard block |
||
1465 | 1465 | $vars = array(); |
1466 | 1466 | FrmAppHelper::include_svg(); |
1467 | 1467 | |
1468 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1468 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
1469 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1469 | 1470 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
1470 | 1471 | |
1471 | 1472 | // Javascript needs to be allowed in some field settings. |
@@ -1735,7 +1736,8 @@ discard block |
||
1735 | 1736 | private static function maybe_get_form_to_show( $id ) { |
1736 | 1737 | $form = false; |
1737 | 1738 | |
1738 | - if ( ! empty( $id ) ) { // no form id or key set |
|
1739 | + if ( ! empty( $id ) ) { |
|
1740 | +// no form id or key set |
|
1739 | 1741 | $form = FrmForm::getOne( $id ); |
1740 | 1742 | if ( ! $form || $form->parent_form_id || $form->status == 'trash' ) { |
1741 | 1743 | $form = false; |
@@ -1817,7 +1819,8 @@ discard block |
||
1817 | 1819 | private static function get_saved_errors( $form, $params ) { |
1818 | 1820 | global $frm_vars; |
1819 | 1821 | |
1820 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1822 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
1823 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1821 | 1824 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
1822 | 1825 | } else { |
1823 | 1826 | $errors = array(); |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | global $frm_vars; |
76 | 76 | $form_id = FrmForm::get_current_form_id(); |
77 | 77 | |
78 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
79 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
78 | + $columns[$form_id . '_id'] = 'ID'; |
|
79 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
80 | 80 | |
81 | 81 | if ( $form_id ) { |
82 | 82 | self::get_columns_for_form( $form_id, $columns ); |
83 | 83 | } else { |
84 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
85 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
86 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
84 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
85 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
86 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
87 | 87 | } |
88 | 88 | |
89 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
90 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
89 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
90 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
91 | 91 | self::maybe_add_ip_col( $form_id, $columns ); |
92 | 92 | |
93 | 93 | $frm_vars['cols'] = $columns; |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | |
146 | 146 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
147 | 147 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
148 | - unset( $sub_form_cols[ $k ] ); |
|
148 | + unset( $sub_form_cols[$k] ); |
|
149 | 149 | continue; |
150 | 150 | } |
151 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
151 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
152 | 152 | unset( $sub_form_col ); |
153 | 153 | } |
154 | 154 | } |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
166 | 166 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
167 | 167 | if ( $has_separate_value && ! $is_post_status ) { |
168 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
168 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
169 | 169 | } |
170 | 170 | |
171 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
171 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
175 | 175 | if ( FrmAppHelper::ips_saved() ) { |
176 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
176 | + $columns[$form_id . '_ip'] = 'IP'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | foreach ( $meta_value as $mk => $mv ) { |
212 | 212 | // Remove blank values. |
213 | 213 | if ( empty( $mv ) ) { |
214 | - unset( $meta_value[ $mk ] ); |
|
214 | + unset( $meta_value[$mk] ); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | foreach ( $fields as $field ) { |
289 | 289 | if ( self::field_supports_sorting( $field ) ) { |
290 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
290 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $atts['form_id'] . '_item_key' => '', |
364 | 364 | $atts['form_id'] . '_id' => '', |
365 | 365 | ); |
366 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
366 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
367 | 367 | |
368 | 368 | $i = $atts['i']; |
369 | 369 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
376 | 376 | $result[] = $col_key; |
377 | - $i--; |
|
377 | + $i --; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | unset( $col_key, $col ); |
@@ -507,9 +507,9 @@ discard block |
||
507 | 507 | if ( ! isset( $frm_vars['form_params'] ) ) { |
508 | 508 | $frm_vars['form_params'] = array(); |
509 | 509 | } |
510 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
510 | + $frm_vars['form_params'][$form->id] = $params; |
|
511 | 511 | |
512 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
512 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
513 | 513 | return; |
514 | 514 | } |
515 | 515 | |
@@ -525,16 +525,16 @@ discard block |
||
525 | 525 | */ |
526 | 526 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
527 | 527 | |
528 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
528 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
529 | 529 | |
530 | 530 | if ( empty( $errors ) ) { |
531 | 531 | $_POST['frm_skip_cookie'] = 1; |
532 | 532 | $do_success = false; |
533 | 533 | if ( $params['action'] === 'create' ) { |
534 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
535 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
534 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
535 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
536 | 536 | |
537 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
537 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
538 | 538 | $do_success = true; |
539 | 539 | } |
540 | 540 | } |
@@ -491,7 +491,8 @@ |
||
491 | 491 | |
492 | 492 | public static function process_entry( $errors = '', $ajax = false ) { |
493 | 493 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
494 | - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
494 | + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
|
495 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
495 | 496 | return; |
496 | 497 | } |
497 | 498 |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | foreach ( $values as $value_key => $value ) { |
155 | 155 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
156 | - $new_values[ $value_key ] = $value; |
|
156 | + $new_values[$value_key] = $value; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | $existing_keys = array_keys( $values['item_meta'] ); |
225 | 225 | foreach ( $all_fields as $fid ) { |
226 | 226 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
227 | - $values['item_meta'][ $fid->id ] = ''; |
|
227 | + $values['item_meta'][$fid->id] = ''; |
|
228 | 228 | } |
229 | - $field_array[ $fid->id ] = $fid; |
|
229 | + $field_array[$fid->id] = $fid; |
|
230 | 230 | } |
231 | 231 | unset( $all_fields ); |
232 | 232 | |
233 | 233 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
234 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
235 | - $field = $field_array[ $field_id ]; |
|
234 | + if ( isset( $field_array[$field_id] ) ) { |
|
235 | + $field = $field_array[$field_id]; |
|
236 | 236 | } else { |
237 | 237 | $field = FrmField::getOne( $field_id ); |
238 | 238 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | continue; |
242 | 242 | } |
243 | 243 | |
244 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
244 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
245 | 245 | if ( $is_settings_page ) { |
246 | 246 | self::get_settings_page_html( $values, $field ); |
247 | 247 | |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
257 | 257 | |
258 | 258 | foreach ( $update_options as $opt => $default ) { |
259 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
260 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
259 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
260 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
264 | 264 | |
265 | 265 | $new_field = array( |
266 | 266 | 'field_options' => $field->field_options, |
267 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
267 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * Updating the settings page |
327 | 327 | */ |
328 | 328 | private static function get_settings_page_html( $values, &$field ) { |
329 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
329 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
330 | 330 | $prev_opts = array(); |
331 | 331 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
332 | 332 | |
333 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
333 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
334 | 334 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
335 | 335 | $prev_opts = $field->field_options; |
336 | 336 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | foreach ( $field_cols as $col => $default ) { |
357 | 357 | $default = ( $default === '' ) ? $field->{$col} : $default; |
358 | 358 | |
359 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
359 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | // Don't save the template option. |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | self::maybe_get_form( $form ); |
771 | 771 | } |
772 | 772 | |
773 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
774 | - return $frm_vars['form_params'][ $form->id ]; |
|
773 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
774 | + return $frm_vars['form_params'][$form->id]; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | //if there are two forms on the same page, make sure not to submit both |
801 | 801 | foreach ( $default_values as $var => $default ) { |
802 | 802 | if ( $var == 'action' ) { |
803 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
803 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
804 | 804 | } else { |
805 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
805 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
806 | 806 | } |
807 | 807 | unset( $var, $default ); |
808 | 808 | } |
809 | 809 | } else { |
810 | 810 | foreach ( $default_values as $var => $default ) { |
811 | - $values[ $var ] = $default; |
|
811 | + $values[$var] = $default; |
|
812 | 812 | unset( $var, $default ); |
813 | 813 | } |
814 | 814 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | 'sdir' => '', |
835 | 835 | ); |
836 | 836 | foreach ( $defaults as $var => $default ) { |
837 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
837 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | return $values; |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | 'keep_post' => '', |
863 | 863 | ); |
864 | 864 | foreach ( $defaults as $var => $default ) { |
865 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
865 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | return $values; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $form = $atts['form']; |
966 | 966 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
967 | 967 | |
968 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
968 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected function get_field_value( $args ) { |
53 | 53 | $user_ID = get_current_user_id(); |
54 | 54 | $user_ID = ( $user_ID ? $user_ID : '' ); |
55 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
55 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
56 | 56 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
57 | 57 | $updating = $action == 'update'; |
58 | 58 | return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
81 | 81 | $field_metas = array(); |
82 | 82 | foreach ( $metas as $meta ) { |
83 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
83 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $reduced = array(); |
137 | 137 | foreach ( $filter_vals as $field_id => $value ) { |
138 | 138 | $field = FrmFieldFactory::get_field_object( $field_id ); |
139 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
141 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
142 | - unset( $reduced[ $field_id ] ); |
|
139 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
141 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
142 | + unset( $reduced[$field_id] ); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | return $reduced; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
333 | 333 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
334 | 334 | |
335 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
335 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
336 | 336 | $query_args = array( $id ); |
337 | 337 | $query = $wpdb->prepare( $query, $query_args ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
338 | 338 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | private static function prepare_entries( &$entries ) { |
378 | 378 | foreach ( $entries as $k => $entry ) { |
379 | 379 | self::prepare_entry( $entry ); |
380 | - $entries[ $k ] = $entry; |
|
380 | + $entries[$k] = $entry; |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -402,20 +402,20 @@ discard block |
||
402 | 402 | foreach ( $metas as $meta_val ) { |
403 | 403 | if ( $meta_val->item_id == $entry->id ) { |
404 | 404 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
405 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
405 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
406 | 406 | if ( $include_key ) { |
407 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
407 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
408 | 408 | } |
409 | 409 | continue; |
410 | 410 | } |
411 | 411 | |
412 | 412 | // include sub entries in an array |
413 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
414 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
413 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
414 | + $entry->metas[$meta_val->field_id] = array(); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
418 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
418 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
419 | 419 | |
420 | 420 | unset( $meta_val ); |
421 | 421 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | if ( $inc_form ) { |
464 | 464 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
465 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
465 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | } |
507 | 507 | |
508 | 508 | foreach ( $metas as $m_key => $meta_val ) { |
509 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
509 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
510 | 510 | continue; |
511 | 511 | } |
512 | 512 | |
513 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
514 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
513 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
514 | + $entries[$meta_val->item_id]->metas = array(); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
518 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
518 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
519 | 519 | unset( $m_key, $meta_val ); |
520 | 520 | } |
521 | 521 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | } |
694 | 694 | |
695 | 695 | private static function get_entry_value( $values, $name, $default ) { |
696 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
696 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | /** |