@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $section['function'] = $original; |
159 | 159 | } |
160 | 160 | |
161 | - $sections[ $key ] = $section; |
|
161 | + $sections[$key] = $section; |
|
162 | 162 | }//end foreach |
163 | 163 | |
164 | 164 | return $sections; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | |
171 | 171 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
172 | 172 | $sections = self::get_settings_tabs(); |
173 | - if ( ! isset( $sections[ $section ] ) ) { |
|
173 | + if ( ! isset( $sections[$section] ) ) { |
|
174 | 174 | wp_die(); |
175 | 175 | } |
176 | 176 | |
177 | - $section = $sections[ $section ]; |
|
177 | + $section = $sections[$section]; |
|
178 | 178 | |
179 | 179 | if ( isset( $section['class'] ) ) { |
180 | 180 | call_user_func( array( $section['class'], $section['function'] ) ); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
166 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
167 | 167 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
168 | 168 | return; |
169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $value |
179 | 179 | */ |
180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
181 | - if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
|
182 | - return $form[ $value ]; |
|
181 | + if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) { |
|
182 | + return $form[$value]; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | return ''; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | if ( $for === 'view' ) { |
211 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
211 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
212 | 212 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
213 | 213 | } elseif ( $for === 'form' ) { |
214 | 214 | $item_key = $form_key; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | - $page_ids[ $for ] = wp_insert_post( |
|
226 | + $page_ids[$for] = wp_insert_post( |
|
227 | 227 | array( |
228 | 228 | 'post_title' => $name, |
229 | 229 | 'post_type' => 'page', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
378 | 378 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
379 | 379 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
380 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
380 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
381 | 381 | // allow other file types to be imported |
382 | 382 | do_action( 'frm_before_import_' . $file_type ); |
383 | 383 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | foreach ( $type as $tb_type ) { |
472 | 472 | $where = array(); |
473 | 473 | $join = ''; |
474 | - $table = $tables[ $tb_type ]; |
|
474 | + $table = $tables[$tb_type]; |
|
475 | 475 | |
476 | 476 | $select = $table . '.id'; |
477 | 477 | $query_vars = array(); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $table . '.parent_form_id' => $args['ids'], |
487 | 487 | ); |
488 | 488 | } else { |
489 | - $where[ $table . '.status !' ] = 'draft'; |
|
489 | + $where[$table . '.status !'] = 'draft'; |
|
490 | 490 | } |
491 | 491 | break; |
492 | 492 | case 'actions': |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | case 'items': |
500 | 500 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
501 | 501 | if ( $args['ids'] ) { |
502 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
502 | + $where[$table . '.form_id'] = $args['ids']; |
|
503 | 503 | } |
504 | 504 | break; |
505 | 505 | case 'styles': |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | } |
541 | 541 | }//end switch |
542 | 542 | |
543 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
543 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
544 | 544 | unset( $tb_type ); |
545 | 545 | }//end foreach |
546 | 546 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $no_export_fields = FrmField::no_save_fields(); |
713 | 713 | foreach ( $csv_fields as $k => $f ) { |
714 | 714 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
715 | - unset( $csv_fields[ $k ] ); |
|
715 | + unset( $csv_fields[$k] ); |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | ), |
553 | 553 | ); |
554 | 554 | |
555 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
555 | + if ( ! isset( $available_status[$status] ) ) { |
|
556 | 556 | return; |
557 | 557 | } |
558 | 558 | |
559 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
559 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
560 | 560 | |
561 | 561 | $params = FrmForm::list_page_params(); |
562 | 562 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | check_admin_referer( $status . '_form_' . $params['id'] ); |
565 | 565 | |
566 | 566 | $count = 0; |
567 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
567 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
568 | 568 | $count ++; |
569 | 569 | } |
570 | 570 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
582 | 582 | $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>' ); |
583 | 583 | |
584 | - $message = $available_status[ $status ]['message']; |
|
584 | + $message = $available_status[$status]['message']; |
|
585 | 585 | |
586 | 586 | self::display_forms_list( $params, $message ); |
587 | 587 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | 'type' => 'request', |
603 | 603 | ) |
604 | 604 | ); |
605 | - $message = sprintf( |
|
605 | + $message = sprintf( |
|
606 | 606 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
607 | 607 | _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' ), |
608 | 608 | $count, |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | |
1185 | 1185 | foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) { |
1186 | 1186 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
1187 | - unset( $sections[ $feature ] ); |
|
1187 | + unset( $sections[$feature] ); |
|
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | $section['id'] = $section['anchor']; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $sections[ $key ] = $section; |
|
1220 | + $sections[$key] = $section; |
|
1221 | 1221 | }//end foreach |
1222 | 1222 | |
1223 | 1223 | return $sections; |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | if ( ! empty( $user_fields ) ) { |
1336 | 1336 | $user_helpers = array(); |
1337 | 1337 | foreach ( $user_fields as $uk => $uf ) { |
1338 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
1338 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1339 | 1339 | unset( $uk, $uf ); |
1340 | 1340 | } |
1341 | 1341 | |
@@ -1474,7 +1474,7 @@ discard block |
||
1474 | 1474 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
1475 | 1475 | $frm_vars['js_validate_forms'] = array(); |
1476 | 1476 | } |
1477 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
1477 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | public static function get_email_html() { |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
1634 | 1634 | } else { |
1635 | 1635 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
1636 | - $action = $vars[ $action ]; |
|
1636 | + $action = $vars[$action]; |
|
1637 | 1637 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1638 | 1638 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1639 | 1639 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | $actions = array(); |
1802 | 1802 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
1803 | 1803 | if ( is_object( $form ) ) { |
1804 | - $actions[ $form->id ] = $form->name; |
|
1804 | + $actions[$form->id] = $form->name; |
|
1805 | 1805 | } |
1806 | 1806 | unset( $form ); |
1807 | 1807 | } |
@@ -2046,8 +2046,8 @@ discard block |
||
2046 | 2046 | private static function get_saved_errors( $form, $params ) { |
2047 | 2047 | global $frm_vars; |
2048 | 2048 | |
2049 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2050 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
2049 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2050 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
2051 | 2051 | } else { |
2052 | 2052 | $errors = array(); |
2053 | 2053 | } |
@@ -2069,7 +2069,7 @@ discard block |
||
2069 | 2069 | public static function just_created_entry( $form_id ) { |
2070 | 2070 | global $frm_vars; |
2071 | 2071 | |
2072 | - 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; |
|
2072 | + 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; |
|
2073 | 2073 | } |
2074 | 2074 | |
2075 | 2075 | /** |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | private static function get_confirmation_method( $atts ) { |
2090 | 2090 | $action = FrmOnSubmitHelper::current_event( $atts ); |
2091 | 2091 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
2092 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
2092 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
2093 | 2093 | |
2094 | 2094 | if ( ! empty( $atts['entry_id'] ) ) { |
2095 | 2095 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2110,7 +2110,7 @@ discard block |
||
2110 | 2110 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
2111 | 2111 | if ( ! isset( $params['id'] ) ) { |
2112 | 2112 | global $frm_vars; |
2113 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
2113 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | $conf_method = self::get_confirmation_method( |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | $args['success_opt'] = $opt; |
2193 | 2193 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
2194 | 2194 | |
2195 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
2195 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
2196 | 2196 | self::load_page_after_submit( $args ); |
2197 | 2197 | } elseif ( $args['conf_method'] === 'redirect' ) { |
2198 | 2198 | self::redirect_after_submit( $args ); |
@@ -2216,7 +2216,7 @@ discard block |
||
2216 | 2216 | } |
2217 | 2217 | |
2218 | 2218 | // If a redirect action has already opened the URL in a new tab, we show the default message in the currect tab. |
2219 | - if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) { |
|
2219 | + if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) { |
|
2220 | 2220 | return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) ); |
2221 | 2221 | } |
2222 | 2222 | |
@@ -2404,7 +2404,7 @@ discard block |
||
2404 | 2404 | |
2405 | 2405 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
2406 | 2406 | |
2407 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
2407 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
2408 | 2408 | |
2409 | 2409 | /** |
2410 | 2410 | * Filters the run success action args. |
@@ -2424,8 +2424,8 @@ discard block |
||
2424 | 2424 | private static function load_page_after_submit( $args ) { |
2425 | 2425 | global $post; |
2426 | 2426 | $opt = $args['success_opt']; |
2427 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
2428 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
2427 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
2428 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
2429 | 2429 | $old_post = $post; |
2430 | 2430 | $post = $page; |
2431 | 2431 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2455,7 +2455,7 @@ discard block |
||
2455 | 2455 | add_filter( 'frm_use_wpautop', '__return_false' ); |
2456 | 2456 | |
2457 | 2457 | $opt = $args['success_opt']; |
2458 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
2458 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
2459 | 2459 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
2460 | 2460 | $success_url = do_shortcode( $success_url ); |
2461 | 2461 | |
@@ -2477,7 +2477,7 @@ discard block |
||
2477 | 2477 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
2478 | 2478 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
2479 | 2479 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
2480 | - self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
|
2480 | + self::$redirected_in_new_tab[$args['form']->id] = 1; |
|
2481 | 2481 | return; |
2482 | 2482 | } |
2483 | 2483 | |
@@ -2739,7 +2739,7 @@ discard block |
||
2739 | 2739 | 'description' => false, |
2740 | 2740 | 'reset' => false, |
2741 | 2741 | ); |
2742 | - $args = wp_parse_args( $args, $defaults ); |
|
2742 | + $args = wp_parse_args( $args, $defaults ); |
|
2743 | 2743 | } |
2744 | 2744 | |
2745 | 2745 | /** |
@@ -2777,7 +2777,7 @@ discard block |
||
2777 | 2777 | $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; |
2778 | 2778 | |
2779 | 2779 | if ( $entry_id && is_numeric( $entry_id ) ) { |
2780 | - $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; |
|
2780 | + $message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg; |
|
2781 | 2781 | $class = 'frm_message'; |
2782 | 2782 | } else { |
2783 | 2783 | $message = $frm_settings->failed_msg; |
@@ -3000,7 +3000,7 @@ discard block |
||
3000 | 3000 | |
3001 | 3001 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
3002 | 3002 | |
3003 | - $html = FrmAppHelper::clip( |
|
3003 | + $html = FrmAppHelper::clip( |
|
3004 | 3004 | function() { |
3005 | 3005 | FrmAppHelper::maybe_autocomplete_pages_options( |
3006 | 3006 | array( |
@@ -1616,7 +1616,8 @@ discard block |
||
1616 | 1616 | $vars = array(); |
1617 | 1617 | FrmAppHelper::include_svg(); |
1618 | 1618 | |
1619 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1619 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
1620 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1620 | 1621 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
1621 | 1622 | |
1622 | 1623 | // Javascript needs to be allowed in some field settings. |
@@ -2046,7 +2047,8 @@ discard block |
||
2046 | 2047 | private static function get_saved_errors( $form, $params ) { |
2047 | 2048 | global $frm_vars; |
2048 | 2049 | |
2049 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2050 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
2051 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2050 | 2052 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
2051 | 2053 | } else { |
2052 | 2054 | $errors = array(); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | unset( $filename ); |
131 | 131 | |
132 | - $comment_count = FrmDb::get_count( |
|
132 | + $comment_count = FrmDb::get_count( |
|
133 | 133 | 'frm_item_metas', |
134 | 134 | array( |
135 | 135 | 'item_id' => $atts['entry_ids'], |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private static function prepare_csv_headings() { |
225 | 225 | $headings = array(); |
226 | 226 | self::csv_headings( $headings ); |
227 | - $headings = apply_filters( |
|
227 | + $headings = apply_filters( |
|
228 | 228 | 'frm_csv_columns', |
229 | 229 | $headings, |
230 | 230 | self::$form_id, |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | $field_headings = array(); |
249 | 249 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
250 | 250 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
251 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
251 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
252 | 252 | } |
253 | 253 | |
254 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
254 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
255 | 255 | $field_headings = apply_filters( |
256 | 256 | 'frm_csv_field_columns', |
257 | 257 | $field_headings, |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
273 | 273 | $repeater_id = $col->field_options['in_section']; |
274 | 274 | // Set a placeholder to maintain order for repeater fields. |
275 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
275 | + $headings['repeater' . $repeater_id] = array(); |
|
276 | 276 | |
277 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
278 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
277 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
278 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
279 | 279 | $repeater_ids[] = $repeater_id; |
280 | 280 | } |
281 | 281 | |
282 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
282 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
283 | 283 | |
284 | 284 | continue; |
285 | 285 | } |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | $end = strpos( $row->meta_value, ':{' ); |
299 | 299 | $length = substr( $row->meta_value, $start, $end - $start ); |
300 | 300 | |
301 | - if ( $length > $max[ $row->field_id ] ) { |
|
302 | - $max[ $row->field_id ] = $length; |
|
301 | + if ( $length > $max[$row->field_id] ) { |
|
302 | + $max[$row->field_id] = $length; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -310,17 +310,17 @@ discard block |
||
310 | 310 | $repeater_id = str_replace( 'repeater', '', $key ); |
311 | 311 | |
312 | 312 | $repeater_headings = array(); |
313 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
313 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
314 | 314 | $repeater_headings += self::field_headings( $col ); |
315 | 315 | } |
316 | 316 | |
317 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
317 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
318 | 318 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
319 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
319 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } else { |
323 | - $flat[ $key ] = $heading; |
|
323 | + $flat[$key] = $heading; |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | |
335 | 335 | if ( self::$comment_count ) { |
336 | 336 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
337 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
338 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
339 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
337 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
338 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
339 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
340 | 340 | } |
341 | 341 | unset( $i ); |
342 | 342 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | |
382 | 382 | private static function prepare_next_csv_rows( $next_set ) { |
383 | 383 | // order by parent_item_id so children will be first |
384 | - $where = array( |
|
384 | + $where = array( |
|
385 | 385 | 'or' => 1, |
386 | 386 | 'id' => $next_set, |
387 | 387 | 'parent_item_id' => $next_set, |
@@ -427,32 +427,32 @@ discard block |
||
427 | 427 | continue; |
428 | 428 | } |
429 | 429 | |
430 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
431 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
432 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
430 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
431 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
432 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
433 | 433 | } |
434 | 434 | |
435 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
436 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
437 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
435 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
436 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
437 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
438 | 438 | // if the data is here, it should be an array but if this field has collected data |
439 | 439 | // both while inside and outside of the repeating section, it's possible this is a string. |
440 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
440 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | // Add the repeated values. |
444 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
444 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
445 | 445 | }//end foreach |
446 | 446 | |
447 | 447 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
448 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
448 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
449 | 449 | }//end if |
450 | 450 | |
451 | 451 | // add the embedded form id |
452 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
453 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
452 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
453 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
454 | 454 | } |
455 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
455 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -473,19 +473,19 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | $repeater_id = $field->field_options['in_section']; |
476 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
476 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
477 | 477 | return $metas; |
478 | 478 | } |
479 | 479 | |
480 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
481 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
482 | - $metas[ $repeater_child->id ] = ''; |
|
480 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
481 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
482 | + $metas[$repeater_child->id] = ''; |
|
483 | 483 | |
484 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
485 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
484 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
485 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
486 | 486 | } |
487 | 487 | |
488 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
488 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | private static function add_field_values_to_csv( &$row ) { |
506 | 506 | foreach ( self::$fields as $col ) { |
507 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
507 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
508 | 508 | |
509 | 509 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
510 | 510 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -523,20 +523,20 @@ discard block |
||
523 | 523 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
524 | 524 | $label_key = $col->id . '_label'; |
525 | 525 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
526 | - $row[ $label_key ] = array(); |
|
526 | + $row[$label_key] = array(); |
|
527 | 527 | |
528 | 528 | if ( is_array( $field_value ) ) { |
529 | 529 | foreach ( $field_value as $value ) { |
530 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
530 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
531 | 531 | } |
532 | 532 | } |
533 | 533 | } else { |
534 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
534 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
535 | 535 | } |
536 | 536 | unset( $label_key ); |
537 | 537 | } |
538 | 538 | |
539 | - $row[ $col->id ] = $field_value; |
|
539 | + $row[$col->id] = $field_value; |
|
540 | 540 | |
541 | 541 | unset( $col, $field_value ); |
542 | 542 | }//end foreach |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | 'show_icon' => false, |
560 | 560 | 'entry_id' => self::$entry->id, |
561 | 561 | 'sep' => self::$separator, |
562 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
562 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
563 | 563 | ) |
564 | 564 | ); |
565 | 565 | } |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
575 | 575 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
576 | 576 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
577 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
578 | - $row[ $column_key ] = $sub_sub_value; |
|
577 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
578 | + $row[$column_key] = $sub_sub_value; |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | $column_key = $atts['col']->id . '_' . $key; |
586 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
587 | - $row[ $column_key ] = $sub_value; |
|
586 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
587 | + $row[$column_key] = $sub_value; |
|
588 | 588 | } |
589 | 589 | } |
590 | 590 | } |
@@ -609,18 +609,18 @@ discard block |
||
609 | 609 | $echo = 'echo' === self::$mode; |
610 | 610 | |
611 | 611 | foreach ( self::$headings as $k => $heading ) { |
612 | - if ( isset( $rows[ $k ] ) ) { |
|
613 | - $row = $rows[ $k ]; |
|
612 | + if ( isset( $rows[$k] ) ) { |
|
613 | + $row = $rows[$k]; |
|
614 | 614 | } else { |
615 | 615 | $row = ''; |
616 | 616 | // array indexed data is not at $rows[ $k ] |
617 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
617 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
618 | 618 | $start = strrpos( $k, '[' ); |
619 | 619 | $key = substr( $k, 0, $start ++ ); |
620 | 620 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
621 | 621 | |
622 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
623 | - $row = $rows[ $key ][ $index ]; |
|
622 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
623 | + $row = $rows[$key][$index]; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | unset( $start, $key, $index ); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
32 | 32 | $values['field_options']['data_type'] = $setting; |
33 | 33 | } else { |
34 | - $values['field_options'][ $setting ] = 1; |
|
34 | + $values['field_options'][$setting] = 1; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | foreach ( $defaults as $opt => $default ) { |
141 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
141 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
142 | 142 | |
143 | 143 | if ( $check_post ) { |
144 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
144 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | unset( $opt, $default ); |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | * @param mixed $value |
186 | 186 | */ |
187 | 187 | private static function get_posted_field_setting( $setting, &$value ) { |
188 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
188 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | if ( strpos( $setting, 'html' ) !== false ) { |
193 | 193 | // Strip slashes from HTML but not regex or script tags. |
194 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
194 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
195 | 195 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
196 | 196 | // TODO: Remove stripslashes on output, and use on input only. |
197 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
197 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
198 | 198 | } else { |
199 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
199 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
200 | 200 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
201 | 201 | } |
202 | 202 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
270 | 270 | |
271 | 271 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
272 | - $values[ $col ] = $field->{$col}; |
|
272 | + $values[$col] = $field->{$col}; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | ); |
310 | 310 | |
311 | 311 | $msg = FrmField::get_option( $field, $error ); |
312 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
312 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
313 | 313 | $msg = do_shortcode( $msg ); |
314 | 314 | |
315 | 315 | return $msg; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | $base_name = 'default_value_' . $field['id']; |
422 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
422 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
423 | 423 | |
424 | 424 | $default_type = self::get_default_value_type( $field ); |
425 | 425 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | continue; |
750 | 750 | } |
751 | 751 | |
752 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
752 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
753 | 753 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
754 | 754 | |
755 | 755 | $atts['entry'] = $entry; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | if ( $replace_with !== null ) { |
760 | 760 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
761 | 761 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
762 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
762 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | unset( $atts, $replace_with ); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
778 | 778 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
779 | 779 | foreach ( $included_atts as $included_att ) { |
780 | - if ( '0' === $atts[ $included_att ] ) { |
|
780 | + if ( '0' === $atts[$included_att] ) { |
|
781 | 781 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
782 | 782 | continue; |
783 | 783 | } |
@@ -850,8 +850,8 @@ discard block |
||
850 | 850 | |
851 | 851 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
852 | 852 | |
853 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
854 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
853 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
854 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
855 | 855 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
856 | 856 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
857 | 857 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1062,8 +1062,8 @@ discard block |
||
1062 | 1062 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
1063 | 1063 | } elseif ( in_array( $type, $multiple_input ) ) { |
1064 | 1064 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
1065 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
1066 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
1065 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
1066 | + $field_types[$type] = $field_selection[$type]; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | |
1097 | 1097 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1098 | 1098 | foreach ( $inputs as $input ) { |
1099 | - $field_types[ $input ] = $fields[ $input ]; |
|
1099 | + $field_types[$input] = $fields[$input]; |
|
1100 | 1100 | unset( $input ); |
1101 | 1101 | } |
1102 | 1102 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'parent' => false, |
1129 | 1129 | 'pointer' => false, |
1130 | 1130 | ); |
1131 | - $args = wp_parse_args( $args, $defaults ); |
|
1131 | + $args = wp_parse_args( $args, $defaults ); |
|
1132 | 1132 | |
1133 | 1133 | $opt_key = $args['opt_key']; |
1134 | 1134 | $field = $args['field']; |
@@ -1144,24 +1144,24 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | // Check posted vals before checking saved values |
1146 | 1146 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1147 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1147 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1148 | 1148 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1149 | 1149 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1150 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1150 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
1151 | 1151 | } else { |
1152 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1152 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | return $other_val; |
1156 | 1156 | |
1157 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1157 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1158 | 1158 | // For normal fields |
1159 | 1159 | |
1160 | 1160 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1161 | 1161 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1162 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1162 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1163 | 1163 | } else { |
1164 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1164 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | return $other_val; |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
1172 | 1172 | // Check if there is an "other" val in saved value and make sure the |
1173 | 1173 | // "other" val is not equal to the Other checkbox option |
1174 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1175 | - $other_val = $field['value'][ $opt_key ]; |
|
1174 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1175 | + $other_val = $field['value'][$opt_key]; |
|
1176 | 1176 | } |
1177 | 1177 | } else { |
1178 | 1178 | /** |
@@ -1184,8 +1184,8 @@ discard block |
||
1184 | 1184 | // Multi-select dropdowns - key is not preserved |
1185 | 1185 | if ( is_array( $field['value'] ) ) { |
1186 | 1186 | $o_key = array_search( $temp_val, $field['value'] ); |
1187 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1188 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1187 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1188 | + unset( $field['value'][$o_key], $o_key ); |
|
1189 | 1189 | } |
1190 | 1190 | } elseif ( $temp_val == $field['value'] ) { |
1191 | 1191 | // For radio and regular dropdowns |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | return $other_args; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $other_opt = true; |
|
1230 | + $other_opt = true; |
|
1231 | 1231 | |
1232 | 1232 | self::set_other_name( $args, $other_args ); |
1233 | 1233 | self::set_other_value( $args, $other_args ); |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | if ( is_array( $val ) ) { |
1396 | 1396 | foreach ( $val as $k => $v ) { |
1397 | 1397 | if ( is_string( $v ) ) { |
1398 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1398 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1399 | 1399 | unset( $k, $v ); |
1400 | 1400 | } |
1401 | 1401 | } |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | $countries['class'] = 'frm-countries-opts'; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
1751 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
1752 | 1752 | |
1753 | 1753 | // State abv. |
1754 | 1754 | $states = self::get_us_states(); |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | $state_abv['class'] = 'frm-state-abv-opts'; |
1759 | 1759 | } |
1760 | 1760 | |
1761 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1761 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1762 | 1762 | |
1763 | 1763 | // States. |
1764 | 1764 | $states = array_values( $states ); |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | $states['class'] = 'frm-states-opts'; |
1768 | 1768 | } |
1769 | 1769 | |
1770 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1770 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1771 | 1771 | unset( $state_abv, $states ); |
1772 | 1772 | |
1773 | 1773 | // Age. |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | $ages['class'] = 'frm-age-opts'; |
1786 | 1786 | } |
1787 | 1787 | |
1788 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
1788 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
1789 | 1789 | |
1790 | 1790 | // Satisfaction. |
1791 | 1791 | $satisfaction = array( |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
1801 | 1801 | } |
1802 | 1802 | |
1803 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
1803 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
1804 | 1804 | |
1805 | 1805 | // Importance. |
1806 | 1806 | $importance = array( |
@@ -1815,7 +1815,7 @@ discard block |
||
1815 | 1815 | $importance['class'] = 'frm-importance-opts'; |
1816 | 1816 | } |
1817 | 1817 | |
1818 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
1818 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
1819 | 1819 | |
1820 | 1820 | // Agreement. |
1821 | 1821 | $agreement = array( |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $agreement['class'] = 'frm-agreement-opts'; |
1831 | 1831 | } |
1832 | 1832 | |
1833 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
1833 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
1834 | 1834 | |
1835 | 1835 | // Likely. |
1836 | 1836 | $likely = array( |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | $likely['class'] = 'frm-likely-opts'; |
1846 | 1846 | } |
1847 | 1847 | |
1848 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
1848 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
1849 | 1849 | |
1850 | 1850 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1851 | 1851 | } |
@@ -2052,16 +2052,16 @@ discard block |
||
2052 | 2052 | */ |
2053 | 2053 | private static function fill_image_setting_options( $options, &$args ) { |
2054 | 2054 | foreach ( $options as $key => $option ) { |
2055 | - $args['options'][ $key ] = $option; |
|
2055 | + $args['options'][$key] = $option; |
|
2056 | 2056 | |
2057 | 2057 | if ( ! empty( $option['addon'] ) ) { |
2058 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2058 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2059 | 2059 | } |
2060 | 2060 | |
2061 | - unset( $args['options'][ $key ]['addon'] ); |
|
2061 | + unset( $args['options'][$key]['addon'] ); |
|
2062 | 2062 | $fill = array( 'upgrade', 'message', 'content' ); |
2063 | 2063 | foreach ( $fill as $f ) { |
2064 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
2064 | + unset( $args['options'][$key][$f], $f ); |
|
2065 | 2065 | } |
2066 | 2066 | } |
2067 | 2067 | } |
@@ -2082,8 +2082,8 @@ discard block |
||
2082 | 2082 | |
2083 | 2083 | $fill = array( 'upgrade', 'message', 'content' ); |
2084 | 2084 | foreach ( $fill as $f ) { |
2085 | - if ( isset( $option[ $f ] ) ) { |
|
2086 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
2085 | + if ( isset( $option[$f] ) ) { |
|
2086 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
2087 | 2087 | } |
2088 | 2088 | } |
2089 | 2089 |
@@ -185,7 +185,8 @@ discard block |
||
185 | 185 | * @param mixed $value |
186 | 186 | */ |
187 | 187 | private static function get_posted_field_setting( $setting, &$value ) { |
188 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
188 | + if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
189 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
189 | 190 | return; |
190 | 191 | } |
191 | 192 | |
@@ -1144,7 +1145,8 @@ discard block |
||
1144 | 1145 | |
1145 | 1146 | // Check posted vals before checking saved values |
1146 | 1147 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1147 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1148 | + if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
1149 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1148 | 1150 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1149 | 1151 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1150 | 1152 | $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
@@ -1154,7 +1156,8 @@ discard block |
||
1154 | 1156 | |
1155 | 1157 | return $other_val; |
1156 | 1158 | |
1157 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1159 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
1160 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1158 | 1161 | // For normal fields |
1159 | 1162 | |
1160 | 1163 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
138 | 138 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
139 | 139 | if ( $repeating ) { |
140 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
140 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
141 | 141 | $value_is_posted = true; |
142 | 142 | } |
143 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
143 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
144 | 144 | $value_is_posted = true; |
145 | 145 | } |
146 | 146 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
173 | 173 | |
174 | 174 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
175 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
175 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
176 | 176 | if ( ! empty( $add_atts ) ) { |
177 | 177 | $this_atts = array_merge( $atts, $add_atts ); |
178 | 178 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
183 | 183 | |
184 | 184 | // Add the default message. |
185 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
185 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $message; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return string |
196 | 196 | */ |
197 | 197 | public static function prepare_display_value( $entry, $field, $atts ) { |
198 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
198 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
199 | 199 | |
200 | 200 | if ( FrmAppHelper::pro_is_installed() ) { |
201 | 201 | $empty = empty( $field_value ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
221 | 221 | } else { |
222 | 222 | // Get all values for this field. |
223 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
223 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
224 | 224 | |
225 | 225 | if ( $child_values ) { |
226 | 226 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $value = $args['temp_value']; |
339 | 339 | } |
340 | 340 | if ( empty( $args['parent_field_id'] ) ) { |
341 | - $_POST['item_meta'][ $field->id ] = $value; |
|
341 | + $_POST['item_meta'][$field->id] = $value; |
|
342 | 342 | } else { |
343 | 343 | self::set_parent_field_posted_value( $field, $value, $args ); |
344 | 344 | } |
@@ -350,17 +350,17 @@ discard block |
||
350 | 350 | * @since 4.01 |
351 | 351 | */ |
352 | 352 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
353 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
354 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
355 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
353 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
354 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
355 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
356 | 356 | } |
357 | 357 | } else { |
358 | 358 | // All of the section was probably removed. |
359 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
360 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
359 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
360 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
361 | 361 | } |
362 | 362 | |
363 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
363 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | private static function get_posted_meta( $field_id, $args ) { |
391 | 391 | if ( empty( $args['parent_field_id'] ) ) { |
392 | 392 | // Sanitizing is done next. |
393 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
393 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
394 | 394 | } else { |
395 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
395 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
396 | 396 | } |
397 | 397 | return $value; |
398 | 398 | } |
@@ -423,14 +423,14 @@ discard block |
||
423 | 423 | self::set_other_repeating_vals( $field, $value, $args ); |
424 | 424 | |
425 | 425 | // Check if there are any posted "Other" values. |
426 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
426 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
427 | 427 | |
428 | 428 | // Save original value. |
429 | 429 | $args['temp_value'] = $value; |
430 | 430 | $args['other'] = true; |
431 | 431 | |
432 | 432 | // Sanitizing is done next. |
433 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
433 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
434 | 434 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
435 | 435 | |
436 | 436 | // Set the validation value now |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | // Check if there are any other posted "other" values for this field. |
456 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
456 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
457 | 457 | // Save original value |
458 | 458 | $args['temp_value'] = $value; |
459 | 459 | $args['other'] = true; |
460 | 460 | |
461 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
461 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
462 | 462 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
463 | 463 | |
464 | 464 | // Set the validation value now. |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
486 | 486 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
487 | 487 | foreach ( $other_vals as $k => $v ) { |
488 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
488 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
489 | 489 | // If the other box is checked, but doesn't have a value. |
490 | 490 | $value = ''; |
491 | 491 | break; |
@@ -502,25 +502,25 @@ discard block |
||
502 | 502 | |
503 | 503 | // Multi-select dropdown. |
504 | 504 | if ( is_array( $value ) ) { |
505 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
505 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
506 | 506 | |
507 | 507 | if ( $o_key !== false ) { |
508 | 508 | // Modify the original value so other key will be preserved. |
509 | - $value[ $other_key ] = $value[ $o_key ]; |
|
509 | + $value[$other_key] = $value[$o_key]; |
|
510 | 510 | |
511 | 511 | // By default, the array keys will be numeric for multi-select dropdowns. |
512 | 512 | // If going backwards and forwards between pages, the array key will match the other key. |
513 | 513 | if ( $o_key !== $other_key ) { |
514 | - unset( $value[ $o_key ] ); |
|
514 | + unset( $value[$o_key] ); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $args['temp_value'] = $value; |
518 | - $value[ $other_key ] = reset( $other_vals ); |
|
519 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
520 | - unset( $value[ $other_key ] ); |
|
518 | + $value[$other_key] = reset( $other_vals ); |
|
519 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
520 | + unset( $value[$other_key] ); |
|
521 | 521 | } |
522 | 522 | } |
523 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
523 | + } elseif ( $field->options[$other_key] == $value ) { |
|
524 | 524 | $value = $other_vals; |
525 | 525 | }//end if |
526 | 526 | }//end if |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | * @return void |
767 | 767 | */ |
768 | 768 | public static function maybe_render_captcha_score( $entry_id ) { |
769 | - $query = array( |
|
769 | + $query = array( |
|
770 | 770 | 'item_id' => (int) $entry_id, |
771 | 771 | 'field_id' => 0, |
772 | 772 | ); |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | public static function get_entry_status_label( $status ) { |
821 | 821 | $statuses = self::get_entry_statuses(); |
822 | 822 | |
823 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
823 | + return $statuses[self::get_entry_status( $status )]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | if ( $term && is_array( $term ) ) { |
179 | 179 | $imported['imported']['terms'] ++; |
180 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
180 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | unset( $term, $t ); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | // Keep track of whether this specific form was updated or not. |
236 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
236 | + $imported['form_status'][$form_id] = 'imported'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // Update field ids/keys to new ones. |
249 | 249 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
250 | 250 | |
251 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
251 | + $imported['forms'][(int) $item->id] = $form_id; |
|
252 | 252 | |
253 | 253 | // Send pre 2.0 form options through function that creates actions. |
254 | 254 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // Keep track of whether this specific form was updated or not |
325 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
325 | + $imported['form_status'][$form_id] = 'updated'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | private static function get_form_fields( $form_id ) { |
329 | 329 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
330 | 330 | $old_fields = array(); |
331 | 331 | foreach ( $form_fields as $f ) { |
332 | - $old_fields[ $f->id ] = $f; |
|
333 | - $old_fields[ $f->field_key ] = $f->id; |
|
332 | + $old_fields[$f->id] = $f; |
|
333 | + $old_fields[$f->field_key] = $f->id; |
|
334 | 334 | unset( $f ); |
335 | 335 | } |
336 | 336 | $form_fields = $old_fields; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
389 | 389 | if ( $parent_form_id ) { |
390 | - $child_forms[ $form_id ] = $parent_form_id; |
|
390 | + $child_forms[$form_id] = $parent_form_id; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | */ |
403 | 403 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
404 | 404 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
405 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
405 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
406 | 406 | // Update all children with this old parent_form_id |
407 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
407 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
408 | 408 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
409 | 409 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
410 | 410 | } |
@@ -434,30 +434,30 @@ discard block |
||
434 | 434 | |
435 | 435 | if ( ! empty( $this_form ) ) { |
436 | 436 | // check for field to edit by field id |
437 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
437 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
438 | 438 | FrmField::update( $f['id'], $f ); |
439 | 439 | $imported['updated']['fields'] ++; |
440 | 440 | |
441 | - unset( $form_fields[ $f['id'] ] ); |
|
441 | + unset( $form_fields[$f['id']] ); |
|
442 | 442 | |
443 | 443 | // Unset old field key. |
444 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
445 | - unset( $form_fields[ $f['field_key'] ] ); |
|
444 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
445 | + unset( $form_fields[$f['field_key']] ); |
|
446 | 446 | } |
447 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
448 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
447 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
448 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
449 | 449 | |
450 | 450 | // check for field to edit by field key |
451 | 451 | unset( $f['id'] ); |
452 | 452 | |
453 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
453 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
454 | 454 | $imported['updated']['fields'] ++; |
455 | 455 | |
456 | 456 | // Unset old field id. |
457 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
457 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
458 | 458 | |
459 | 459 | // Unset old field key. |
460 | - unset( $form_fields[ $f['field_key'] ] ); |
|
460 | + unset( $form_fields[$f['field_key']] ); |
|
461 | 461 | } else { |
462 | 462 | // If no matching field id or key in this form, create the field. |
463 | 463 | self::create_imported_field( $f, $imported ); |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
567 | 567 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
568 | 568 | $form_select = (int) $f['field_options']['form_select']; |
569 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
570 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
569 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
570 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | } |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | |
589 | 589 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
590 | 590 | $old_form = $f['field_options']['get_values_form']; |
591 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
592 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
591 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
592 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 | } |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | private static function migrate_placeholders( &$f ) { |
611 | 611 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
612 | 612 | foreach ( $update_values as $k => $v ) { |
613 | - $f[ $k ] = $v; |
|
613 | + $f[$k] = $v; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
617 | 617 | foreach ( $update_values as $k => $v ) { |
618 | - $f[ $k ] = $v; |
|
618 | + $f[$k] = $v; |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | public static function migrate_field_placeholder( $field, $type ) { |
630 | 630 | $field = (array) $field; |
631 | 631 | $field_options = $field['field_options']; |
632 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
632 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
633 | 633 | return array(); |
634 | 634 | } |
635 | 635 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | if ( $opt == $default_value ) { |
658 | - unset( $options[ $opt_key ] ); |
|
658 | + unset( $options[$opt_key] ); |
|
659 | 659 | break; |
660 | 660 | } |
661 | 661 | } |
@@ -712,10 +712,10 @@ discard block |
||
712 | 712 | |
713 | 713 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
714 | 714 | // Remove the src from options as it isn't required after import. |
715 | - unset( $field['options'][ $key ]['src'] ); |
|
715 | + unset( $field['options'][$key]['src'] ); |
|
716 | 716 | |
717 | 717 | if ( is_numeric( $image_id ) ) { |
718 | - $field['options'][ $key ]['image'] = $image_id; |
|
718 | + $field['options'][$key]['image'] = $image_id; |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 | |
@@ -883,8 +883,8 @@ discard block |
||
883 | 883 | } else { |
884 | 884 | if ( $post['post_type'] === 'frm_display' ) { |
885 | 885 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
886 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
887 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
886 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
887 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
888 | 888 | } |
889 | 889 | // Create/update post now |
890 | 890 | $post_id = wp_insert_post( $post ); |
@@ -895,27 +895,27 @@ discard block |
||
895 | 895 | } |
896 | 896 | |
897 | 897 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
898 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
898 | + $posts_with_shortcodes[$post_id] = $post; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | self::update_postmeta( $post, $post_id ); |
902 | 902 | self::update_layout( $post, $post_id ); |
903 | 903 | |
904 | 904 | $this_type = 'posts'; |
905 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
906 | - $this_type = $post_types[ $post['post_type'] ]; |
|
905 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
906 | + $this_type = $post_types[$post['post_type']]; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
910 | - $imported['updated'][ $this_type ] ++; |
|
910 | + $imported['updated'][$this_type] ++; |
|
911 | 911 | } else { |
912 | - $imported['imported'][ $this_type ] ++; |
|
912 | + $imported['imported'][$this_type] ++; |
|
913 | 913 | } |
914 | 914 | |
915 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
915 | + $imported['posts'][(int) $old_id] = $post_id; |
|
916 | 916 | |
917 | 917 | if ( $post['post_type'] === 'frm_display' ) { |
918 | - $view_ids[ (int) $old_id ] = $post_id; |
|
918 | + $view_ids[(int) $old_id] = $post_id; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1076,9 +1076,9 @@ discard block |
||
1076 | 1076 | $post['attachment_url'] = (string) $item->attachment_url; |
1077 | 1077 | } |
1078 | 1078 | |
1079 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
1079 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
1080 | 1080 | // update to new form id |
1081 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
1081 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | // Don't allow default styles to take over a site's default style |
@@ -1115,8 +1115,8 @@ discard block |
||
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | // Switch old form and field ids to new ones. |
1118 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
1119 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
1118 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
1119 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
1120 | 1120 | } else { |
1121 | 1121 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1122 | 1122 | |
@@ -1127,15 +1127,15 @@ discard block |
||
1127 | 1127 | } elseif ( 'frm_options' === $m['key'] ) { |
1128 | 1128 | |
1129 | 1129 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
1130 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
1131 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
1130 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
1131 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | $check_dup_array = array(); |
1136 | 1136 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
1137 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
1138 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
1137 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
1138 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
1139 | 1139 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
1140 | 1140 | $check_dup_array[] = 'order_by'; |
1141 | 1141 | } |
@@ -1146,9 +1146,9 @@ discard block |
||
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | foreach ( $check_dup_array as $check_k ) { |
1149 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
1150 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
1151 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
1149 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
1150 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
1151 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
1152 | 1152 | } |
1153 | 1153 | unset( $mk, $mv ); |
1154 | 1154 | } |
@@ -1161,11 +1161,11 @@ discard block |
||
1161 | 1161 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
1164 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | private static function populate_layout( &$post, $layout ) { |
1168 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
1168 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -1193,11 +1193,11 @@ discard block |
||
1193 | 1193 | $name = (string) $c; |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
1197 | - $post['tax_input'][ $taxonomy ] = array(); |
|
1196 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
1197 | + $post['tax_input'][$taxonomy] = array(); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
1200 | + $post['tax_input'][$taxonomy][] = $name; |
|
1201 | 1201 | unset( $name ); |
1202 | 1202 | }//end foreach |
1203 | 1203 | } |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | $message = '<ul>'; |
1338 | 1338 | foreach ( $result as $type => $results ) { |
1339 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1339 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1340 | 1340 | // only print imported and updated |
1341 | 1341 | continue; |
1342 | 1342 | } |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | if ( ! empty( $s_message ) ) { |
1351 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1351 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1352 | 1352 | $message .= implode( ', ', $s_message ); |
1353 | 1353 | $message .= '</li>'; |
1354 | 1354 | } |
@@ -1400,8 +1400,8 @@ discard block |
||
1400 | 1400 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1401 | 1401 | ); |
1402 | 1402 | |
1403 | - if ( isset( $strings[ $type ] ) ) { |
|
1404 | - $s_message[] = $strings[ $type ]; |
|
1403 | + if ( isset( $strings[$type] ) ) { |
|
1404 | + $s_message[] = $strings[$type]; |
|
1405 | 1405 | } else { |
1406 | 1406 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1407 | 1407 | |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | |
1550 | 1550 | foreach ( $options as $key => $option ) { |
1551 | 1551 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
1552 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1552 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1553 | 1553 | $updated = true; |
1554 | 1554 | } |
1555 | 1555 | } |
@@ -1578,8 +1578,8 @@ discard block |
||
1578 | 1578 | */ |
1579 | 1579 | private static function remove_defaults( $defaults, &$saved ) { |
1580 | 1580 | foreach ( $saved as $key => $value ) { |
1581 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1582 | - unset( $saved[ $key ] ); |
|
1581 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1582 | + unset( $saved[$key] ); |
|
1583 | 1583 | } |
1584 | 1584 | } |
1585 | 1585 | } |
@@ -1590,14 +1590,14 @@ discard block |
||
1590 | 1590 | * @since 3.06 |
1591 | 1591 | */ |
1592 | 1592 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1593 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1593 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1594 | 1594 | return; |
1595 | 1595 | } |
1596 | 1596 | |
1597 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1598 | - $default_html = $defaults[ $html_name ]; |
|
1597 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1598 | + $default_html = $defaults[$html_name]; |
|
1599 | 1599 | if ( $old_html == $default_html ) { |
1600 | - unset( $options[ $html_name ] ); |
|
1600 | + unset( $options[$html_name] ); |
|
1601 | 1601 | |
1602 | 1602 | return; |
1603 | 1603 | } |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | // Account for some of the older field default HTML. |
1606 | 1606 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1607 | 1607 | if ( $old_html == $default_html ) { |
1608 | - unset( $options[ $html_name ] ); |
|
1608 | + unset( $options[$html_name] ); |
|
1609 | 1609 | } |
1610 | 1610 | } |
1611 | 1611 | |
@@ -1696,8 +1696,8 @@ discard block |
||
1696 | 1696 | ); |
1697 | 1697 | |
1698 | 1698 | foreach ( $post_settings as $post_setting ) { |
1699 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1700 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1699 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1700 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1701 | 1701 | } |
1702 | 1702 | unset( $post_setting ); |
1703 | 1703 | } |
@@ -1768,11 +1768,11 @@ discard block |
||
1768 | 1768 | foreach ( $post_content as $key => $setting ) { |
1769 | 1769 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1770 | 1770 | // Replace old IDs with new IDs |
1771 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1771 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1772 | 1772 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1773 | 1773 | foreach ( $setting as $k => $val ) { |
1774 | 1774 | // Replace old IDs with new IDs |
1775 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1775 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1776 | 1776 | } |
1777 | 1777 | } |
1778 | 1778 | unset( $key, $setting ); |
@@ -1848,8 +1848,8 @@ discard block |
||
1848 | 1848 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1849 | 1849 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1850 | 1850 | foreach ( $delete_settings as $index ) { |
1851 | - if ( isset( $form_options[ $index ] ) ) { |
|
1852 | - unset( $form_options[ $index ] ); |
|
1851 | + if ( isset( $form_options[$index] ) ) { |
|
1852 | + unset( $form_options[$index] ); |
|
1853 | 1853 | } |
1854 | 1854 | } |
1855 | 1855 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1902,12 +1902,12 @@ discard block |
||
1902 | 1902 | 'reply_to_name' => '', |
1903 | 1903 | ); |
1904 | 1904 | foreach ( $reply_fields as $f => $val ) { |
1905 | - if ( isset( $notification[ $f ] ) ) { |
|
1906 | - $atts[ $f ] = $notification[ $f ]; |
|
1907 | - if ( 'custom' == $notification[ $f ] ) { |
|
1908 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1909 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1910 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1905 | + if ( isset( $notification[$f] ) ) { |
|
1906 | + $atts[$f] = $notification[$f]; |
|
1907 | + if ( 'custom' == $notification[$f] ) { |
|
1908 | + $atts[$f] = $notification['cust_' . $f]; |
|
1909 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1910 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1911 | 1911 | } |
1912 | 1912 | } |
1913 | 1913 | unset( $f, $val ); |
@@ -1938,13 +1938,13 @@ discard block |
||
1938 | 1938 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1939 | 1939 | |
1940 | 1940 | if ( is_numeric( $email_field ) ) { |
1941 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1941 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1942 | 1942 | } |
1943 | 1943 | |
1944 | 1944 | if ( strpos( $email_field, '|' ) ) { |
1945 | 1945 | $email_opt = explode( '|', $email_field ); |
1946 | 1946 | if ( isset( $email_opt[0] ) ) { |
1947 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1947 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1948 | 1948 | } |
1949 | 1949 | unset( $email_opt ); |
1950 | 1950 | } |
@@ -1965,12 +1965,12 @@ discard block |
||
1965 | 1965 | // Add more fields to the new notification |
1966 | 1966 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
1967 | 1967 | foreach ( $add_fields as $add_field ) { |
1968 | - if ( isset( $notification[ $add_field ] ) ) { |
|
1969 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
1968 | + if ( isset( $notification[$add_field] ) ) { |
|
1969 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
1970 | 1970 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
1971 | - $new_notification['post_content'][ $add_field ] = 0; |
|
1971 | + $new_notification['post_content'][$add_field] = 0; |
|
1972 | 1972 | } else { |
1973 | - $new_notification['post_content'][ $add_field ] = ''; |
|
1973 | + $new_notification['post_content'][$add_field] = ''; |
|
1974 | 1974 | } |
1975 | 1975 | unset( $add_field ); |
1976 | 1976 | } |
@@ -1994,7 +1994,7 @@ discard block |
||
1994 | 1994 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
1995 | 1995 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
1996 | 1996 | if ( is_numeric( $email_key ) ) { |
1997 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1997 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1998 | 1998 | } |
1999 | 1999 | unset( $email_key, $val ); |
2000 | 2000 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | return $errors; |
21 | 21 | } |
22 | 22 | |
23 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
23 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
24 | 24 | $frm_settings = FrmAppHelper::get_settings(); |
25 | 25 | $errors['form'] = $frm_settings->admin_permission; |
26 | 26 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | 'exclude' => array(), |
121 | 121 | |
122 | 122 | ); |
123 | - $args = wp_parse_args( $args, $defaults ); |
|
123 | + $args = wp_parse_args( $args, $defaults ); |
|
124 | 124 | |
125 | 125 | if ( empty( $args['parent_field_id'] ) ) { |
126 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
126 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
127 | 127 | } else { |
128 | 128 | // value is from a nested form |
129 | 129 | $value = $values; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
147 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
147 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
148 | 148 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
149 | 149 | self::maybe_add_item_name( $value, $posted_field ); |
150 | 150 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $pattern = self::phone_format( $field ); |
223 | 223 | |
224 | 224 | if ( ! preg_match( $pattern, $value ) ) { |
225 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
225 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | private static function form_is_in_progress( $values ) { |
334 | 334 | return FrmAppHelper::pro_is_installed() && |
335 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
335 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
336 | 336 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
337 | 337 | } |
338 | 338 | |
@@ -576,9 +576,9 @@ discard block |
||
576 | 576 | foreach ( $datas['missing_keys'] as $key_index => $key ) { |
577 | 577 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] ); |
578 | 578 | if ( $found ) { |
579 | - $datas[ $key ] = $value; |
|
579 | + $datas[$key] = $value; |
|
580 | 580 | $datas['frm_duplicated'][] = $field_id; |
581 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
581 | + unset( $datas['missing_keys'][$key_index] ); |
|
582 | 582 | } |
583 | 583 | } |
584 | 584 | }//end foreach |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
626 | 626 | if ( $include_value ) { |
627 | - $datas[ $key ] = $value; |
|
627 | + $datas[$key] = $value; |
|
628 | 628 | } |
629 | 629 | unset( $key, $value ); |
630 | 630 | } |
@@ -641,10 +641,10 @@ discard block |
||
641 | 641 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
642 | 642 | if ( isset( $datas['frm_duplicated'] ) ) { |
643 | 643 | foreach ( $datas['frm_duplicated'] as $index ) { |
644 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
645 | - unset( $values['item_meta'][ $index ] ); |
|
644 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
645 | + unset( $values['item_meta'][$index] ); |
|
646 | 646 | } else { |
647 | - unset( $values[ $index ] ); |
|
647 | + unset( $values[$index] ); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | unset( $datas['frm_duplicated'] ); |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | private static function skip_adding_values_to_akismet( &$values ) { |
666 | 666 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
667 | 667 | foreach ( $skipped_fields as $skipped_field ) { |
668 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
668 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
669 | 669 | continue; |
670 | 670 | } |
671 | 671 | |
672 | 672 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
673 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
674 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
675 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
673 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
674 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
675 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
676 | 676 | } |
677 | 677 | } |
678 | 678 | } |
@@ -708,14 +708,14 @@ discard block |
||
708 | 708 | } |
709 | 709 | |
710 | 710 | // If a choice field has Other option, but Other is not selected. |
711 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
711 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
712 | 712 | return true; |
713 | 713 | } |
714 | 714 | |
715 | 715 | // Check if submitted value is same as one of field option. |
716 | 716 | foreach ( $field_data->options as $option ) { |
717 | 717 | $option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' ); |
718 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
718 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
719 | 719 | return true; |
720 | 720 | } |
721 | 721 | } |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | |
787 | 787 | // Convert name array to string. |
788 | 788 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
789 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
789 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
790 | 790 | $values['name_field_ids'][] = $field_id; |
791 | 791 | continue; |
792 | 792 | } |
@@ -807,8 +807,8 @@ discard block |
||
807 | 807 | continue; |
808 | 808 | } |
809 | 809 | |
810 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
811 | - $values['item_meta'][ $subsubindex ] = array(); |
|
810 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
811 | + $values['item_meta'][$subsubindex] = array(); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | // Convert name array to string. |
@@ -818,11 +818,11 @@ discard block |
||
818 | 818 | $values['name_field_ids'][] = $subsubindex; |
819 | 819 | } |
820 | 820 | |
821 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
821 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
822 | 822 | } |
823 | 823 | }//end foreach |
824 | 824 | |
825 | - unset( $values['item_meta'][ $field_id ] ); |
|
825 | + unset( $values['item_meta'][$field_id] ); |
|
826 | 826 | }//end foreach |
827 | 827 | |
828 | 828 | return $form_ids; |
@@ -145,7 +145,8 @@ |
||
145 | 145 | |
146 | 146 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
147 | 147 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
148 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
148 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
149 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
149 | 150 | self::maybe_add_item_name( $value, $posted_field ); |
150 | 151 | } |
151 | 152 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $keys |
39 | 39 | */ |
40 | - self::$keys = apply_filters( |
|
40 | + self::$keys = apply_filters( |
|
41 | 41 | 'frm_application_data_keys', |
42 | 42 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
43 | 43 | ); |
@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | public function as_js_object() { |
116 | 116 | $application = array(); |
117 | 117 | foreach ( self::$keys as $key ) { |
118 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
118 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | |
122 | - $value = $this->api_data[ $key ]; |
|
122 | + $value = $this->api_data[$key]; |
|
123 | 123 | |
124 | 124 | if ( 'icon' === $key ) { |
125 | 125 | // Icon is an array. The first array item is the image URL. |
126 | - $application[ $key ] = reset( $value ); |
|
126 | + $application[$key] = reset( $value ); |
|
127 | 127 | } elseif ( 'categories' === $key ) { |
128 | - $application[ $key ] = array_values( |
|
128 | + $application[$key] = array_values( |
|
129 | 129 | array_filter( |
130 | 130 | $value, |
131 | 131 | function( $category ) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Strip off the " Template" text at the end of the name as it takes up space. |
145 | 145 | $value = substr( $value, 0, -9 ); |
146 | 146 | } |
147 | - $application[ $key ] = $value; |
|
147 | + $application[$key] = $value; |
|
148 | 148 | }//end if |
149 | 149 | }//end foreach |
150 | 150 |