@@ -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 int $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 | |
@@ -793,9 +793,9 @@ discard block |
||
| 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( |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | protected function get_field_value( $args ) { |
| 59 | 59 | $user_ID = get_current_user_id(); |
| 60 | 60 | $user_ID = ( $user_ID ? $user_ID : '' ); |
| 61 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 61 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 62 | 62 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
| 63 | 63 | $updating = $action === 'update'; |
| 64 | 64 | return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( $new_val !== $value ) { |
| 212 | - $new_values[ $key ] = $new_val; |
|
| 212 | + $new_values[$key] = $new_val; |
|
| 213 | 213 | } |
| 214 | 214 | }//end foreach |
| 215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | foreach ( $values as $value_key => $value ) { |
| 242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 243 | - $new_values[ $value_key ] = $value; |
|
| 243 | + $new_values[$value_key] = $value; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
| 324 | 324 | foreach ( $all_fields as $fid ) { |
| 325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 326 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 326 | + $values['item_meta'][$fid->id] = ''; |
|
| 327 | 327 | } |
| 328 | - $field_array[ $fid->id ] = $fid; |
|
| 328 | + $field_array[$fid->id] = $fid; |
|
| 329 | 329 | } |
| 330 | 330 | unset( $all_fields ); |
| 331 | 331 | |
| 332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 334 | - $field = $field_array[ $field_id ]; |
|
| 333 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 334 | + $field = $field_array[$field_id]; |
|
| 335 | 335 | } else { |
| 336 | 336 | $field = FrmField::getOne( $field_id ); |
| 337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 344 | 344 | if ( $is_settings_page ) { |
| 345 | 345 | self::get_settings_page_html( $values, $field ); |
| 346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
| 356 | 356 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 357 | 357 | |
| 358 | 358 | foreach ( $update_options as $opt => $default ) { |
| 359 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 360 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 359 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 360 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 364 | 364 | |
| 365 | 365 | $new_field = array( |
| 366 | 366 | 'field_options' => $field->field_options, |
| 367 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 367 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 371 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 370 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 371 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 372 | 372 | if ( is_array( $option ) ) { |
| 373 | 373 | foreach ( $option as $key => $item ) { |
| 374 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 374 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 403 | 403 | if ( $field->type === 'textarea' && |
| 404 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 405 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 404 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 405 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 406 | 406 | |
| 407 | 407 | $new_field['field_options']['max'] = ''; |
| 408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 411 | 411 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 412 | 412 | */ |
| 413 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 413 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -486,11 +486,11 @@ discard block |
||
| 486 | 486 | * Updating the settings page |
| 487 | 487 | */ |
| 488 | 488 | private static function get_settings_page_html( $values, &$field ) { |
| 489 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 489 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 490 | 490 | $prev_opts = array(); |
| 491 | 491 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 492 | 492 | |
| 493 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 493 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 494 | 494 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 495 | 495 | $prev_opts = $field->field_options; |
| 496 | 496 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | foreach ( $field_cols as $col => $default ) { |
| 517 | 517 | $default = $default === '' ? $field->{$col} : $default; |
| 518 | 518 | |
| 519 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 519 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Don't save the template option. |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 697 | 697 | self::destroy( $form->id ); |
| 698 | 698 | if ( empty( $form->parent_form_id ) ) { |
| 699 | - ++$count; |
|
| 699 | + ++ $count; |
|
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | |
@@ -920,16 +920,16 @@ discard block |
||
| 920 | 920 | foreach ( $results as $row ) { |
| 921 | 921 | if ( 'trash' != $row->status ) { |
| 922 | 922 | if ( $row->is_template ) { |
| 923 | - ++$counts['template']; |
|
| 923 | + ++ $counts['template']; |
|
| 924 | 924 | } else { |
| 925 | - ++$counts['published']; |
|
| 925 | + ++ $counts['published']; |
|
| 926 | 926 | } |
| 927 | 927 | } else { |
| 928 | - ++$counts['trash']; |
|
| 928 | + ++ $counts['trash']; |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | if ( 'draft' == $row->status ) { |
| 932 | - ++$counts['draft']; |
|
| 932 | + ++ $counts['draft']; |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | unset( $row ); |
@@ -970,8 +970,8 @@ discard block |
||
| 970 | 970 | self::maybe_get_form( $form ); |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 974 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 973 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 974 | + return $frm_vars['form_params'][$form->id]; |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1000,15 +1000,15 @@ discard block |
||
| 1000 | 1000 | // If there are two forms on the same page, make sure not to submit both. |
| 1001 | 1001 | foreach ( $default_values as $var => $default ) { |
| 1002 | 1002 | if ( $var === 'action' ) { |
| 1003 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1003 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1004 | 1004 | } else { |
| 1005 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1005 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | unset( $var, $default ); |
| 1008 | 1008 | } |
| 1009 | 1009 | } else { |
| 1010 | 1010 | foreach ( $default_values as $var => $default ) { |
| 1011 | - $values[ $var ] = $default; |
|
| 1011 | + $values[$var] = $default; |
|
| 1012 | 1012 | unset( $var, $default ); |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | 'sdir' => '', |
| 1035 | 1035 | ); |
| 1036 | 1036 | foreach ( $defaults as $var => $default ) { |
| 1037 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1037 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | return $values; |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | 'keep_post' => '', |
| 1063 | 1063 | ); |
| 1064 | 1064 | foreach ( $defaults as $var => $default ) { |
| 1065 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1065 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | return $values; |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $form = $atts['form']; |
| 1166 | 1166 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
| 1167 | 1167 | |
| 1168 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
| 1168 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | foreach ( $settings as $setting => $default ) { |
| 232 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
| 233 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
| 232 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
| 233 | + $this->{$setting} = $params['frm_' . $setting]; |
|
| 234 | 234 | } elseif ( ! isset( $this->{$setting} ) ) { |
| 235 | 235 | $this->{$setting} = $default; |
| 236 | 236 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar', 'summary_emails' ); |
| 409 | 409 | foreach ( $checkboxes as $set ) { |
| 410 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; |
|
| 410 | + $this->$set = isset( $params['frm_' . $set] ) ? absint( $params['frm_' . $set] ) : 0; |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 421 | 421 | $roles = get_editable_roles(); |
| 422 | 422 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 423 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 423 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
| 424 | 424 | |
| 425 | 425 | // Make sure administrators always have permissions |
| 426 | 426 | if ( ! in_array( 'administrator', $this->$frm_role, true ) ) { |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $field_val = ''; |
| 150 | 150 | if ( is_object( $this->field ) ) { |
| 151 | 151 | $field_val = $this->field->{$column}; |
| 152 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 153 | - $field_val = $this->field[ $column ]; |
|
| 152 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 153 | + $field_val = $this->field[$column]; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $field_val; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | if ( is_object( $this->field ) ) { |
| 165 | 165 | $this->field->{$column} = $value; |
| 166 | 166 | } elseif ( is_array( $this->field ) ) { |
| 167 | - $this->field[ $column ] = $value; |
|
| 167 | + $this->field[$column] = $value; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | printf( |
| 599 | 599 | /* translators: %s: Field type */ |
| 600 | 600 | esc_html__( '%s Options', 'formidable' ), |
| 601 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 601 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 602 | 602 | ); |
| 603 | 603 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
| 604 | 604 | ?> |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | * New field |
| 675 | 675 | */ |
| 676 | 676 | public function get_new_field_defaults() { |
| 677 | - $field = array( |
|
| 677 | + $field = array( |
|
| 678 | 678 | 'name' => $this->get_new_field_name(), |
| 679 | 679 | 'description' => '', |
| 680 | 680 | 'type' => $this->type, |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | $fields = array_merge( $fields, $pro_fields ); |
| 707 | 707 | |
| 708 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 709 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 708 | + if ( isset( $fields[$this->type] ) ) { |
|
| 709 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | return $name; |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | * @return array |
| 724 | 724 | */ |
| 725 | 725 | public function get_default_field_options() { |
| 726 | - $opts = array( |
|
| 726 | + $opts = array( |
|
| 727 | 727 | 'size' => '', |
| 728 | 728 | 'max' => '', |
| 729 | 729 | 'label' => '', |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | $selected = $values['field_value']; |
| 1145 | 1145 | |
| 1146 | 1146 | if ( isset( $values['combo_name'] ) ) { |
| 1147 | - $options = $options[ $values['combo_name'] ]; |
|
| 1148 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1147 | + $options = $options[$values['combo_name']]; |
|
| 1148 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | $input = $this->select_tag( $values ); |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | protected function fill_display_field_values( $args = array() ) { |
| 1199 | - $defaults = array( |
|
| 1199 | + $defaults = array( |
|
| 1200 | 1200 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1201 | 1201 | 'field_id' => $this->get_field_column( 'id' ), |
| 1202 | 1202 | 'field_plus_id' => '', |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | } |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1252 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1253 | 1253 | if ( $error_comes_first ) { |
| 1254 | 1254 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1255 | 1255 | } else { |
@@ -1328,11 +1328,11 @@ discard block |
||
| 1328 | 1328 | |
| 1329 | 1329 | $field_id = $this->get_field_column( 'id' ); |
| 1330 | 1330 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1331 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1331 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1332 | 1332 | return false; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1335 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1336 | 1336 | return $already_validated_this_value; |
| 1337 | 1337 | } |
| 1338 | 1338 | |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | private function value_validated_as_unique( $value ) { |
| 1358 | 1358 | global $frm_validated_unique_values; |
| 1359 | 1359 | $field_id = $this->get_field_column( 'id' ); |
| 1360 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1360 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1361 | 1361 | } |
| 1362 | 1362 | |
| 1363 | 1363 | public function get_value_to_save( $value, $atts ) { |
@@ -1393,8 +1393,8 @@ discard block |
||
| 1393 | 1393 | $value = $this->prepare_display_value( $value, $atts ); |
| 1394 | 1394 | |
| 1395 | 1395 | if ( is_array( $value ) ) { |
| 1396 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 1397 | - $value = $value[ $atts['show'] ]; |
|
| 1396 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 1397 | + $value = $value[$atts['show']]; |
|
| 1398 | 1398 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 1399 | 1399 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 1400 | 1400 | $value = implode( $sep, $value ); |
@@ -1524,8 +1524,8 @@ discard block |
||
| 1524 | 1524 | $saved_entries = $atts['ids']; |
| 1525 | 1525 | $new_value = array(); |
| 1526 | 1526 | foreach ( (array) $value as $old_child_id ) { |
| 1527 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1528 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1527 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1528 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1529 | 1529 | } |
| 1530 | 1530 | } |
| 1531 | 1531 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $page = $this->get_pagenum(); |
| 24 | 24 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 25 | 25 | |
| 26 | - $mode = self::get_param( |
|
| 26 | + $mode = self::get_param( |
|
| 27 | 27 | array( |
| 28 | 28 | 'param' => 'mode', |
| 29 | 29 | 'default' => 'list', |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | 'default' => 'name', |
| 36 | 36 | ) |
| 37 | 37 | ); |
| 38 | - $order = self::get_param( |
|
| 38 | + $order = self::get_param( |
|
| 39 | 39 | array( |
| 40 | 40 | 'param' => 'order', |
| 41 | 41 | 'default' => 'ASC', |
| 42 | 42 | ) |
| 43 | 43 | ); |
| 44 | - $start = self::get_param( |
|
| 44 | + $start = self::get_param( |
|
| 45 | 45 | array( |
| 46 | 46 | 'param' => 'start', |
| 47 | 47 | 'default' => ( $page - 1 ) * $per_page, |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $counts = FrmForm::get_count(); |
| 174 | 174 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
| 175 | 175 | |
| 176 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
| 176 | + if ( isset( $statuses[$form_type] ) ) { |
|
| 177 | 177 | $counts->$form_type = $this->total_items; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | if ( $counts->{$status} || 'draft' !== $status ) { |
| 196 | 196 | /* translators: %1$s: Status, %2$s: Number of items */ |
| 197 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 197 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | unset( $status, $name ); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | private function get_actions( &$actions, $item, $edit_link ) { |
| 376 | 376 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 377 | 377 | foreach ( $new_actions as $link => $action ) { |
| 378 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 378 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if ( 'trash' === $this->status ) { |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) { |
| 1278 | 1278 | add_action( |
| 1279 | 1279 | 'frm_update_settings', |
| 1280 | - function ( $params ) { |
|
| 1280 | + function( $params ) { |
|
| 1281 | 1281 | if ( ! empty( $params['frm_use_html'] ) ) { |
| 1282 | 1282 | $inbox = new FrmInbox(); |
| 1283 | 1283 | $inbox->dismiss( 'deprecated_use_html' ); |
@@ -1296,7 +1296,7 @@ discard block |
||
| 1296 | 1296 | * @param array $messages |
| 1297 | 1297 | * @return array |
| 1298 | 1298 | */ |
| 1299 | - function ( $messages ) use ( $url ) { |
|
| 1299 | + function( $messages ) use ( $url ) { |
|
| 1300 | 1300 | $messages[] = '<p>The option to use HTML5 in forms is currently disabled. In a future release, this setting will be removed and using HTML5 will be a requirement. <a href="' . esc_url( $url ) . '">Click here to enable it in Global Settings now</a>.</p>'; |
| 1301 | 1301 | return $messages; |
| 1302 | 1302 | } |