@@ -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 ); |
@@ -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 ) ) { |
@@ -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 ); |
@@ -225,18 +225,18 @@ discard block |
||
225 | 225 | * @param mixed $value |
226 | 226 | */ |
227 | 227 | private static function get_posted_field_setting( $setting, &$value ) { |
228 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
228 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | 232 | if ( strpos( $setting, 'html' ) !== false ) { |
233 | 233 | // Strip slashes from HTML but not regex or script tags. |
234 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
234 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
235 | 235 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
236 | 236 | // TODO: Remove stripslashes on output, and use on input only. |
237 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
237 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
238 | 238 | } else { |
239 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
239 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
240 | 240 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
241 | 241 | } |
242 | 242 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
310 | 310 | |
311 | 311 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
312 | - $values[ $col ] = $field->{$col}; |
|
312 | + $values[$col] = $field->{$col}; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ); |
349 | 349 | |
350 | 350 | $msg = FrmField::get_option( $field, $error ); |
351 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
351 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
352 | 352 | $msg = do_shortcode( $msg ); |
353 | 353 | |
354 | 354 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | } |
527 | 527 | |
528 | 528 | $base_name = 'default_value_' . $field['id']; |
529 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
529 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
530 | 530 | |
531 | 531 | $default_type = self::get_default_value_type( $field ); |
532 | 532 | |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | continue; |
857 | 857 | } |
858 | 858 | |
859 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
859 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
860 | 860 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
861 | 861 | |
862 | 862 | $atts['entry'] = $entry; |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | if ( $replace_with !== null ) { |
867 | 867 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
868 | 868 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
869 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
869 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | unset( $atts, $replace_with ); |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
885 | 885 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
886 | 886 | foreach ( $included_atts as $included_att ) { |
887 | - if ( '0' === $atts[ $included_att ] ) { |
|
887 | + if ( '0' === $atts[$included_att] ) { |
|
888 | 888 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
889 | 889 | continue; |
890 | 890 | } |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | |
958 | 958 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
959 | 959 | |
960 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
961 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
960 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
961 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
962 | 962 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
963 | 963 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
964 | 964 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1169,8 +1169,8 @@ discard block |
||
1169 | 1169 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
1170 | 1170 | } elseif ( in_array( $type, $multiple_input ) ) { |
1171 | 1171 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
1172 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
1173 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
1172 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
1173 | + $field_types[$type] = $field_selection[$type]; |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | |
1204 | 1204 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1205 | 1205 | foreach ( $inputs as $input ) { |
1206 | - $field_types[ $input ] = $fields[ $input ]; |
|
1206 | + $field_types[$input] = $fields[$input]; |
|
1207 | 1207 | unset( $input ); |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -1235,7 +1235,7 @@ discard block |
||
1235 | 1235 | 'parent' => false, |
1236 | 1236 | 'pointer' => false, |
1237 | 1237 | ); |
1238 | - $args = wp_parse_args( $args, $defaults ); |
|
1238 | + $args = wp_parse_args( $args, $defaults ); |
|
1239 | 1239 | |
1240 | 1240 | $opt_key = $args['opt_key']; |
1241 | 1241 | $field = $args['field']; |
@@ -1251,24 +1251,24 @@ discard block |
||
1251 | 1251 | |
1252 | 1252 | // Check posted vals before checking saved values |
1253 | 1253 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1254 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1254 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1255 | 1255 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1256 | 1256 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1257 | - $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 ] ) ) : ''; |
|
1257 | + $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] ) ) : ''; |
|
1258 | 1258 | } else { |
1259 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1259 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | return $other_val; |
1263 | 1263 | |
1264 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1264 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1265 | 1265 | // For normal fields |
1266 | 1266 | |
1267 | 1267 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1268 | 1268 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1269 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1269 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1270 | 1270 | } else { |
1271 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1271 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | return $other_val; |
@@ -1278,8 +1278,8 @@ discard block |
||
1278 | 1278 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
1279 | 1279 | // Check if there is an "other" val in saved value and make sure the |
1280 | 1280 | // "other" val is not equal to the Other checkbox option |
1281 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1282 | - $other_val = $field['value'][ $opt_key ]; |
|
1281 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1282 | + $other_val = $field['value'][$opt_key]; |
|
1283 | 1283 | } |
1284 | 1284 | } else { |
1285 | 1285 | /** |
@@ -1291,8 +1291,8 @@ discard block |
||
1291 | 1291 | // Multi-select dropdowns - key is not preserved |
1292 | 1292 | if ( is_array( $field['value'] ) ) { |
1293 | 1293 | $o_key = array_search( $temp_val, $field['value'] ); |
1294 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1295 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1294 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1295 | + unset( $field['value'][$o_key], $o_key ); |
|
1296 | 1296 | } |
1297 | 1297 | } elseif ( $temp_val == $field['value'] ) { |
1298 | 1298 | // For radio and regular dropdowns |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | return $other_args; |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - $other_opt = true; |
|
1337 | + $other_opt = true; |
|
1338 | 1338 | |
1339 | 1339 | self::set_other_name( $args, $other_args ); |
1340 | 1340 | self::set_other_value( $args, $other_args ); |
@@ -1502,7 +1502,7 @@ discard block |
||
1502 | 1502 | if ( is_array( $val ) ) { |
1503 | 1503 | foreach ( $val as $k => $v ) { |
1504 | 1504 | if ( is_string( $v ) ) { |
1505 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1505 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1506 | 1506 | unset( $k, $v ); |
1507 | 1507 | } |
1508 | 1508 | } |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | $countries['class'] = 'frm-countries-opts'; |
1856 | 1856 | } |
1857 | 1857 | |
1858 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
1858 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
1859 | 1859 | |
1860 | 1860 | // State abv. |
1861 | 1861 | $states = self::get_us_states(); |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | $state_abv['class'] = 'frm-state-abv-opts'; |
1866 | 1866 | } |
1867 | 1867 | |
1868 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1868 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1869 | 1869 | |
1870 | 1870 | // States. |
1871 | 1871 | $states = array_values( $states ); |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | $states['class'] = 'frm-states-opts'; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1877 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1878 | 1878 | unset( $state_abv, $states ); |
1879 | 1879 | |
1880 | 1880 | // Age. |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | $ages['class'] = 'frm-age-opts'; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
1895 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
1896 | 1896 | |
1897 | 1897 | // Satisfaction. |
1898 | 1898 | $satisfaction = array( |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
1910 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
1911 | 1911 | |
1912 | 1912 | // Importance. |
1913 | 1913 | $importance = array( |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | $importance['class'] = 'frm-importance-opts'; |
1923 | 1923 | } |
1924 | 1924 | |
1925 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
1925 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
1926 | 1926 | |
1927 | 1927 | // Agreement. |
1928 | 1928 | $agreement = array( |
@@ -1937,7 +1937,7 @@ discard block |
||
1937 | 1937 | $agreement['class'] = 'frm-agreement-opts'; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
1940 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
1941 | 1941 | |
1942 | 1942 | // Likely. |
1943 | 1943 | $likely = array( |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | $likely['class'] = 'frm-likely-opts'; |
1953 | 1953 | } |
1954 | 1954 | |
1955 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
1955 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
1956 | 1956 | |
1957 | 1957 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1958 | 1958 | } |
@@ -2159,16 +2159,16 @@ discard block |
||
2159 | 2159 | */ |
2160 | 2160 | private static function fill_image_setting_options( $options, &$args ) { |
2161 | 2161 | foreach ( $options as $key => $option ) { |
2162 | - $args['options'][ $key ] = $option; |
|
2162 | + $args['options'][$key] = $option; |
|
2163 | 2163 | |
2164 | 2164 | if ( ! empty( $option['addon'] ) ) { |
2165 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2165 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2166 | 2166 | } |
2167 | 2167 | |
2168 | - unset( $args['options'][ $key ]['addon'] ); |
|
2168 | + unset( $args['options'][$key]['addon'] ); |
|
2169 | 2169 | $fill = array( 'upgrade', 'message', 'content' ); |
2170 | 2170 | foreach ( $fill as $f ) { |
2171 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
2171 | + unset( $args['options'][$key][$f], $f ); |
|
2172 | 2172 | } |
2173 | 2173 | } |
2174 | 2174 | } |
@@ -2189,8 +2189,8 @@ discard block |
||
2189 | 2189 | |
2190 | 2190 | $fill = array( 'upgrade', 'message', 'content' ); |
2191 | 2191 | foreach ( $fill as $f ) { |
2192 | - if ( isset( $option[ $f ] ) ) { |
|
2193 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
2192 | + if ( isset( $option[$f] ) ) { |
|
2193 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
2194 | 2194 | } |
2195 | 2195 | } |
2196 | 2196 |
@@ -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 |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | $groups = FrmFormActionsController::form_action_groups(); |
209 | 209 | $group = 'misc'; |
210 | 210 | |
211 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
211 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
212 | 212 | $group = $action_options['group']; |
213 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
213 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
214 | 214 | $group = $this->id_base; |
215 | 215 | } else { |
216 | 216 | foreach ( $groups as $name => $check_group ) { |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | - $groups[ $group ]['id'] = $group; |
|
225 | - return $groups[ $group ]; |
|
224 | + $groups[$group]['id'] = $group; |
|
225 | + return $groups[$group]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return integer $post_id |
334 | 334 | */ |
335 | 335 | public function maybe_create_action( $action, $forms ) { |
336 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
336 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
337 | 337 | // Update action only |
338 | 338 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
339 | 339 | $post_id = $this->save_settings( $action ); |
@@ -356,18 +356,18 @@ discard block |
||
356 | 356 | $switch = $this->get_global_switch_fields(); |
357 | 357 | |
358 | 358 | foreach ( (array) $action->post_content as $key => $val ) { |
359 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
360 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
359 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
360 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
361 | 361 | } elseif ( ! is_array( $val ) ) { |
362 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
362 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
364 | 364 | // loop through each value if empty |
365 | - if ( empty( $switch[ $key ] ) ) { |
|
366 | - $switch[ $key ] = array_keys( $val ); |
|
365 | + if ( empty( $switch[$key] ) ) { |
|
366 | + $switch[$key] = array_keys( $val ); |
|
367 | 367 | } |
368 | 368 | |
369 | - foreach ( $switch[ $key ] as $subkey ) { |
|
370 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
369 | + foreach ( $switch[$key] as $subkey ) { |
|
370 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | foreach ( $subkey as $subkey2 ) { |
386 | 386 | foreach ( (array) $val as $ck => $cv ) { |
387 | 387 | if ( is_array( $cv ) ) { |
388 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
389 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
390 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
388 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
389 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
390 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
394 | 394 | } else { |
395 | 395 | foreach ( (array) $val as $ck => $cv ) { |
396 | 396 | if ( is_array( $cv ) ) { |
397 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
398 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
399 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
397 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
398 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
399 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
400 | 400 | } elseif ( $ck == $subkey ) { |
401 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
401 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | }//end if |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
425 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
425 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
426 | 426 | // Sanitizing removes scripts and <email> type of values. |
427 | 427 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
428 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
428 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
429 | 429 | } else { |
430 | 430 | return; |
431 | 431 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | foreach ( $settings as $number => $new_instance ) { |
436 | 436 | $this->_set( $number ); |
437 | 437 | |
438 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
438 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
439 | 439 | |
440 | 440 | if ( ! isset( $new_instance['post_status'] ) ) { |
441 | 441 | $new_instance['post_status'] = 'draft'; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
474 | 474 | |
475 | 475 | if ( false !== $instance ) { |
476 | - $all_instances[ $number ] = $instance; |
|
476 | + $all_instances[$number] = $instance; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $action_ids[] = $this->save_settings( $instance ); |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | // some plugins/themes are formatting the post_excerpt |
556 | 556 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
557 | 557 | |
558 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
558 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
559 | 559 | continue; |
560 | 560 | } |
561 | 561 | |
562 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
563 | - $settings[ $action->ID ] = $action; |
|
562 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
563 | + $settings[$action->ID] = $action; |
|
564 | 564 | |
565 | 565 | if ( count( $settings ) >= $limit ) { |
566 | 566 | break; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | 'limit' => 99, |
594 | 594 | 'post_status' => $default_status, |
595 | 595 | ); |
596 | - $args = wp_parse_args( $args, $defaults ); |
|
596 | + $args = wp_parse_args( $args, $defaults ); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $action = $this->prepare_action( $action ); |
661 | 661 | |
662 | - $settings[ $action->ID ] = $action; |
|
662 | + $settings[$action->ID] = $action; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | if ( 1 === $limit ) { |
@@ -702,10 +702,10 @@ discard block |
||
702 | 702 | |
703 | 703 | foreach ( $default_values as $k => $vals ) { |
704 | 704 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
705 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
705 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
706 | 706 | continue; |
707 | 707 | } |
708 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
708 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
@@ -788,14 +788,14 @@ discard block |
||
788 | 788 | * Migrate settings from form->options into new action. |
789 | 789 | */ |
790 | 790 | public function migrate_to_2( $form, $update = 'update' ) { |
791 | - $action = $this->prepare_new( $form->id ); |
|
791 | + $action = $this->prepare_new( $form->id ); |
|
792 | 792 | FrmAppHelper::unserialize_or_decode( $form->options ); |
793 | 793 | |
794 | 794 | // fill with existing options |
795 | 795 | foreach ( $action->post_content as $name => $val ) { |
796 | - if ( isset( $form->options[ $name ] ) ) { |
|
797 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
798 | - unset( $form->options[ $name ] ); |
|
796 | + if ( isset( $form->options[$name] ) ) { |
|
797 | + $action->post_content[$name] = $form->options[$name]; |
|
798 | + unset( $form->options[$name] ); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | $stop = $stop ? false : true; |
862 | 862 | } |
863 | 863 | |
864 | - $met[ $stop ] = $stop; |
|
864 | + $met[$stop] = $stop; |
|
865 | 865 | }//end foreach |
866 | 866 | |
867 | 867 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | private static function get_value_from_entry( $entry, $field_id ) { |
916 | 916 | $observed_value = ''; |
917 | 917 | |
918 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
919 | - $observed_value = $entry->metas[ $field_id ]; |
|
918 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
919 | + $observed_value = $entry->metas[$field_id]; |
|
920 | 920 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
921 | 921 | $field = FrmField::getOne( $field_id ); |
922 | 922 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param array $stats Statistics section data. |
141 | 141 | */ |
142 | 142 | protected function add_payments_data( &$stats ) { |
143 | - $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
143 | + $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
144 | 144 | $stats['payments_count'] = array( |
145 | 145 | 'label' => __( 'Payments collected', 'formidable' ), |
146 | 146 | 'count' => $payment_data['count'], |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Build total for each currency. |
151 | 151 | foreach ( $payment_data['total'] as $currency => $amount ) { |
152 | - $stats[ 'payments_total_' . $currency ] = array( |
|
152 | + $stats['payments_total_' . $currency] = array( |
|
153 | 153 | // translators: currency name. |
154 | 154 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
155 | 155 | 'count' => $amount, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | if ( $this->has_comparison ) { |
162 | - $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
162 | + $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
163 | 163 | |
164 | 164 | if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) { |
165 | 165 | // Maybe this site doesn't collect payment, hide these sections. |
@@ -171,23 +171,23 @@ discard block |
||
171 | 171 | |
172 | 172 | // Compare total for each currency. |
173 | 173 | foreach ( $payment_data['total'] as $currency => $amount ) { |
174 | - if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) { |
|
175 | - $stats[ 'payments_total_' . $currency ]['compare'] = 1; |
|
174 | + if ( ! isset( $prev_payment_data['total'][$currency] ) ) { |
|
175 | + $stats['payments_total_' . $currency]['compare'] = 1; |
|
176 | 176 | continue; |
177 | 177 | } |
178 | 178 | |
179 | - $stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] ); |
|
180 | - unset( $prev_payment_data['total'][ $currency ] ); |
|
179 | + $stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] ); |
|
180 | + unset( $prev_payment_data['total'][$currency] ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // If prev month has more currencies. |
184 | 184 | foreach ( $prev_payment_data['total'] as $currency => $amount ) { |
185 | - $stats[ 'payments_total_' . $currency ] = array( |
|
185 | + $stats['payments_total_' . $currency] = array( |
|
186 | 186 | // translators: currency name. |
187 | 187 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
188 | 188 | 'count' => 0, |
189 | 189 | 'display' => $this->get_formatted_price( 0, $currency ), |
190 | - 'compare' => -1, |
|
190 | + 'compare' => - 1, |
|
191 | 191 | ); |
192 | 192 | } |
193 | 193 | }//end if |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $atts |
45 | 45 | */ |
46 | 46 | private function _set( $param, $atts ) { |
47 | - if ( isset( $atts[ $param ] ) ) { |
|
48 | - $this->{$param} = $atts[ $param ]; |
|
47 | + if ( isset( $atts[$param] ) ) { |
|
48 | + $this->{$param} = $atts[$param]; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | |
90 | 90 | $exclude = array( 'field_obj', 'html' ); |
91 | 91 | foreach ( $exclude as $ex ) { |
92 | - if ( isset( $atts[ $ex ] ) ) { |
|
93 | - unset( $this->pass_args[ $ex ] ); |
|
92 | + if ( isset( $atts[$ex] ) ) { |
|
93 | + unset( $this->pass_args[$ex] ); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param array $set |
103 | 103 | */ |
104 | 104 | private function set_from_field( $atts, $set ) { |
105 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
106 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
105 | + if ( isset( $atts[$set['param']] ) ) { |
|
106 | + $this->{$set['param']} = $atts[$set['param']]; |
|
107 | 107 | } else { |
108 | 108 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
109 | 109 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function replace_error_shortcode() { |
232 | 232 | $this->maybe_add_error_id(); |
233 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
233 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
234 | 234 | |
235 | 235 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
236 | 236 | $error_body = self::get_error_body( $this->html ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @since 3.06.02 |
272 | 272 | */ |
273 | 273 | private function maybe_add_error_id() { |
274 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
274 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
352 | 352 | |
353 | 353 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
354 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
354 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
355 | 355 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
356 | 356 | |
357 | 357 | $replace_with = ''; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
363 | 363 | } |
364 | 364 | |
365 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
365 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | unset( $shortcode_atts['class'] ); |
395 | 395 | } |
396 | 396 | |
397 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
397 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
398 | 398 | |
399 | 399 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
400 | 400 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | private function get_field_div_classes() { |
448 | 448 | // Add error class |
449 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
449 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
450 | 450 | |
451 | 451 | // Add label position class |
452 | 452 | $settings = $this->field_obj->display_field_settings(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | // Validate the number format. |
72 | 72 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
73 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
73 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // validate number settings |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
83 | 83 | $value = (float) $args['value']; |
84 | 84 | if ( $value < $minnum ) { |
85 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
85 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
86 | 86 | } elseif ( $value > $maxnum ) { |
87 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
87 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return void |
106 | 106 | */ |
107 | 107 | private function validate_step( &$errors, $args ) { |
108 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
108 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
109 | 109 | // Don't need to check if value is invalid before. |
110 | 110 | return; |
111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
123 | + $errors['field' . $args['id']] = sprintf( |
|
124 | 124 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
125 | 125 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
126 | 126 | floatval( $result[0] ), |