@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
108 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
108 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
109 | 109 | // Don't replace messages unless required. |
110 | 110 | return; |
111 | 111 | } |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
117 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
118 | 118 | // Move up and mark as new. |
119 | - unset( self::$messages[ $message['key'] ] ); |
|
119 | + unset( self::$messages[$message['key']] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $this->fill_message( $message ); |
123 | - self::$messages[ $message['key'] ] = $message; |
|
123 | + self::$messages[$message['key']] = $message; |
|
124 | 124 | |
125 | 125 | $this->update_list(); |
126 | 126 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | private function clean_messages() { |
157 | 157 | $removed = false; |
158 | 158 | foreach ( self::$messages as $t => $message ) { |
159 | - $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
160 | - $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
159 | + $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
160 | + $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
161 | 161 | $expired = $this->is_expired( $message ); |
162 | 162 | if ( $read || $expired || $dismissed ) { |
163 | - unset( self::$messages[ $t ] ); |
|
163 | + unset( self::$messages[$t] ); |
|
164 | 164 | $removed = true; |
165 | 165 | } |
166 | 166 | } |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | private function filter_messages( &$messages ) { |
177 | 177 | $user_id = get_current_user_id(); |
178 | 178 | foreach ( $messages as $k => $message ) { |
179 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
179 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
180 | 180 | if ( empty( $k ) || $this->is_expired( $message ) || $dismissed ) { |
181 | - unset( $messages[ $k ] ); |
|
181 | + unset( $messages[$k] ); |
|
182 | 182 | } elseif ( ! $this->is_for_user( $message ) ) { |
183 | - unset( $messages[ $k ] ); |
|
183 | + unset( $messages[$k] ); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function mark_read( $key ) { |
229 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
229 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
234 | - self::$messages[ $key ]['read'] = array(); |
|
233 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
234 | + self::$messages[$key]['read'] = array(); |
|
235 | 235 | } |
236 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
236 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
237 | 237 | |
238 | 238 | $this->update_list(); |
239 | 239 | } |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | * @return void |
247 | 247 | */ |
248 | 248 | public function mark_unread( $key ) { |
249 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
249 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
250 | 250 | if ( $is_read ) { |
251 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
251 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
252 | 252 | $this->update_list(); |
253 | 253 | } |
254 | 254 | } |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
267 | + if ( ! isset( self::$messages[$key] ) ) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | |
271 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
272 | - self::$messages[ $key ]['dismissed'] = array(); |
|
271 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
272 | + self::$messages[$key]['dismissed'] = array(); |
|
273 | 273 | } |
274 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
274 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
275 | 275 | |
276 | 276 | $this->update_list(); |
277 | 277 | } |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | $user_id = get_current_user_id(); |
286 | 286 | foreach ( self::$messages as $key => $message ) { |
287 | 287 | if ( ! isset( $message['dismissed'] ) ) { |
288 | - self::$messages[ $key ]['dismissed'] = array(); |
|
288 | + self::$messages[$key]['dismissed'] = array(); |
|
289 | 289 | } |
290 | 290 | |
291 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
292 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
291 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
292 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | $this->update_list(); |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | $messages = $this->get_messages( 'filter' ); |
300 | 300 | $user_id = get_current_user_id(); |
301 | 301 | foreach ( $messages as $t => $message ) { |
302 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
303 | - unset( $messages[ $t ] ); |
|
302 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
303 | + unset( $messages[$t] ); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | return $messages; |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @return void |
329 | 329 | */ |
330 | 330 | public function remove( $key ) { |
331 | - if ( isset( self::$messages[ $key ] ) ) { |
|
332 | - unset( self::$messages[ $key ] ); |
|
331 | + if ( isset( self::$messages[$key] ) ) { |
|
332 | + unset( self::$messages[$key] ); |
|
333 | 333 | $this->update_list(); |
334 | 334 | } |
335 | 335 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return void |
87 | 87 | */ |
88 | 88 | private function init_style_settings( $atts ) { |
89 | - $style_settings = array( |
|
89 | + $style_settings = array( |
|
90 | 90 | 'border_color' => 'dddddd', |
91 | 91 | 'bg_color' => 'f7f7f7', |
92 | 92 | 'text_color' => '444444', |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | $this->style_settings = apply_filters( 'frm_show_entry_styles', $style_settings ); |
98 | 98 | |
99 | 99 | foreach ( $this->style_settings as $key => $setting ) { |
100 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
101 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
100 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
101 | + $this->style_settings[$key] = $atts[$key]; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if ( $this->is_color_setting( $key ) ) { |
105 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
105 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | public function set( $key, $value ) { |
62 | - $this->state[ $key ] = $value; |
|
62 | + $this->state[$key] = $value; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | public function get( $key, $default ) { |
78 | - if ( isset( $this->state[ $key ] ) ) { |
|
79 | - return $this->state[ $key ]; |
|
78 | + if ( isset( $this->state[$key] ) ) { |
|
79 | + return $this->state[$key]; |
|
80 | 80 | } |
81 | 81 | return $default; |
82 | 82 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | private function compressed_state() { |
172 | 172 | $compressed = array(); |
173 | 173 | foreach ( $this->state as $key => $value ) { |
174 | - $compressed[ self::compressed_key( $key ) ] = $value; |
|
174 | + $compressed[self::compressed_key( $key )] = $value; |
|
175 | 175 | } |
176 | 176 | return $compressed; |
177 | 177 | } |
@@ -85,7 +85,7 @@ |
||
85 | 85 | foreach ( $errors as $field => $error ) { |
86 | 86 | $field_id = str_replace( 'field', '', $field ); |
87 | 87 | $error = self::maybe_modify_ajax_error( $error, $field_id, $form, $errors ); |
88 | - $obj[ $field_id ] = $error; |
|
88 | + $obj[$field_id] = $error; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $response['errors'] = $obj; |
@@ -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; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
355 | 355 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
356 | 356 | |
357 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
357 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
358 | 358 | $query_args = array( $id ); |
359 | 359 | $query = $wpdb->prepare( $query, $query_args ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
360 | 360 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | private static function prepare_entries( &$entries ) { |
400 | 400 | foreach ( $entries as $k => $entry ) { |
401 | 401 | self::prepare_entry( $entry ); |
402 | - $entries[ $k ] = $entry; |
|
402 | + $entries[$k] = $entry; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -425,19 +425,19 @@ discard block |
||
425 | 425 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
426 | 426 | |
427 | 427 | if ( $meta_val->item_id == $entry->id ) { |
428 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
428 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
429 | 429 | if ( $include_key ) { |
430 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
430 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
431 | 431 | } |
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | 435 | // include sub entries in an array |
436 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
437 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
436 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
437 | + $entry->metas[$meta_val->field_id] = array(); |
|
438 | 438 | } |
439 | 439 | |
440 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
440 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
441 | 441 | |
442 | 442 | unset( $meta_val ); |
443 | 443 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | |
485 | 485 | if ( $inc_form ) { |
486 | 486 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
487 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
487 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
@@ -532,16 +532,16 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | foreach ( $metas as $m_key => $meta_val ) { |
535 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
535 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
540 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
539 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
540 | + $entries[$meta_val->item_id]->metas = array(); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
544 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
544 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
545 | 545 | unset( $m_key, $meta_val ); |
546 | 546 | } |
547 | 547 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | } |
720 | 720 | |
721 | 721 | private static function get_entry_value( $values, $name, $default ) { |
722 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
722 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | /** |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
901 | 901 | global $frm_vars; |
902 | 902 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
903 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
903 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
904 | 904 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
905 | 905 | } |
906 | 906 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | while ( $count > 0 && ! is_null( $one = $this->read_one() ) ) { |
80 | 80 | $value .= $one; |
81 | - --$count; |
|
81 | + -- $count; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->strip_quotes( $value ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function read_one() { |
94 | 94 | if ( $this->pos <= $this->max ) { |
95 | - $value = $this->string[ $this->pos ]; |
|
95 | + $value = $this->string[$this->pos]; |
|
96 | 96 | $this->pos += 1; |
97 | 97 | } else { |
98 | 98 | $value = null; |
@@ -65,12 +65,12 @@ |
||
65 | 65 | $string->read( 1 ); |
66 | 66 | |
67 | 67 | $val = array(); |
68 | - for ( $i = 0; $i < $count; $i++ ) { |
|
68 | + for ( $i = 0; $i < $count; $i ++ ) { |
|
69 | 69 | $array_key = $this->do_parse( $string ); |
70 | 70 | $array_value = $this->do_parse( $string ); |
71 | 71 | |
72 | 72 | if ( ! is_array( $array_key ) ) { |
73 | - $val[ $array_key ] = $array_value; |
|
73 | + $val[$array_key] = $array_value; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 |
@@ -240,26 +240,26 @@ discard block |
||
240 | 240 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
241 | 241 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
242 | 242 | if ( ! $action || ! is_object( $action ) ) { |
243 | - $form_options[ $opt . 'action' ] = self::get_default_action_type(); |
|
244 | - $form_options[ $opt . 'msg' ] = self::get_default_msg(); |
|
243 | + $form_options[$opt . 'action'] = self::get_default_action_type(); |
|
244 | + $form_options[$opt . 'msg'] = self::get_default_msg(); |
|
245 | 245 | |
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | - $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
249 | + $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
250 | 250 | |
251 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
251 | + switch ( $form_options[$opt . 'action'] ) { |
|
252 | 252 | case 'redirect': |
253 | - $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
253 | + $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
254 | 254 | $form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] ); |
255 | 255 | break; |
256 | 256 | |
257 | 257 | case 'page': |
258 | - $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
258 | + $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | default: |
262 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
262 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
263 | 263 | $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
264 | 264 | } |
265 | 265 | } |
@@ -348,20 +348,20 @@ discard block |
||
348 | 348 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
349 | 349 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
350 | 350 | $data = array( |
351 | - 'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : self::get_default_action_type(), |
|
351 | + 'success_action' => isset( $form_options[$opt . 'action'] ) ? $form_options[$opt . 'action'] : self::get_default_action_type(), |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | switch ( $data['success_action'] ) { |
355 | 355 | case 'redirect': |
356 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
356 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
357 | 357 | break; |
358 | 358 | |
359 | 359 | case 'page': |
360 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
360 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
361 | 361 | break; |
362 | 362 | |
363 | 363 | default: |
364 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : self::get_default_msg(); |
|
364 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : self::get_default_msg(); |
|
365 | 365 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
366 | 366 | } |
367 | 367 |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( $new_val !== $value ) { |
212 | - $new_values[ $key ] = $new_val; |
|
212 | + $new_values[$key] = $new_val; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | foreach ( $values as $value_key => $value ) { |
242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
243 | - $new_values[ $value_key ] = $value; |
|
243 | + $new_values[$value_key] = $value; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
324 | 324 | foreach ( $all_fields as $fid ) { |
325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
326 | - $values['item_meta'][ $fid->id ] = ''; |
|
326 | + $values['item_meta'][$fid->id] = ''; |
|
327 | 327 | } |
328 | - $field_array[ $fid->id ] = $fid; |
|
328 | + $field_array[$fid->id] = $fid; |
|
329 | 329 | } |
330 | 330 | unset( $all_fields ); |
331 | 331 | |
332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
334 | - $field = $field_array[ $field_id ]; |
|
333 | + if ( isset( $field_array[$field_id] ) ) { |
|
334 | + $field = $field_array[$field_id]; |
|
335 | 335 | } else { |
336 | 336 | $field = FrmField::getOne( $field_id ); |
337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
344 | 344 | if ( $is_settings_page ) { |
345 | 345 | self::get_settings_page_html( $values, $field ); |
346 | 346 | |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
356 | 356 | |
357 | 357 | foreach ( $update_options as $opt => $default ) { |
358 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
359 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
358 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
359 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
363 | 363 | |
364 | 364 | $new_field = array( |
365 | 365 | 'field_options' => $field->field_options, |
366 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
366 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
367 | 367 | ); |
368 | 368 | |
369 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
370 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
369 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
370 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
371 | 371 | if ( is_array( $option ) ) { |
372 | 372 | foreach ( $option as $key => $item ) { |
373 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
373 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | * Updating the settings page |
459 | 459 | */ |
460 | 460 | private static function get_settings_page_html( $values, &$field ) { |
461 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
461 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
462 | 462 | $prev_opts = array(); |
463 | 463 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
464 | 464 | |
465 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
465 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
466 | 466 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
467 | 467 | $prev_opts = $field->field_options; |
468 | 468 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | foreach ( $field_cols as $col => $default ) { |
489 | 489 | $default = ( $default === '' ) ? $field->{$col} : $default; |
490 | 490 | |
491 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
491 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | // Don't save the template option. |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | self::maybe_get_form( $form ); |
911 | 911 | } |
912 | 912 | |
913 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
914 | - return $frm_vars['form_params'][ $form->id ]; |
|
913 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
914 | + return $frm_vars['form_params'][$form->id]; |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -940,15 +940,15 @@ discard block |
||
940 | 940 | //if there are two forms on the same page, make sure not to submit both |
941 | 941 | foreach ( $default_values as $var => $default ) { |
942 | 942 | if ( $var == 'action' ) { |
943 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
943 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
944 | 944 | } else { |
945 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
945 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
946 | 946 | } |
947 | 947 | unset( $var, $default ); |
948 | 948 | } |
949 | 949 | } else { |
950 | 950 | foreach ( $default_values as $var => $default ) { |
951 | - $values[ $var ] = $default; |
|
951 | + $values[$var] = $default; |
|
952 | 952 | unset( $var, $default ); |
953 | 953 | } |
954 | 954 | } |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | 'sdir' => '', |
975 | 975 | ); |
976 | 976 | foreach ( $defaults as $var => $default ) { |
977 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
977 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | return $values; |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | 'keep_post' => '', |
1003 | 1003 | ); |
1004 | 1004 | foreach ( $defaults as $var => $default ) { |
1005 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1005 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | return $values; |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | $form = $atts['form']; |
1106 | 1106 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1107 | 1107 | |
1108 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1108 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | /** |