PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16
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 +23 -220 6.266.16 View file →
@@ -4,11 +4,8 @@
4 4 }
5 5
6 6 class FrmEntriesController {
7 7
8 - /**
9 - * @return void
10 - */
11 8 public static function menu() {
12 9 FrmAppHelper::force_capability( 'frm_view_entries' );
13 10
14 11 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
@@ -13,9 +10,8 @@
13 10
14 11 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
15 12
16 13 $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed();
17 -
18 14 if ( ! $views_installed ) {
19 15 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
20 16 self::maybe_redirect_to_views_upsell();
21 17 } else {
@@ -61,9 +57,8 @@
61 57 * @return void
62 58 */
63 59 private static function maybe_redirect_to_views_upsell() {
64 60 global $pagenow;
65 -
66 61 if ( 'edit.php' !== $pagenow || 'frm_display' !== FrmAppHelper::simple_get( 'post_type' ) ) {
67 62 return;
68 63 }
69 64
@@ -79,9 +74,8 @@
79 74 /**
80 75 * @since 6.14.1
81 76 *
82 77 * @param array $query_args
83 - *
84 78 * @return array
85 79 */
86 80 private static function add_url_params_to_views_redirect_query_args( $query_args ) {
87 81 $query_args['show_nav'] = FrmAppHelper::simple_get( 'show_nav', 'absint', 0 );
@@ -86,9 +80,8 @@
86 80 private static function add_url_params_to_views_redirect_query_args( $query_args ) {
87 81 $query_args['show_nav'] = FrmAppHelper::simple_get( 'show_nav', 'absint', 0 );
88 82
89 83 $form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 );
90 -
91 84 if ( $form_id ) {
92 85 $query_args['form'] = $form_id;
93 86 }
94 87
@@ -96,10 +89,8 @@
96 89 }
97 90
98 91 /**
99 92 * @since 2.05.07
100 - *
101 - * @return void
102 93 */
103 94 private static function load_manage_entries_hooks() {
104 95 if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
105 96 $menu_name = FrmAppHelper::get_menu_name();
@@ -108,16 +99,14 @@
108 99 add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
109 100 add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
110 101 add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' );
111 102 } else {
112 - 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 );
113 104 }
114 105 }
115 106
116 107 /**
117 108 * Display in Back End.
118 - *
119 - * @return mixed
120 109 */
121 110 public static function route() {
122 111 $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
123 112 FrmAppHelper::include_svg();
@@ -128,15 +117,13 @@
128 117 return self::$action();
129 118
130 119 default:
131 120 do_action( 'frm_entry_action_route', $action );
132 -
133 121 if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
134 122 return;
135 123 }
136 124
137 - self::display_list();
138 - return;
125 + return self::display_list();
139 126 }
140 127 }
141 128
142 129 /**
@@ -143,19 +130,12 @@
143 130 * Prevent the "screen options" tab from showing when
144 131 * editing or creating an entry
145 132 *
146 133 * @since 3.0
147 - *
148 - * @param bool $show_screen Whether to show the screen options tab.
149 - * @param object $screen The current screen object.
150 - *
151 - * @return bool
152 134 */
153 135 public static function remove_screen_options( $show_screen, $screen ) {
154 - $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
155 - $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
156 -
157 - if ( $screen->id === $menu_name . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-entries' ) {
136 + $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
137 + if ( $screen->id == $menu_name . '_page_formidable-entries' ) {
158 138 $show_screen = false;
159 139 }
160 140
161 141 return $show_screen;
@@ -160,13 +140,8 @@
160 140
161 141 return $show_screen;
162 142 }
163 143
164 - /**
165 - * @param array $columns
166 - *
167 - * @return array
168 - */
169 144 public static function manage_columns( $columns ) {
170 145 global $frm_vars;
171 146 $form_id = FrmForm::get_current_form_id();
172 147
@@ -188,9 +163,8 @@
188 163
189 164 $frm_vars['cols'] = $columns;
190 165
191 166 $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
192 -
193 167 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
194 168 add_screen_option(
195 169 'per_page',
196 170 array(
@@ -203,14 +177,8 @@
203 177
204 178 return $columns;
205 179 }
206 180
207 - /**
208 - * @param int|string $form_id
209 - * @param array $columns
210 - *
211 - * @return void
212 - */
213 181 private static function get_columns_for_form( $form_id, &$columns ) {
214 182 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
215 183
216 184 /**
@@ -228,9 +196,8 @@
228 196 continue;
229 197 }
230 198
231 199 $has_child_fields = $form_col->type === 'form' && ! empty( $form_col->field_options['form_select'] );
232 -
233 200 if ( $has_child_fields ) {
234 201 self::add_subform_cols( $form_col, $form_id, $columns );
235 202 } else {
236 203 self::add_field_cols( $form_col, $form_id, $columns );
@@ -239,18 +206,11 @@
239 206 }
240 207
241 208 /**
242 209 * @since 3.01
243 - *
244 - * @param object $field The field object.
245 - * @param int|string $form_id The form ID.
246 - * @param array $columns The columns array.
247 - *
248 - * @return void
249 210 */
250 211 private static function add_subform_cols( $field, $form_id, &$columns ) {
251 212 $sub_form_cols = FrmField::get_all_for_form( $field->field_options['form_select'] );
252 -
253 213 if ( empty( $sub_form_cols ) ) {
254 214 return;
255 215 }
256 216
@@ -265,62 +225,24 @@
265 225 }
266 226
267 227 /**
268 228 * @since 3.01
269 - *
270 - * @param object $field The field object.
271 - * @param int|string $form_id The form ID.
272 - * @param array $columns The columns array.
273 - *
274 - * @return void
275 229 */
276 230 private static function add_field_cols( $field, $form_id, &$columns ) {
277 231 $col_id = $field->field_key;
278 -
279 232 if ( $field->form_id != $form_id ) {
280 233 $col_id .= '-_-form' . $field->form_id;
281 234 }
282 235
283 - $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
284 - $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status';
285 - $include_column_for_sep_val = $has_separate_value && ! $is_post_status;
286 -
287 - if ( $include_column_for_sep_val ) {
288 - $columns[ $form_id . '_frmsep_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val );
236 + $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
237 + $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] === 'post_status';
238 + if ( $has_separate_value && ! $is_post_status ) {
239 + $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
289 240 }
290 241
291 - $columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false );
242 + $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
292 243 }
293 244
294 - /**
295 - * Appends "(Value)" or "(Label)" to the field name if it's an option field that has a separate value/label.
296 - *
297 - * @since 6.25.1
298 - *
299 - * @param object $field
300 - * @param bool $include_column_for_sep_val
301 - * @param bool $is_value
302 - *
303 - * @return string
304 - */
305 - private static function maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, $is_value = true ) {
306 - $field_name = FrmAppHelper::truncate( $field->name, 35 );
307 -
308 - if ( ! $include_column_for_sep_val || ! in_array( $field->type, array( 'select', 'radio', 'checkbox' ), true ) ) {
309 - return $field_name;
310 - }
311 -
312 - $append_text = $is_value ? esc_html__( 'value', 'formidable' ) : esc_html__( 'label', 'formidable' );
313 -
314 - return sprintf( '%s (%s)', $field_name, $append_text );
315 - }
316 -
317 - /**
318 - * @param int|string $form_id The form ID.
319 - * @param array $columns The columns array.
320 - *
321 - * @return void
322 - */
323 245 private static function maybe_add_ip_col( $form_id, &$columns ) {
324 246 if ( FrmAppHelper::ips_saved() ) {
325 247 $columns[ $form_id . '_ip' ] = 'IP';
326 248 }
@@ -325,20 +247,10 @@
325 247 $columns[ $form_id . '_ip' ] = 'IP';
326 248 }
327 249 }
328 250
329 - /**
330 - * @param bool $check The check value.
331 - * @param int $object_id The object ID.
332 - * @param string $meta_key The meta key.
333 - * @param mixed $meta_value The meta value.
334 - * @param mixed $prev_value The previous value.
335 - *
336 - * @return bool
337 - */
338 251 public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
339 252 $this_page_name = self::hidden_column_key();
340 -
341 253 if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
342 254 return $check;
343 255 }
344 256
@@ -354,25 +266,16 @@
354 266 }
355 267
356 268 /**
357 269 * Add hidden columns back from other forms
358 - *
359 - * @param int $meta_id The meta ID.
360 - * @param int $object_id The object ID.
361 - * @param string $meta_key The meta key.
362 - * @param array $meta_value The meta value.
363 - *
364 - * @return void
365 270 */
366 271 public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
367 272 $this_page_name = self::hidden_column_key();
368 -
369 273 if ( $meta_key != $this_page_name ) {
370 274 return;
371 275 }
372 276
373 277 global $frm_vars;
374 -
375 278 if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
376 279 // Don't continue if there's no previous value.
377 280 return;
378 281 }
@@ -396,10 +299,9 @@
396 299 }
397 300
398 301 $form_prefix = explode( '_', $prev_hidden );
399 302 $form_prefix = $form_prefix[0];
400 -
401 - if ( $form_prefix === $cur_form_prefix ) {
303 + if ( $form_prefix == $cur_form_prefix ) {
402 304 // Don't add back columns that are meant to be hidden.
403 305 continue;
404 306 }
405 307
@@ -415,12 +317,8 @@
415 317 }
416 318
417 319 /**
418 320 * @since 2.05.07
419 - *
420 - * @param string $menu_name
421 - *
422 - * @return string
423 321 */
424 322 private static function hidden_column_key( $menu_name = '' ) {
425 323 $base = self::base_column_key( $menu_name );
426 324
@@ -428,12 +326,8 @@
428 326 }
429 327
430 328 /**
431 329 * @since 2.05.07
432 - *
433 - * @param string $menu_name
434 - *
435 - * @return string
436 330 */
437 331 private static function base_column_key( $menu_name = '' ) {
438 332 if ( empty( $menu_name ) ) {
439 333 $menu_name = FrmAppHelper::get_menu_name();
@@ -438,20 +332,11 @@
438 332 if ( empty( $menu_name ) ) {
439 333 $menu_name = FrmAppHelper::get_menu_name();
440 334 }
441 335
442 - $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
443 -
444 - return sanitize_title( $menu_name ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-entries';
336 + return sanitize_title( $menu_name ) . '_page_formidable-entries';
445 337 }
446 338
447 - /**
448 - * @param int $save
449 - * @param string $option
450 - * @param string $value
451 - *
452 - * @return int
453 - */
454 339 public static function save_per_page( $save, $option, $value ) {
455 340 if ( $option === 'formidable_page_formidable_entries_per_page' ) {
456 341 $save = (int) $value;
457 342 }
@@ -458,11 +343,8 @@
458 343
459 344 return $save;
460 345 }
461 346
462 - /**
463 - * @return array
464 - */
465 347 public static function sortable_columns() {
466 348 $form_id = FrmForm::get_current_form_id();
467 349 $fields = FrmField::get_all_for_form( $form_id );
468 350
@@ -494,9 +376,8 @@
494 376 * Can't sort on checkboxes because they are sorted serialized.
495 377 * Some post content can be sorted but not everything.
496 378 *
497 379 * @param stdClass $field
498 - *
499 380 * @return bool
500 381 */
501 382 private static function field_supports_sorting( $field ) {
502 383 $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
@@ -504,14 +385,11 @@
504 385 }
505 386
506 387 /**
507 388 * @param mixed $result Option value from database for hidden columns in entries table.
508 - *
509 389 * @return array
510 390 */
511 391 public static function hidden_columns( $result ) {
512 - global $frm_vars;
513 -
514 392 if ( ! is_array( $result ) ) {
515 393 // Force an unexpected value to be an array.
516 394 // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
517 395 // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
@@ -517,16 +395,21 @@
517 395 // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
518 396 $result = array();
519 397 }
520 398
521 - $form_id = FrmForm::get_current_form_id();
522 - $hidden = self::user_hidden_columns_for_form( $form_id, $result );
523 - $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
524 - $max_columns = 11;
399 + $form_id = FrmForm::get_current_form_id();
525 400
401 + $hidden = self::user_hidden_columns_for_form( $form_id, $result );
402 +
403 + global $frm_vars;
404 + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
405 +
526 406 if ( ! empty( $hidden ) ) {
527 - $result = $hidden;
528 - $i = $i - count( $result );
407 + $result = $hidden;
408 + $i = $i - count( $result );
409 + $max_columns = 11;
410 + } else {
411 + $max_columns = 8;
529 412 }
530 413
531 414 if ( $i <= $max_columns ) {
532 415 return $result;
@@ -538,17 +421,11 @@
538 421 }
539 422
540 423 /**
541 424 * @since 2.05.07
542 - *
543 - * @param int|string $form_id
544 - * @param mixed $result
545 - *
546 - * @return array
547 425 */
548 426 private static function user_hidden_columns_for_form( $form_id, $result ) {
549 427 $hidden = array();
550 -
551 428 foreach ( (array) $result as $r ) {
552 429 if ( ! empty( $r ) ) {
553 430 list( $form_prefix, $field_key ) = explode( '_', $r );
554 431
@@ -566,13 +443,8 @@
566 443 /**
567 444 * Remove some columns by default when there are too many
568 445 *
569 446 * @since 2.05.07
570 - *
571 - * @param array $atts
572 - * @param array $result
573 - *
574 - * @return void
575 447 */
576 448 private static function remove_excess_cols( $atts, &$result ) {
577 449 global $frm_vars;
578 450
@@ -597,14 +469,8 @@
597 469 unset( $col_key, $col );
598 470 }
599 471 }
600 472
601 - /**
602 - * @param string $message
603 - * @param array $errors
604 - *
605 - * @return void
606 - */
607 473 public static function display_list( $message = '', $errors = array() ) {
608 474 global $wpdb, $frm_vars;
609 475
610 476 $form = FrmForm::maybe_get_current_form();
@@ -625,12 +491,10 @@
625 491
626 492 $wp_list_table->prepare_items();
627 493
628 494 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
629 -
630 495 if ( $pagenum > $total_pages && $total_pages > 0 ) {
631 496 $url = add_query_arg( 'paged', $total_pages );
632 -
633 497 if ( headers_sent() ) {
634 498 FrmAppHelper::js_redirect( $url, true );
635 499 } else {
636 500 wp_redirect( esc_url_raw( $url ) );
@@ -644,18 +508,12 @@
644 508
645 509 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
646 510 }
647 511
648 - /**
649 - * @param object $form
650 - * @param array $errors
651 - *
652 - * @return void
653 - */
654 512 private static function get_delete_form_time( $form, &$errors ) {
655 513 if ( 'trash' === $form->status ) {
656 514 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
657 - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( $form->options['trash_time'] ?? time() ) );
515 + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? $form->options['trash_time'] : time() ) );
658 516
659 517 /* translators: %1$s: Time string */
660 518 $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 );
661 519 }
@@ -662,12 +520,8 @@
662 520 }
663 521
664 522 /**
665 523 * Back End CRUD.
666 - *
667 - * @param int $id
668 - *
669 - * @return void
670 524 */
671 525 public static function show( $id = 0 ) {
672 526 FrmAppHelper::permission_check( 'frm_view_entries' );
673 527
@@ -679,9 +533,8 @@
679 533 }
680 534 }
681 535
682 536 $entry = FrmEntry::getOne( $id, true );
683 -
684 537 if ( ! $entry ) {
685 538 FrmAppController::show_error_modal(
686 539 array(
687 540 'title' => __( 'You can\'t view the entry', 'formidable' ),
@@ -692,9 +545,8 @@
692 545 return;
693 546 }
694 547
695 548 $data = $entry->description;
696 -
697 549 if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
698 550 $data = array( 'referrer' => $data );
699 551 }
700 552
@@ -711,9 +563,8 @@
711 563 * @return void
712 564 */
713 565 public static function destroy() {
714 566 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
715 -
716 567 if ( false !== $permission_error ) {
717 568 $error_args = array(
718 569 'title' => __( 'Verification failed', 'formidable' ),
719 570 'body' => $permission_error,
@@ -729,9 +580,8 @@
729 580 self::unlink_post( $params['id'] );
730 581 }
731 582
732 583 $message = '';
733 -
734 584 if ( FrmEntry::destroy( $params['id'] ) ) {
735 585 $message = __( 'Entry was successfully deleted', 'formidable' );
736 586 }
737 587
@@ -737,17 +587,10 @@
737 587
738 588 self::display_list( $message );
739 589 }
740 590
741 - /**
742 - * @param array|string $errors
743 - * @param bool $ajax
744 - *
745 - * @return void
746 - */
747 591 public static function process_entry( $errors = '', $ajax = false ) {
748 592 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
749 -
750 593 if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
751 594 return;
752 595 }
753 596
@@ -753,19 +596,12 @@
753 596
754 597 global $frm_vars;
755 598
756 599 $form = FrmForm::getOne( $form_id );
757 -
758 600 if ( ! $form ) {
759 601 return;
760 602 }
761 603
762 - $is_preview = 'frm_forms_preview' === FrmAppHelper::simple_get( 'action' );
763 -
764 - if ( $is_preview && FrmFormsHelper::should_block_preview( $form->form_key ) ) {
765 - return;
766 - }
767 -
768 604 $params = FrmForm::get_params( $form );
769 605
770 606 if ( ! isset( $frm_vars['form_params'] ) ) {
771 607 $frm_vars['form_params'] = array();
@@ -792,9 +628,8 @@
792 628
793 629 if ( empty( $errors ) ) {
794 630 $_POST['frm_skip_cookie'] = 1;
795 631 $do_success = false;
796 -
797 632 if ( $params['action'] === 'create' ) {
798 633 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
799 634 $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
800 635
@@ -803,9 +638,8 @@
803 638 }
804 639 }
805 640
806 641 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
807 -
808 642 if ( $do_success ) {
809 643 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
810 644 }
811 645 unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -824,17 +658,8 @@
824 658 public static function prepare_redirect_url( $url ) {
825 659 return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
826 660 }
827 661
828 - /**
829 - * Delete entry if redirected.
830 - *
831 - * @param string $url
832 - * @param object $form
833 - * @param array $atts
834 - *
835 - * @return string
836 - */
837 662 public static function delete_entry_before_redirect( $url, $form, $atts ) {
838 663 self::_delete_entry( $atts['id'], $form );
839 664
840 665 return $url;
@@ -843,23 +668,13 @@
843 668 /**
844 669 * Delete entry if not redirected.
845 670 *
846 671 * @param array $atts
847 - *
848 - * @return void
849 672 */
850 673 public static function delete_entry_after_save( $atts ) {
851 674 self::_delete_entry( $atts['entry_id'], $atts['form'] );
852 675 }
853 676
854 - /**
855 - * Delete entry if not redirected.
856 - *
857 - * @param int $entry_id
858 - * @param object $form
859 - *
860 - * @return void
861 - */
862 677 private static function _delete_entry( $entry_id, $form ) {
863 678 if ( ! $form ) {
864 679 return;
865 680 }
@@ -864,9 +679,8 @@
864 679 return;
865 680 }
866 681
867 682 FrmAppHelper::unserialize_or_decode( $form->options );
868 -
869 683 if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
870 684 self::unlink_post( $entry_id );
871 685 FrmEntry::destroy( $entry_id );
872 686 }
@@ -873,12 +687,8 @@
873 687 }
874 688
875 689 /**
876 690 * Unlink entry from post
877 - *
878 - * @param int $entry_id
879 - *
880 - * @return void
881 691 */
882 692 private static function unlink_post( $entry_id ) {
883 693 global $wpdb;
884 694 $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $entry_id ) );
@@ -914,9 +724,8 @@
914 724 'exclude_fields' => '',
915 725 'include_fields' => '',
916 726 'include_extras' => '',
917 727 'inline_style' => 1,
918 - 'table_style' => '',
919 728 // Return embedded fields as nested array.
920 729 'child_array' => false,
921 730 'line_breaks' => true,
922 731 'array_separator' => ', ',
@@ -943,13 +752,8 @@
943 752
944 753 return $formatted_entry;
945 754 }
946 755
947 - /**
948 - * @param false|object $entry
949 - *
950 - * @return void
951 - */
952 756 public static function entry_sidebar( $entry = false ) {
953 757 $data = array();
954 758 $id = 0;
955 759
@@ -958,9 +762,8 @@
958 762
959 763 if ( $entry ) {
960 764 $id = $entry->id;
961 765 $data = $entry->description;
962 -
963 766 if ( isset( $data['browser'] ) ) {
964 767 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
965 768 }
966 769 /**