| @@ -99,9 +99,9 @@ | ||
| 99 | 99 | add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' ); |
| 100 | 100 | add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' ); |
| 101 | 101 | add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
| 102 | 102 | } else { |
| 103 | - add_filter( 'screen_options_show_screen', self::class . '::remove_screen_options', 10, 2 ); | |
| 103 | + add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 ); | |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| @@ -234,39 +234,17 @@ | ||
| 234 | 234 | if ( $field->form_id != $form_id ) { |
| 235 | 235 | $col_id .= '-_-form' . $field->form_id; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); | |
| 239 | - $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status'; | |
| 240 | - $include_column_for_sep_val = $has_separate_value && ! $is_post_status; | |
| 241 | - if ( $include_column_for_sep_val ) { | |
| 242 | - $columns[ $form_id . '_frmsep_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val ); | |
| 238 | + $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); | |
| 239 | + $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status'; | |
| 240 | + if ( $has_separate_value && ! $is_post_status ) { | |
| 241 | + $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); | |
| 243 | 242 | } |
| 244 | 243 | |
| 245 | - $columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false ); | |
| 244 | + $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); | |
| 246 | 245 | } |
| 247 | 246 | |
| 248 | - /** | |
| 249 | - * Appends "(Value)" or "(Label)" to the field name if it's an option field that has a separate value/label. | |
| 250 | - * | |
| 251 | - * @since 6.25.1 | |
| 252 | - * | |
| 253 | - * @param object $field | |
| 254 | - * @param bool $include_column_for_sep_val | |
| 255 | - * @param bool $is_value | |
| 256 | - * | |
| 257 | - * @return string | |
| 258 | - */ | |
| 259 | - private static function maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, $is_value = true ) { | |
| 260 | - $field_name = FrmAppHelper::truncate( $field->name, 35 ); | |
| 261 | - if ( ! $include_column_for_sep_val || ! in_array( $field->type, array( 'select', 'radio', 'checkbox' ), true ) ) { | |
| 262 | - return $field_name; | |
| 263 | - } | |
| 264 | - $append_text = $is_value ? esc_html__( 'value', 'formidable' ) : esc_html__( 'label', 'formidable' ); | |
| 265 | - | |
| 266 | - return sprintf( '%s (%s)', $field_name, $append_text ); | |
| 267 | - } | |
| 268 | - | |
| 269 | 247 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 270 | 248 | if ( FrmAppHelper::ips_saved() ) { |
| 271 | 249 | $columns[ $form_id . '_ip' ] = 'IP'; |
| 272 | 250 | } |
| @@ -414,10 +392,8 @@ | ||
| 414 | 392 | * @param mixed $result Option value from database for hidden columns in entries table. |
| 415 | 393 | * @return array |
| 416 | 394 | */ |
| 417 | 395 | public static function hidden_columns( $result ) { |
| 418 | - global $frm_vars; | |
| 419 | - | |
| 420 | 396 | if ( ! is_array( $result ) ) { |
| 421 | 397 | // Force an unexpected value to be an array. |
| 422 | 398 | // Since $result is a filtered option and gets saved to the database, it's possible it could be a string. |
| 423 | 399 | // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error. |
| @@ -423,16 +399,21 @@ | ||
| 423 | 399 | // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error. |
| 424 | 400 | $result = array(); |
| 425 | 401 | } |
| 426 | 402 | |
| 427 | - $form_id = FrmForm::get_current_form_id(); | |
| 428 | - $hidden = self::user_hidden_columns_for_form( $form_id, $result ); | |
| 429 | - $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; | |
| 430 | - $max_columns = 11; | |
| 403 | + $form_id = FrmForm::get_current_form_id(); | |
| 431 | 404 | |
| 405 | + $hidden = self::user_hidden_columns_for_form( $form_id, $result ); | |
| 406 | + | |
| 407 | + global $frm_vars; | |
| 408 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; | |
| 409 | + | |
| 432 | 410 | if ( ! empty( $hidden ) ) { |
| 433 | - $result = $hidden; | |
| 434 | - $i = $i - count( $result ); | |
| 411 | + $result = $hidden; | |
| 412 | + $i = $i - count( $result ); | |
| 413 | + $max_columns = 11; | |
| 414 | + } else { | |
| 415 | + $max_columns = 8; | |
| 435 | 416 | } |
| 436 | 417 | |
| 437 | 418 | if ( $i <= $max_columns ) { |
| 438 | 419 | return $result; |
| @@ -466,12 +447,8 @@ | ||
| 466 | 447 | /** |
| 467 | 448 | * Remove some columns by default when there are too many |
| 468 | 449 | * |
| 469 | 450 | * @since 2.05.07 |
| 470 | - * | |
| 471 | - * @param array $atts | |
| 472 | - * @param array $result | |
| 473 | - * @return void | |
| 474 | 451 | */ |
| 475 | 452 | private static function remove_excess_cols( $atts, &$result ) { |
| 476 | 453 | global $frm_vars; |
| 477 | 454 | |
| @@ -538,9 +515,9 @@ | ||
| 538 | 515 | |
| 539 | 516 | private static function get_delete_form_time( $form, &$errors ) { |
| 540 | 517 | if ( 'trash' === $form->status ) { |
| 541 | 518 | $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
| 542 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( $form->options['trash_time'] ?? time() ) ); | |
| 519 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? $form->options['trash_time'] : time() ) ); | |
| 543 | 520 | |
| 544 | 521 | /* translators: %1$s: Time string */ |
| 545 | 522 | $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
| 546 | 523 | } |
| @@ -756,9 +733,8 @@ | ||
| 756 | 733 | 'exclude_fields' => '', |
| 757 | 734 | 'include_fields' => '', |
| 758 | 735 | 'include_extras' => '', |
| 759 | 736 | 'inline_style' => 1, |
| 760 | - 'table_style' => '', | |
| 761 | 737 | // Return embedded fields as nested array. |
| 762 | 738 | 'child_array' => false, |
| 763 | 739 | 'line_breaks' => true, |
| 764 | 740 | 'array_separator' => ', ', |