@@ -285,7 +285,8 @@ |
||
285 | 285 | public static function get_settings_for_output( $style ) { |
286 | 286 | if ( self::previewing_style() ) { |
287 | 287 | $frm_style = new FrmStyle(); |
288 | - if ( isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
288 | + if ( isset( $_POST['frm_style_setting'] ) ) { |
|
289 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
289 | 290 | |
290 | 291 | // Sanitizing is done later. |
291 | 292 | $posted = wp_unslash( $_POST['frm_style_setting'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | '-' => 'down', |
136 | 136 | '+' => 'up', |
137 | 137 | ); |
138 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
138 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
139 | 139 | } else { |
140 | 140 | //frm_minus1_icon |
141 | 141 | $key = str_replace( 'p', '', $key ); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | '-' => 'minus', |
144 | 144 | '+' => 'plus', |
145 | 145 | ); |
146 | - $class = 'frm_' . $plus[ $icon ]; |
|
146 | + $class = 'frm_' . $plus[$icon]; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | if ( $key ) { |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | ?> |
170 | 170 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
171 | 171 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
172 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
173 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
172 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
173 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
174 | 174 | <b class="caret"></b> |
175 | 175 | </button> |
176 | 176 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
179 | 179 | <a href="javascript:void(0);"> |
180 | 180 | <label> |
181 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?> /> |
|
181 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?> /> |
|
182 | 182 | <span> |
183 | 183 | <?php |
184 | 184 | FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); |
@@ -271,15 +271,15 @@ discard block |
||
271 | 271 | $vars = array_diff( $vars, $remove ); |
272 | 272 | |
273 | 273 | foreach ( $vars as $var ) { |
274 | - if ( ! isset( $settings[ $var ] ) ) { |
|
274 | + if ( ! isset( $settings[$var] ) ) { |
|
275 | 275 | continue; |
276 | 276 | } |
277 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
278 | - $defaults[ $var ] = ''; |
|
277 | + if ( ! isset( $defaults[$var] ) ) { |
|
278 | + $defaults[$var] = ''; |
|
279 | 279 | } |
280 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
280 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
281 | 281 | if ( $show ) { |
282 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
282 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | |
329 | 329 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
330 | 330 | foreach ( $checkbox_opts as $opt ) { |
331 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
332 | - $settings[ $opt ] = 0; |
|
331 | + if ( ! isset( $settings[$opt] ) ) { |
|
332 | + $settings[$opt] = 0; |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $css = ''; |
358 | 358 | } |
359 | 359 | foreach ( $opts as $opt ) { |
360 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
360 | + self::get_color_output( $css, $settings[$opt] ); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | } |
@@ -168,7 +168,7 @@ |
||
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - unset( $dependencies[ $index ] ); |
|
171 | + unset( $dependencies[$index] ); |
|
172 | 172 | $dependencies = array_values( $dependencies ); |
173 | 173 | |
174 | 174 | $styles->registered['wp-admin']->deps = $dependencies; |
@@ -349,12 +349,12 @@ |
||
349 | 349 | array_walk( |
350 | 350 | $styles, |
351 | 351 | /** |
352 | - * Echo a style card for a single style in the $styles array. |
|
353 | - * |
|
354 | - * @param WP_Post $style |
|
355 | - * @param int $count Used for pagination. |
|
356 | - * @return void |
|
357 | - */ |
|
352 | + * Echo a style card for a single style in the $styles array. |
|
353 | + * |
|
354 | + * @param WP_Post $style |
|
355 | + * @param int $count Used for pagination. |
|
356 | + * @return void |
|
357 | + */ |
|
358 | 358 | function( $style ) use ( &$count ) { |
359 | 359 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
360 | 360 | $this->echo_style_card( $style, $hidden ); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | private static function has_dark_background( $style ) { |
131 | 131 | $key = 'fieldset_bg_color'; |
132 | 132 | |
133 | - if ( empty( $style->post_content[ $key ] ) ) { |
|
133 | + if ( empty( $style->post_content[$key] ) ) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | |
137 | - $color = $style->post_content[ $key ]; |
|
137 | + $color = $style->post_content[$key]; |
|
138 | 138 | |
139 | 139 | if ( 0 === strpos( $color, 'rgba' ) ) { |
140 | 140 | preg_match_all( '/([\\d.]+)/', $color, $matches ); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | ), |
205 | 205 | '/style-templates/' . $style['slug'] |
206 | 206 | ); |
207 | - $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
207 | + $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
208 | 208 | return $params; |
209 | 209 | }; |
210 | 210 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | continue; |
266 | 266 | } |
267 | 267 | |
268 | - $value = $style->post_content[ $key ]; |
|
268 | + $value = $style->post_content[$key]; |
|
269 | 269 | |
270 | 270 | $is_hex = in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) && $value !== 'transparent'; |
271 | 271 | if ( $is_hex ) { |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | function( $style ) use ( &$count ) { |
414 | 414 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
415 | 415 | $this->echo_style_card( $style, $hidden ); |
416 | - ++$count; |
|
416 | + ++ $count; |
|
417 | 417 | } |
418 | 418 | ); |
419 | 419 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | // Remove 'Styling Template' from titles. |
51 | 51 | foreach ( $api_info as $id => $template ) { |
52 | 52 | if ( isset( $template['name'] ) ) { |
53 | - $api_info[ $id ]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] ); |
|
53 | + $api_info[$id]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $field_val = ''; |
133 | 133 | if ( is_object( $this->field ) ) { |
134 | 134 | $field_val = $this->field->{$column}; |
135 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
136 | - $field_val = $this->field[ $column ]; |
|
135 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
136 | + $field_val = $this->field[$column]; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $field_val; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if ( is_object( $this->field ) ) { |
148 | 148 | $this->field->{$column} = $value; |
149 | 149 | } elseif ( is_array( $this->field ) ) { |
150 | - $this->field[ $column ] = $value; |
|
150 | + $this->field[$column] = $value; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | printf( |
528 | 528 | /* translators: %s: Field type */ |
529 | 529 | esc_html__( '%s Options', 'formidable' ), |
530 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
530 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
531 | 531 | ); |
532 | 532 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
533 | 533 | ?> |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | $fields = FrmField::field_selection(); |
651 | 651 | $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
652 | 652 | |
653 | - if ( isset( $fields[ $this->type ] ) ) { |
|
654 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
653 | + if ( isset( $fields[$this->type] ) ) { |
|
654 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | return $name; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | |
664 | 664 | public function get_default_field_options() { |
665 | - $opts = array( |
|
665 | + $opts = array( |
|
666 | 666 | 'size' => '', |
667 | 667 | 'max' => '', |
668 | 668 | 'label' => '', |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | } else { |
1006 | 1006 | $args['save_array'] = $this->is_readonly_array(); |
1007 | - $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
1007 | + $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | return $hidden; |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | protected function show_single_hidden( $selected, $args ) { |
1014 | 1014 | if ( $args['save_array'] ) { |
1015 | 1015 | $args['field_name'] .= '[]'; |
1016 | - $id = ''; |
|
1016 | + $id = ''; |
|
1017 | 1017 | } else { |
1018 | 1018 | $id = ' id="' . esc_attr( $args['html_id'] ) . '"'; |
1019 | 1019 | } |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | $selected = $values['field_value']; |
1030 | 1030 | |
1031 | 1031 | if ( isset( $values['combo_name'] ) ) { |
1032 | - $options = $options[ $values['combo_name'] ]; |
|
1033 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
1032 | + $options = $options[$values['combo_name']]; |
|
1033 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | $input = $this->select_tag( $values ); |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | protected function fill_display_field_values( $args = array() ) { |
1084 | - $defaults = array( |
|
1084 | + $defaults = array( |
|
1085 | 1085 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
1086 | 1086 | 'field_id' => $this->get_field_column( 'id' ), |
1087 | 1087 | 'field_plus_id' => '', |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
1137 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
1138 | 1138 | if ( $error_comes_first ) { |
1139 | 1139 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
1140 | 1140 | } else { |
@@ -1213,11 +1213,11 @@ discard block |
||
1213 | 1213 | |
1214 | 1214 | $field_id = $this->get_field_column( 'id' ); |
1215 | 1215 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
1216 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
1216 | + $frm_validated_unique_values[$field_id] = array(); |
|
1217 | 1217 | return false; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
1220 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
1221 | 1221 | return $already_validated_this_value; |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | private function value_validated_as_unique( $value ) { |
1243 | 1243 | global $frm_validated_unique_values; |
1244 | 1244 | $field_id = $this->get_field_column( 'id' ); |
1245 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
1245 | + $frm_validated_unique_values[$field_id][] = $value; |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | public function get_value_to_save( $value, $atts ) { |
@@ -1274,8 +1274,8 @@ discard block |
||
1274 | 1274 | $value = $this->prepare_display_value( $value, $atts ); |
1275 | 1275 | |
1276 | 1276 | if ( is_array( $value ) ) { |
1277 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
1278 | - $value = $value[ $atts['show'] ]; |
|
1277 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
1278 | + $value = $value[$atts['show']]; |
|
1279 | 1279 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
1280 | 1280 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
1281 | 1281 | $value = implode( $sep, $value ); |
@@ -1344,8 +1344,8 @@ discard block |
||
1344 | 1344 | $saved_entries = $atts['ids']; |
1345 | 1345 | $new_value = array(); |
1346 | 1346 | foreach ( (array) $value as $old_child_id ) { |
1347 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
1348 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
1347 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
1348 | + $new_value[] = $saved_entries[$old_child_id]; |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | ), |
512 | 512 | ); |
513 | 513 | |
514 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
514 | + if ( ! isset( $available_status[$status] ) ) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
518 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
518 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
519 | 519 | |
520 | 520 | $params = FrmForm::list_page_params(); |
521 | 521 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | check_admin_referer( $status . '_form_' . $params['id'] ); |
524 | 524 | |
525 | 525 | $count = 0; |
526 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
526 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
527 | 527 | $count ++; |
528 | 528 | } |
529 | 529 | |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
541 | 541 | $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>' ); |
542 | 542 | |
543 | - $message = $available_status[ $status ]['message']; |
|
543 | + $message = $available_status[$status]['message']; |
|
544 | 544 | |
545 | 545 | self::display_forms_list( $params, $message ); |
546 | 546 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | 'type' => 'request', |
562 | 562 | ) |
563 | 563 | ); |
564 | - $message = sprintf( |
|
564 | + $message = sprintf( |
|
565 | 565 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
566 | 566 | _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' ), |
567 | 567 | $count, |
@@ -984,11 +984,11 @@ discard block |
||
984 | 984 | } |
985 | 985 | |
986 | 986 | foreach ( $template['categories'] as $category ) { |
987 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
988 | - $templates_by_category[ $category ] = array(); |
|
987 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
988 | + $templates_by_category[$category] = array(); |
|
989 | 989 | } |
990 | 990 | |
991 | - $templates_by_category[ $category ][] = $template; |
|
991 | + $templates_by_category[$category][] = $template; |
|
992 | 992 | } |
993 | 993 | } |
994 | 994 | unset( $template ); |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | $forms = FrmForm::get_published_forms( $where ); |
1018 | 1018 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
1019 | 1019 | |
1020 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
1020 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
1021 | 1021 | |
1022 | 1022 | unset( $pricing, $license_type, $where ); |
1023 | 1023 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | |
1261 | 1261 | foreach ( array( 'landing', 'chat' ) as $feature ) { |
1262 | 1262 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
1263 | - unset( $sections[ $feature ] ); |
|
1263 | + unset( $sections[$feature] ); |
|
1264 | 1264 | } |
1265 | 1265 | } |
1266 | 1266 | |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $section['id'] = $section['anchor']; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | - $sections[ $key ] = $section; |
|
1296 | + $sections[$key] = $section; |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | return $sections; |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | if ( ! empty( $user_fields ) ) { |
1412 | 1412 | $user_helpers = array(); |
1413 | 1413 | foreach ( $user_fields as $uk => $uf ) { |
1414 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
1414 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1415 | 1415 | unset( $uk, $uf ); |
1416 | 1416 | } |
1417 | 1417 | |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
1544 | 1544 | $frm_vars['js_validate_forms'] = array(); |
1545 | 1545 | } |
1546 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
1546 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | public static function get_email_html() { |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
1699 | 1699 | } else { |
1700 | 1700 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
1701 | - $action = $vars[ $action ]; |
|
1701 | + $action = $vars[$action]; |
|
1702 | 1702 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1703 | 1703 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1704 | 1704 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | $actions = array(); |
1833 | 1833 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
1834 | 1834 | if ( is_object( $form ) ) { |
1835 | - $actions[ $form->id ] = $form->name; |
|
1835 | + $actions[$form->id] = $form->name; |
|
1836 | 1836 | } |
1837 | 1837 | unset( $form ); |
1838 | 1838 | } |
@@ -2074,8 +2074,8 @@ discard block |
||
2074 | 2074 | private static function get_saved_errors( $form, $params ) { |
2075 | 2075 | global $frm_vars; |
2076 | 2076 | |
2077 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2078 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
2077 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2078 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
2079 | 2079 | } else { |
2080 | 2080 | $errors = array(); |
2081 | 2081 | } |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | public static function just_created_entry( $form_id ) { |
2098 | 2098 | global $frm_vars; |
2099 | 2099 | |
2100 | - 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; |
|
2100 | + 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; |
|
2101 | 2101 | } |
2102 | 2102 | |
2103 | 2103 | /** |
@@ -2121,7 +2121,7 @@ discard block |
||
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | $opt = 'success_action'; |
2124 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
2124 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
2125 | 2125 | $method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' ); |
2126 | 2126 | |
2127 | 2127 | if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) { |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
2135 | 2135 | if ( ! isset( $params['id'] ) ) { |
2136 | 2136 | global $frm_vars; |
2137 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
2137 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
2138 | 2138 | } |
2139 | 2139 | |
2140 | 2140 | $conf_method = self::get_confirmation_method( |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $args['success_opt'] = $opt; |
2194 | 2194 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
2195 | 2195 | |
2196 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
2196 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
2197 | 2197 | self::load_page_after_submit( $args ); |
2198 | 2198 | } elseif ( $args['conf_method'] === 'redirect' ) { |
2199 | 2199 | self::redirect_after_submit( $args ); |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | |
2336 | 2336 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
2337 | 2337 | |
2338 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
2338 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
2339 | 2339 | |
2340 | 2340 | /** |
2341 | 2341 | * Filters the run success action args. |
@@ -2355,8 +2355,8 @@ discard block |
||
2355 | 2355 | private static function load_page_after_submit( $args ) { |
2356 | 2356 | global $post; |
2357 | 2357 | $opt = $args['success_opt']; |
2358 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
2359 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
2358 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
2359 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
2360 | 2360 | $old_post = $post; |
2361 | 2361 | $post = $page; |
2362 | 2362 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | add_filter( 'frm_use_wpautop', '__return_false' ); |
2379 | 2379 | |
2380 | 2380 | $opt = $args['success_opt']; |
2381 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
2381 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
2382 | 2382 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
2383 | 2383 | $success_url = do_shortcode( $success_url ); |
2384 | 2384 | |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | 'description' => false, |
2551 | 2551 | 'reset' => false, |
2552 | 2552 | ); |
2553 | - $args = wp_parse_args( $args, $defaults ); |
|
2553 | + $args = wp_parse_args( $args, $defaults ); |
|
2554 | 2554 | } |
2555 | 2555 | |
2556 | 2556 | /** |
@@ -2805,7 +2805,7 @@ discard block |
||
2805 | 2805 | |
2806 | 2806 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
2807 | 2807 | |
2808 | - $html = FrmAppHelper::clip( |
|
2808 | + $html = FrmAppHelper::clip( |
|
2809 | 2809 | function() { |
2810 | 2810 | FrmAppHelper::maybe_autocomplete_pages_options( |
2811 | 2811 | array( |
@@ -2837,25 +2837,25 @@ discard block |
||
2837 | 2837 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
2838 | 2838 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
2839 | 2839 | if ( ! $action || ! is_object( $action ) ) { |
2840 | - $form_options[ $opt . 'action' ] = FrmOnSubmitHelper::get_default_action_type(); |
|
2841 | - $form_options[ $opt . 'msg' ] = FrmOnSubmitHelper::get_default_msg(); |
|
2840 | + $form_options[$opt . 'action'] = FrmOnSubmitHelper::get_default_action_type(); |
|
2841 | + $form_options[$opt . 'msg'] = FrmOnSubmitHelper::get_default_msg(); |
|
2842 | 2842 | return; |
2843 | 2843 | } |
2844 | 2844 | |
2845 | - $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
2845 | + $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
2846 | 2846 | |
2847 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
2847 | + switch ( $form_options[$opt . 'action'] ) { |
|
2848 | 2848 | case 'redirect': |
2849 | - $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
2849 | + $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
2850 | 2850 | break; |
2851 | 2851 | |
2852 | 2852 | case 'page': |
2853 | - $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
2853 | + $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
2854 | 2854 | break; |
2855 | 2855 | |
2856 | 2856 | default: |
2857 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
2858 | - $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
2857 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
2858 | + $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
|
2859 | 2859 | } |
2860 | 2860 | } |
2861 | 2861 | |
@@ -2876,7 +2876,7 @@ discard block |
||
2876 | 2876 | FrmAppHelper::unserialize_or_decode( $form->options ); |
2877 | 2877 | |
2878 | 2878 | $flag_key = 'on_submit_migrated'; |
2879 | - if ( ! empty( $form->options[ $flag_key ] ) ) { |
|
2879 | + if ( ! empty( $form->options[$flag_key] ) ) { |
|
2880 | 2880 | return; |
2881 | 2881 | } |
2882 | 2882 | |
@@ -2920,7 +2920,7 @@ discard block |
||
2920 | 2920 | $action['post_content'] = FrmAppHelper::prepare_and_encode( $action['post_content'] ); |
2921 | 2921 | FrmDb::save_json_post( $action ); |
2922 | 2922 | |
2923 | - $form->options[ $flag_key ] = 1; |
|
2923 | + $form->options[$flag_key] = 1; |
|
2924 | 2924 | FrmForm::update( $form->id, array( 'options' => $form->options ) ); |
2925 | 2925 | } |
2926 | 2926 | |
@@ -2936,20 +2936,20 @@ discard block |
||
2936 | 2936 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
2937 | 2937 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
2938 | 2938 | $data = array( |
2939 | - 'success_action' => $form_options[ $opt . 'action' ], |
|
2939 | + 'success_action' => $form_options[$opt . 'action'], |
|
2940 | 2940 | ); |
2941 | 2941 | |
2942 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
2942 | + switch ( $form_options[$opt . 'action'] ) { |
|
2943 | 2943 | case 'redirect': |
2944 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
2944 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
2945 | 2945 | break; |
2946 | 2946 | |
2947 | 2947 | case 'page': |
2948 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
2948 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
2949 | 2949 | break; |
2950 | 2950 | |
2951 | 2951 | default: |
2952 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_msg(); |
|
2952 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_msg(); |
|
2953 | 2953 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
2954 | 2954 | } |
2955 | 2955 |
@@ -1682,7 +1682,8 @@ discard block |
||
1682 | 1682 | $vars = array(); |
1683 | 1683 | FrmAppHelper::include_svg(); |
1684 | 1684 | |
1685 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1685 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
1686 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1686 | 1687 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
1687 | 1688 | |
1688 | 1689 | // Javascript needs to be allowed in some field settings. |
@@ -1992,7 +1993,8 @@ discard block |
||
1992 | 1993 | private static function maybe_get_form_to_show( $id ) { |
1993 | 1994 | $form = false; |
1994 | 1995 | |
1995 | - if ( ! empty( $id ) ) { // form id or key is set |
|
1996 | + if ( ! empty( $id ) ) { |
|
1997 | +// form id or key is set |
|
1996 | 1998 | $form = FrmForm::getOne( $id ); |
1997 | 1999 | if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) { |
1998 | 2000 | $form = false; |
@@ -2075,7 +2077,8 @@ discard block |
||
2075 | 2077 | private static function get_saved_errors( $form, $params ) { |
2076 | 2078 | global $frm_vars; |
2077 | 2079 | |
2078 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2080 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
2081 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2079 | 2082 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
2080 | 2083 | } else { |
2081 | 2084 | $errors = array(); |
@@ -2116,7 +2119,8 @@ discard block |
||
2116 | 2119 | * @return string|array |
2117 | 2120 | */ |
2118 | 2121 | private static function get_confirmation_method( $atts ) { |
2119 | - if ( ! empty( $atts['entry_id'] ) ) { // Check against entry has already submitted error. |
|
2122 | + if ( ! empty( $atts['entry_id'] ) ) { |
|
2123 | +// Check against entry has already submitted error. |
|
2120 | 2124 | $met_actions = self::get_met_on_submit_actions( $atts ); |
2121 | 2125 | if ( $met_actions ) { |
2122 | 2126 | return $met_actions; |
@@ -2230,7 +2234,8 @@ discard block |
||
2230 | 2234 | } |
2231 | 2235 | |
2232 | 2236 | if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) { |
2233 | - if ( $has_redirect ) { // Do not process because we run the first redirect action only. |
|
2237 | + if ( $has_redirect ) { |
|
2238 | +// Do not process because we run the first redirect action only. |
|
2234 | 2239 | continue; |
2235 | 2240 | } |
2236 | 2241 | |
@@ -2393,12 +2398,14 @@ discard block |
||
2393 | 2398 | |
2394 | 2399 | $doing_ajax = FrmAppHelper::doing_ajax(); |
2395 | 2400 | |
2396 | - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs. |
|
2401 | + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { |
|
2402 | +// Is AJAX submit and there is just one Redirect action runs. |
|
2397 | 2403 | echo json_encode( array( 'redirect' => $success_url ) ); |
2398 | 2404 | wp_die(); |
2399 | 2405 | } |
2400 | 2406 | |
2401 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2407 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { |
|
2408 | +// Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2402 | 2409 | wp_redirect( esc_url_raw( $success_url ) ); |
2403 | 2410 | die(); // do not use wp_die or redirect fails |
2404 | 2411 | } |
@@ -2431,7 +2438,8 @@ discard block |
||
2431 | 2438 | |
2432 | 2439 | echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
2433 | 2440 | echo '<script>'; |
2434 | - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load. |
|
2441 | + if ( empty( $args['doing_ajax'] ) ) { |
|
2442 | +// Not AJAX submit, delay JS until window.load. |
|
2435 | 2443 | echo 'window.onload=function(){'; |
2436 | 2444 | } |
2437 | 2445 | echo 'setTimeout(function(){window.location="' . esc_url_raw( $args['success_url'] ) . '";}, ' . intval( $delay_time ) . ');'; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'text-color' => $style->post_content['text_color'], |
41 | 41 | 'submit-bg-color' => $style->post_content['submit_bg_color'], |
42 | 42 | ); |
43 | - $index = 0; |
|
43 | + $index = 0; |
|
44 | 44 | foreach ( $colors as $css_var_name => $color ) { |
45 | 45 | if ( 0 !== strpos( $color, 'rgb' ) ) { |
46 | 46 | $color = '#' . $color; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'style' => 'background-color: var(--' . $css_var_name . ')', |
52 | 52 | ); |
53 | 53 | |
54 | - ++$index; |
|
54 | + ++ $index; |
|
55 | 55 | ?> |
56 | 56 | <div <?php FrmAppHelper::array_to_html_params( $circle_params, true ); ?>></div> |
57 | 57 | <?php |