@@ -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 |
@@ -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 |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | if ( isset( $addon['categories'] ) ) { |
106 | 106 | $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); |
107 | 107 | if ( ! empty( $cats ) ) { |
108 | - unset( $addons[ $k ] ); |
|
108 | + unset( $addons[$k] ); |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) { |
114 | - $addons[ $k ]['is_new'] = $this->is_new( $addon ); |
|
114 | + $addons[$k]['is_new'] = $this->is_new( $addon ); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | return $addon; |
154 | 154 | } |
155 | 155 | } |
156 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
157 | - $plugin = $addons[ $download_id ]; |
|
156 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
157 | + $plugin = $addons[$download_id]; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $plugin; |
@@ -520,11 +520,11 @@ discard block |
||
520 | 520 | ), |
521 | 521 | ); |
522 | 522 | |
523 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
523 | + if ( ! isset( $available_status[$status] ) ) { |
|
524 | 524 | return; |
525 | 525 | } |
526 | 526 | |
527 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
527 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
528 | 528 | |
529 | 529 | $params = FrmForm::list_page_params(); |
530 | 530 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | check_admin_referer( $status . '_form_' . $params['id'] ); |
533 | 533 | |
534 | 534 | $count = 0; |
535 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
535 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
536 | 536 | $count ++; |
537 | 537 | } |
538 | 538 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
550 | 550 | $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>' ); |
551 | 551 | |
552 | - $message = $available_status[ $status ]['message']; |
|
552 | + $message = $available_status[$status]['message']; |
|
553 | 553 | |
554 | 554 | self::display_forms_list( $params, $message ); |
555 | 555 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | 'type' => 'request', |
571 | 571 | ) |
572 | 572 | ); |
573 | - $message = sprintf( |
|
573 | + $message = sprintf( |
|
574 | 574 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
575 | 575 | _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' ), |
576 | 576 | $count, |
@@ -994,11 +994,11 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | foreach ( $template['categories'] as $category ) { |
997 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
998 | - $templates_by_category[ $category ] = array(); |
|
997 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
998 | + $templates_by_category[$category] = array(); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | - $templates_by_category[ $category ][] = $template; |
|
1001 | + $templates_by_category[$category][] = $template; |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | unset( $template ); |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | $forms = FrmForm::get_published_forms( $where ); |
1028 | 1028 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
1029 | 1029 | |
1030 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
1030 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
1031 | 1031 | |
1032 | 1032 | unset( $pricing, $license_type, $where ); |
1033 | 1033 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | |
1271 | 1271 | foreach ( array( 'landing', 'chat' ) as $feature ) { |
1272 | 1272 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
1273 | - unset( $sections[ $feature ] ); |
|
1273 | + unset( $sections[$feature] ); |
|
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | $section['id'] = $section['anchor']; |
1304 | 1304 | } |
1305 | 1305 | |
1306 | - $sections[ $key ] = $section; |
|
1306 | + $sections[$key] = $section; |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | return $sections; |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | if ( ! empty( $user_fields ) ) { |
1422 | 1422 | $user_helpers = array(); |
1423 | 1423 | foreach ( $user_fields as $uk => $uf ) { |
1424 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
1424 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1425 | 1425 | unset( $uk, $uf ); |
1426 | 1426 | } |
1427 | 1427 | |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
1554 | 1554 | $frm_vars['js_validate_forms'] = array(); |
1555 | 1555 | } |
1556 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
1556 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | public static function get_email_html() { |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
1709 | 1709 | } else { |
1710 | 1710 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
1711 | - $action = $vars[ $action ]; |
|
1711 | + $action = $vars[$action]; |
|
1712 | 1712 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1713 | 1713 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1714 | 1714 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | $actions = array(); |
1843 | 1843 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
1844 | 1844 | if ( is_object( $form ) ) { |
1845 | - $actions[ $form->id ] = $form->name; |
|
1845 | + $actions[$form->id] = $form->name; |
|
1846 | 1846 | } |
1847 | 1847 | unset( $form ); |
1848 | 1848 | } |
@@ -2083,8 +2083,8 @@ discard block |
||
2083 | 2083 | private static function get_saved_errors( $form, $params ) { |
2084 | 2084 | global $frm_vars; |
2085 | 2085 | |
2086 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2087 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
2086 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2087 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
2088 | 2088 | } else { |
2089 | 2089 | $errors = array(); |
2090 | 2090 | } |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | public static function just_created_entry( $form_id ) { |
2107 | 2107 | global $frm_vars; |
2108 | 2108 | |
2109 | - 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; |
|
2109 | + 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; |
|
2110 | 2110 | } |
2111 | 2111 | |
2112 | 2112 | /** |
@@ -2126,7 +2126,7 @@ discard block |
||
2126 | 2126 | private static function get_confirmation_method( $atts ) { |
2127 | 2127 | $action = FrmOnSubmitHelper::current_event( $atts ); |
2128 | 2128 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
2129 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
2129 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
2130 | 2130 | |
2131 | 2131 | if ( ! empty( $atts['entry_id'] ) ) { |
2132 | 2132 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2147,7 +2147,7 @@ discard block |
||
2147 | 2147 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
2148 | 2148 | if ( ! isset( $params['id'] ) ) { |
2149 | 2149 | global $frm_vars; |
2150 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
2150 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | $conf_method = self::get_confirmation_method( |
@@ -2228,7 +2228,7 @@ discard block |
||
2228 | 2228 | $args['success_opt'] = $opt; |
2229 | 2229 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
2230 | 2230 | |
2231 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
2231 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
2232 | 2232 | self::load_page_after_submit( $args ); |
2233 | 2233 | } elseif ( $args['conf_method'] === 'redirect' ) { |
2234 | 2234 | self::redirect_after_submit( $args ); |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | |
2388 | 2388 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
2389 | 2389 | |
2390 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
2390 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
2391 | 2391 | |
2392 | 2392 | /** |
2393 | 2393 | * Filters the run success action args. |
@@ -2407,8 +2407,8 @@ discard block |
||
2407 | 2407 | private static function load_page_after_submit( $args ) { |
2408 | 2408 | global $post; |
2409 | 2409 | $opt = $args['success_opt']; |
2410 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
2411 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
2410 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
2411 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
2412 | 2412 | $old_post = $post; |
2413 | 2413 | $post = $page; |
2414 | 2414 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2438,7 +2438,7 @@ discard block |
||
2438 | 2438 | add_filter( 'frm_use_wpautop', '__return_false' ); |
2439 | 2439 | |
2440 | 2440 | $opt = $args['success_opt']; |
2441 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
2441 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
2442 | 2442 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
2443 | 2443 | $success_url = do_shortcode( $success_url ); |
2444 | 2444 | |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | 'description' => false, |
2611 | 2611 | 'reset' => false, |
2612 | 2612 | ); |
2613 | - $args = wp_parse_args( $args, $defaults ); |
|
2613 | + $args = wp_parse_args( $args, $defaults ); |
|
2614 | 2614 | } |
2615 | 2615 | |
2616 | 2616 | /** |
@@ -2648,7 +2648,7 @@ discard block |
||
2648 | 2648 | $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; |
2649 | 2649 | |
2650 | 2650 | if ( $entry_id && is_numeric( $entry_id ) ) { |
2651 | - $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; |
|
2651 | + $message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg; |
|
2652 | 2652 | $class = 'frm_message'; |
2653 | 2653 | } else { |
2654 | 2654 | $message = $frm_settings->failed_msg; |
@@ -2872,7 +2872,7 @@ discard block |
||
2872 | 2872 | |
2873 | 2873 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
2874 | 2874 | |
2875 | - $html = FrmAppHelper::clip( |
|
2875 | + $html = FrmAppHelper::clip( |
|
2876 | 2876 | function() { |
2877 | 2877 | FrmAppHelper::maybe_autocomplete_pages_options( |
2878 | 2878 | array( |
@@ -1698,7 +1698,8 @@ discard block |
||
1698 | 1698 | $vars = array(); |
1699 | 1699 | FrmAppHelper::include_svg(); |
1700 | 1700 | |
1701 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1701 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
1702 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1702 | 1703 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
1703 | 1704 | |
1704 | 1705 | // Javascript needs to be allowed in some field settings. |
@@ -2008,7 +2009,8 @@ discard block |
||
2008 | 2009 | private static function maybe_get_form_to_show( $id ) { |
2009 | 2010 | $form = false; |
2010 | 2011 | |
2011 | - if ( ! empty( $id ) ) { // form id or key is set |
|
2012 | + if ( ! empty( $id ) ) { |
|
2013 | +// form id or key is set |
|
2012 | 2014 | $form = FrmForm::getOne( $id ); |
2013 | 2015 | if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) { |
2014 | 2016 | $form = false; |
@@ -2093,7 +2095,8 @@ discard block |
||
2093 | 2095 | private static function get_saved_errors( $form, $params ) { |
2094 | 2096 | global $frm_vars; |
2095 | 2097 | |
2096 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2098 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
2099 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2097 | 2100 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
2098 | 2101 | } else { |
2099 | 2102 | $errors = array(); |
@@ -2279,7 +2282,8 @@ discard block |
||
2279 | 2282 | $action_type = FrmOnSubmitHelper::get_action_type( $action ); |
2280 | 2283 | |
2281 | 2284 | if ( 'redirect' === $action_type ) { |
2282 | - if ( $has_redirect ) { // Do not process because we run the first redirect action only. |
|
2285 | + if ( $has_redirect ) { |
|
2286 | +// Do not process because we run the first redirect action only. |
|
2283 | 2287 | continue; |
2284 | 2288 | } |
2285 | 2289 | } |
@@ -2508,12 +2512,14 @@ discard block |
||
2508 | 2512 | |
2509 | 2513 | $doing_ajax = FrmAppHelper::doing_ajax(); |
2510 | 2514 | |
2511 | - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs. |
|
2515 | + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { |
|
2516 | +// Is AJAX submit and there is just one Redirect action runs. |
|
2512 | 2517 | echo json_encode( array( 'redirect' => $success_url ) ); |
2513 | 2518 | wp_die(); |
2514 | 2519 | } |
2515 | 2520 | |
2516 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2521 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { |
|
2522 | +// Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2517 | 2523 | wp_redirect( esc_url_raw( $success_url ) ); |
2518 | 2524 | die(); // do not use wp_die or redirect fails |
2519 | 2525 | } |
@@ -2546,7 +2552,8 @@ discard block |
||
2546 | 2552 | |
2547 | 2553 | echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
2548 | 2554 | echo '<script>'; |
2549 | - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load. |
|
2555 | + if ( empty( $args['doing_ajax'] ) ) { |
|
2556 | +// Not AJAX submit, delay JS until window.load. |
|
2550 | 2557 | echo 'window.onload=function(){'; |
2551 | 2558 | } |
2552 | 2559 | echo 'setTimeout(function(){window.location="' . esc_url_raw( $args['success_url'] ) . '";}, ' . intval( $delay_time ) . ');'; |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
220 | 220 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
221 | 221 | if ( ! $action || ! is_object( $action ) ) { |
222 | - $form_options[ $opt . 'action' ] = self::get_default_action_type(); |
|
223 | - $form_options[ $opt . 'msg' ] = self::get_default_msg(); |
|
222 | + $form_options[$opt . 'action'] = self::get_default_action_type(); |
|
223 | + $form_options[$opt . 'msg'] = self::get_default_msg(); |
|
224 | 224 | |
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
228 | + $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
229 | 229 | |
230 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
230 | + switch ( $form_options[$opt . 'action'] ) { |
|
231 | 231 | case 'redirect': |
232 | - $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
232 | + $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
233 | 233 | break; |
234 | 234 | |
235 | 235 | case 'page': |
236 | - $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
236 | + $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
237 | 237 | break; |
238 | 238 | |
239 | 239 | default: |
240 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
240 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
241 | 241 | $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
242 | 242 | } |
243 | 243 | } |
@@ -326,20 +326,20 @@ discard block |
||
326 | 326 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
327 | 327 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
328 | 328 | $data = array( |
329 | - 'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : self::get_default_action_type(), |
|
329 | + 'success_action' => isset( $form_options[$opt . 'action'] ) ? $form_options[$opt . 'action'] : self::get_default_action_type(), |
|
330 | 330 | ); |
331 | 331 | |
332 | 332 | switch ( $data['success_action'] ) { |
333 | 333 | case 'redirect': |
334 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
334 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
335 | 335 | break; |
336 | 336 | |
337 | 337 | case 'page': |
338 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
338 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
339 | 339 | break; |
340 | 340 | |
341 | 341 | default: |
342 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : self::get_default_msg(); |
|
342 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : self::get_default_msg(); |
|
343 | 343 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
344 | 344 | } |
345 | 345 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $page = $this->get_pagenum(); |
21 | 21 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
22 | 22 | |
23 | - $mode = self::get_param( |
|
23 | + $mode = self::get_param( |
|
24 | 24 | array( |
25 | 25 | 'param' => 'mode', |
26 | 26 | 'default' => 'list', |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | 'default' => 'name', |
33 | 33 | ) |
34 | 34 | ); |
35 | - $order = self::get_param( |
|
35 | + $order = self::get_param( |
|
36 | 36 | array( |
37 | 37 | 'param' => 'order', |
38 | 38 | 'default' => 'ASC', |
39 | 39 | ) |
40 | 40 | ); |
41 | - $start = self::get_param( |
|
41 | + $start = self::get_param( |
|
42 | 42 | array( |
43 | 43 | 'param' => 'start', |
44 | 44 | 'default' => ( $page - 1 ) * $per_page, |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $counts = FrmForm::get_count(); |
163 | 163 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
164 | 164 | |
165 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
165 | + if ( isset( $statuses[$form_type] ) ) { |
|
166 | 166 | $counts->$form_type = $this->total_items; |
167 | 167 | } |
168 | 168 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | if ( $counts->{$status} || 'draft' !== $status ) { |
185 | 185 | /* translators: %1$s: Status, %2$s: Number of items */ |
186 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
186 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | unset( $status, $name ); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | private function get_actions( &$actions, $item, $edit_link ) { |
349 | 349 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
350 | 350 | foreach ( $new_actions as $link => $action ) { |
351 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
351 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | if ( 'trash' == $this->status ) { |