PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmEntriesController.php +36 -36 6.5.26.10 View file →
@@ -35,9 +35,11 @@
35 35 add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
36 36 }
37 37 }
38 38
39 - /* Display in Back End */
39 + /**
40 + * Display in Back End.
41 + */
40 42 public static function route() {
41 43 $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
42 44 FrmAppHelper::include_svg();
43 45
@@ -125,9 +127,9 @@
125 127 if ( FrmField::is_no_save_field( $form_col->type ) ) {
126 128 continue;
127 129 }
128 130
129 - $has_child_fields = $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] );
131 + $has_child_fields = $form_col->type === 'form' && ! empty( $form_col->field_options['form_select'] );
130 132 if ( $has_child_fields ) {
131 133 self::add_subform_cols( $form_col, $form_id, $columns );
132 134 } else {
133 135 self::add_field_cols( $form_col, $form_id, $columns );
@@ -163,9 +165,9 @@
163 165 $col_id .= '-_-form' . $field->form_id;
164 166 }
165 167
166 168 $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
167 - $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status';
169 + $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status';
168 170 if ( $has_separate_value && ! $is_post_status ) {
169 171 $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
170 172 }
171 173
@@ -188,10 +190,10 @@
188 190 $prev_value = get_metadata( 'user', $object_id, $meta_key, true );
189 191 }
190 192
191 193 global $frm_vars;
192 - //add a check so we don't create a loop
193 - $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
194 + // Add a check so we don't create a loop.
195 + $frm_vars['prev_hidden_cols'] = ! empty( $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
194 196
195 197 return $check;
196 198 }
197 199
@@ -205,9 +207,10 @@
205 207 }
206 208
207 209 global $frm_vars;
208 210 if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
209 - return; // Don't continue if there's no previous value.
211 + // Don't continue if there's no previous value.
212 + return;
210 213 }
211 214
212 215 foreach ( $meta_value as $mk => $mv ) {
213 216 // Remove blank values.
@@ -265,9 +268,9 @@
265 268 return sanitize_title( $menu_name ) . '_page_formidable-entries';
266 269 }
267 270
268 271 public static function save_per_page( $save, $option, $value ) {
269 - if ( $option == 'formidable_page_formidable_entries_per_page' ) {
272 + if ( $option === 'formidable_page_formidable_entries_per_page' ) {
270 273 $save = (int) $value;
271 274 }
272 275
273 276 return $save;
@@ -285,8 +288,14 @@
285 288 $form_id . '_item_key' => 'item_key',
286 289 $form_id . '_is_draft' => 'is_draft',
287 290 );
288 291
292 + if ( ! $form_id ) {
293 + $columns[ $form_id . '_user_id' ] = 'user_id';
294 + $columns[ $form_id . '_name' ] = 'name';
295 + $columns[ $form_id . '_form_id' ] = 'form_id';
296 + }
297 +
289 298 foreach ( $fields as $field ) {
290 299 if ( self::field_supports_sorting( $field ) ) {
291 300 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
292 301 }
@@ -351,9 +360,9 @@
351 360 foreach ( (array) $result as $r ) {
352 361 if ( ! empty( $r ) ) {
353 362 list( $form_prefix, $field_key ) = explode( '_', $r );
354 363
355 - if ( (int) $form_prefix == (int) $form_id ) {
364 + if ( (int) $form_prefix === (int) $form_id ) {
356 365 $hidden[] = $r;
357 366 }
358 367
359 368 unset( $form_prefix );
@@ -385,9 +394,9 @@
385 394 }
386 395
387 396 if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
388 397 $result[] = $col_key;
389 - $i--;
398 + --$i;
390 399 }
391 400
392 401 unset( $col_key, $col );
393 402 }
@@ -432,18 +441,20 @@
432 441 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
433 442 }
434 443
435 444 private static function get_delete_form_time( $form, &$errors ) {
436 - if ( 'trash' == $form->status ) {
445 + if ( 'trash' === $form->status ) {
437 446 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
438 - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
447 + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? $form->options['trash_time'] : time() ) );
439 448
440 449 /* translators: %1$s: Time string */
441 - $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 );
450 + $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 );
442 451 }
443 452 }
444 453
445 - /* Back End CRUD */
454 + /**
455 + * Back End CRUD.
456 + */
446 457 public static function show( $id = 0 ) {
447 458 FrmAppHelper::permission_check( 'frm_view_entries' );
448 459
449 460 if ( ! $id ) {
@@ -470,9 +481,9 @@
470 481
471 482 $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
472 483 $form = FrmForm::getOne( $entry->form_id );
473 484
474 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
485 + include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php';
475 486 }
476 487
477 488 /**
478 489 * Destroy an entry from the admin page.
@@ -482,9 +493,15 @@
482 493 */
483 494 public static function destroy() {
484 495 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
485 496 if ( false !== $permission_error ) {
486 - wp_die( esc_html( $permission_error ) );
497 + $error_args = array(
498 + 'title' => __( 'Verification failed', 'formidable' ),
499 + 'body' => $permission_error,
500 + 'cancel_url' => admin_url( 'admin.php?page=formidable-entries' ),
501 + );
502 + FrmAppController::show_error_modal( $error_args );
503 + return;
487 504 }
488 505
489 506 $params = FrmForm::get_admin_params();
490 507
@@ -499,18 +516,8 @@
499 516
500 517 self::display_list( $message );
501 518 }
502 519
503 - /**
504 - * @deprecated 4.02.04 - Moved to Pro since it was unused in Lite.
505 - */
506 - public static function destroy_all() {
507 - _deprecated_function( __METHOD__, '4.02.04', 'FrmProEntriesController::destroy_all' );
508 - if ( is_callable( 'FrmProEntriesController::destroy_all' ) ) {
509 - FrmProEntriesController::destroy_all();
510 - }
511 - }
512 -
513 520 public static function process_entry( $errors = '', $ajax = false ) {
514 521 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
515 522 if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
516 523 return;
@@ -617,9 +624,9 @@
617 624 FrmEntry::clear_cache();
618 625 }
619 626
620 627 /**
621 - * @param $atts
628 + * @param array $atts
622 629 *
623 630 * @return array|string
624 631 */
625 632 public static function show_entry_shortcode( $atts ) {
@@ -646,9 +653,10 @@
646 653 'exclude_fields' => '',
647 654 'include_fields' => '',
648 655 'include_extras' => '',
649 656 'inline_style' => 1,
650 - 'child_array' => false, // return embedded fields as nested array
657 + // Return embedded fields as nested array.
658 + 'child_array' => false,
651 659 'line_breaks' => true,
652 660 'array_separator' => ', ',
653 661 );
654 662 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
@@ -695,15 +703,7 @@
695 703 */
696 704 $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
697 705 }
698 706
699 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
700 - }
701 -
702 - /**
703 - * @deprecated 4.0
704 - */
705 - public static function contextual_help( $help, $screen_id, $screen ) {
706 - _deprecated_function( __METHOD__, '4.0' );
707 - return $help;
707 + include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php';
708 708 }
709 709 }