PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8.2
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
formidable / classes / controllers / FrmEntriesController.php

FrmEntriesController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.8.2, at classes/controllers/FrmEntriesController.php

722 lines 20.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmEntriesController {
7
8 public static function menu() {
9 FrmAppHelper::force_capability( 'frm_view_entries' );
10
11 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
12
13 $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
14 if ( ! $views_installed ) {
15 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
16 }
17
18 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
19 self::load_manage_entries_hooks();
20 }
21 }
22
23 /**
24 * @since 2.05.07
25 */
26 private static function load_manage_entries_hooks() {
27 if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
28 $menu_name = FrmAppHelper::get_menu_name();
29 $base = self::base_column_key( $menu_name );
30
31 add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
32 add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
33 add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' );
34 } else {
35 add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
36 }
37 }
38
39 /**
40 * Display in Back End.
41 */
42 public static function route() {
43 $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
44 FrmAppHelper::include_svg();
45
46 switch ( $action ) {
47 case 'show':
48 case 'destroy':
49 return self::$action();
50
51 default:
52 do_action( 'frm_entry_action_route', $action );
53 if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
54 return;
55 }
56
57 return self::display_list();
58 }
59 }
60
61 /**
62 * Prevent the "screen options" tab from showing when
63 * editing or creating an entry
64 *
65 * @since 3.0
66 */
67 public static function remove_screen_options( $show_screen, $screen ) {
68 $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
69 if ( $screen->id == $menu_name . '_page_formidable-entries' ) {
70 $show_screen = false;
71 }
72
73 return $show_screen;
74 }
75
76 public static function manage_columns( $columns ) {
77 global $frm_vars;
78 $form_id = FrmForm::get_current_form_id();
79
80 $columns[ $form_id . '_id' ] = 'ID';
81 $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
82
83 if ( $form_id ) {
84 self::get_columns_for_form( $form_id, $columns );
85 } else {
86 $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' );
87 $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' );
88 $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' );
89 }
90
91 $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' );
92 $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
93 $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
94 self::maybe_add_ip_col( $form_id, $columns );
95
96 $frm_vars['cols'] = $columns;
97
98 $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
99 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
100 add_screen_option(
101 'per_page',
102 array(
103 'label' => esc_html__( 'Entries', 'formidable' ),
104 'default' => 20,
105 'option' => 'formidable_page_formidable_entries_per_page',
106 )
107 );
108 }
109
110 return $columns;
111 }
112
113 private static function get_columns_for_form( $form_id, &$columns ) {
114 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
115
116 /**
117 * Allows changing fields in the Entries list table heading.
118 *
119 * @since 5.0.04
120 *
121 * @param array $fields Array of fields.
122 * @param array $args The arguments. Contains `form_id`.
123 */
124 $form_cols = apply_filters( 'frm_fields_in_entries_list_table', $form_cols, compact( 'form_id' ) );
125
126 foreach ( $form_cols as $form_col ) {
127 if ( FrmField::is_no_save_field( $form_col->type ) ) {
128 continue;
129 }
130
131 $has_child_fields = $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] );
132 if ( $has_child_fields ) {
133 self::add_subform_cols( $form_col, $form_id, $columns );
134 } else {
135 self::add_field_cols( $form_col, $form_id, $columns );
136 }
137 }
138 }
139
140 /**
141 * @since 3.01
142 */
143 private static function add_subform_cols( $field, $form_id, &$columns ) {
144 $sub_form_cols = FrmField::get_all_for_form( $field->field_options['form_select'] );
145 if ( empty( $sub_form_cols ) ) {
146 return;
147 }
148
149 foreach ( $sub_form_cols as $k => $sub_form_col ) {
150 if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
151 unset( $sub_form_cols[ $k ] );
152 continue;
153 }
154 $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
155 unset( $sub_form_col );
156 }
157 }
158
159 /**
160 * @since 3.01
161 */
162 private static function add_field_cols( $field, $form_id, &$columns ) {
163 $col_id = $field->field_key;
164 if ( $field->form_id != $form_id ) {
165 $col_id .= '-_-form' . $field->form_id;
166 }
167
168 $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
169 $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status';
170 if ( $has_separate_value && ! $is_post_status ) {
171 $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
172 }
173
174 $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
175 }
176
177 private static function maybe_add_ip_col( $form_id, &$columns ) {
178 if ( FrmAppHelper::ips_saved() ) {
179 $columns[ $form_id . '_ip' ] = 'IP';
180 }
181 }
182
183 public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
184 $this_page_name = self::hidden_column_key();
185 if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
186 return $check;
187 }
188
189 if ( empty( $prev_value ) ) {
190 $prev_value = get_metadata( 'user', $object_id, $meta_key, true );
191 }
192
193 global $frm_vars;
194 // Add a check so we don't create a loop.
195 $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
196
197 return $check;
198 }
199
200 /**
201 * Add hidden columns back from other forms
202 */
203 public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
204 $this_page_name = self::hidden_column_key();
205 if ( $meta_key != $this_page_name ) {
206 return;
207 }
208
209 global $frm_vars;
210 if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
211 // Don't continue if there's no previous value.
212 return;
213 }
214
215 foreach ( $meta_value as $mk => $mv ) {
216 // Remove blank values.
217 if ( empty( $mv ) ) {
218 unset( $meta_value[ $mk ] );
219 }
220 }
221
222 $cur_form_prefix = reset( $meta_value );
223 $cur_form_prefix = explode( '_', $cur_form_prefix );
224 $cur_form_prefix = $cur_form_prefix[0];
225 $save = false;
226
227 foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
228 if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
229 // Don't add blank cols or process included cols.
230 continue;
231 }
232
233 $form_prefix = explode( '_', $prev_hidden );
234 $form_prefix = $form_prefix[0];
235 if ( $form_prefix == $cur_form_prefix ) {
236 // Don't add back columns that are meant to be hidden.
237 continue;
238 }
239
240 $meta_value[] = $prev_hidden;
241 $save = true;
242 unset( $form_prefix );
243 }
244
245 if ( $save ) {
246 $user_id = get_current_user_id();
247 update_user_option( $user_id, $this_page_name, $meta_value, true );
248 }
249 }
250
251 /**
252 * @since 2.05.07
253 */
254 private static function hidden_column_key( $menu_name = '' ) {
255 $base = self::base_column_key( $menu_name );
256
257 return 'manage' . $base . 'columnshidden';
258 }
259
260 /**
261 * @since 2.05.07
262 */
263 private static function base_column_key( $menu_name = '' ) {
264 if ( empty( $menu_name ) ) {
265 $menu_name = FrmAppHelper::get_menu_name();
266 }
267
268 return sanitize_title( $menu_name ) . '_page_formidable-entries';
269 }
270
271 public static function save_per_page( $save, $option, $value ) {
272 if ( $option == 'formidable_page_formidable_entries_per_page' ) {
273 $save = (int) $value;
274 }
275
276 return $save;
277 }
278
279 public static function sortable_columns() {
280 $form_id = FrmForm::get_current_form_id();
281 $fields = FrmField::get_all_for_form( $form_id );
282
283 $columns = array(
284 $form_id . '_id' => 'id',
285 $form_id . '_created_at' => 'created_at',
286 $form_id . '_updated_at' => 'updated_at',
287 $form_id . '_ip' => 'ip',
288 $form_id . '_item_key' => 'item_key',
289 $form_id . '_is_draft' => 'is_draft',
290 );
291
292 foreach ( $fields as $field ) {
293 if ( self::field_supports_sorting( $field ) ) {
294 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
295 }
296 }
297
298 return $columns;
299 }
300
301 /**
302 * Can't sort on checkboxes because they are sorted serialized.
303 * Some post content can be sorted but not everything.
304 *
305 * @param stdClass $field
306 * @return bool
307 */
308 private static function field_supports_sorting( $field ) {
309 $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
310 return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field );
311 }
312
313 /**
314 * @param mixed $result Option value from database for hidden columns in entries table.
315 * @return array
316 */
317 public static function hidden_columns( $result ) {
318 if ( ! is_array( $result ) ) {
319 // Force an unexpected value to be an array.
320 // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
321 // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
322 $result = array();
323 }
324
325 $form_id = FrmForm::get_current_form_id();
326
327 $hidden = self::user_hidden_columns_for_form( $form_id, $result );
328
329 global $frm_vars;
330 $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
331
332 if ( ! empty( $hidden ) ) {
333 $result = $hidden;
334 $i = $i - count( $result );
335 $max_columns = 11;
336 } else {
337 $max_columns = 8;
338 }
339
340 if ( $i <= $max_columns ) {
341 return $result;
342 }
343
344 self::remove_excess_cols( compact( 'i', 'max_columns', 'form_id' ), $result );
345
346 return $result;
347 }
348
349 /**
350 * @since 2.05.07
351 */
352 private static function user_hidden_columns_for_form( $form_id, $result ) {
353 $hidden = array();
354 foreach ( (array) $result as $r ) {
355 if ( ! empty( $r ) ) {
356 list( $form_prefix, $field_key ) = explode( '_', $r );
357
358 if ( (int) $form_prefix == (int) $form_id ) {
359 $hidden[] = $r;
360 }
361
362 unset( $form_prefix );
363 }
364 }
365
366 return $hidden;
367 }
368
369 /**
370 * Remove some columns by default when there are too many
371 *
372 * @since 2.05.07
373 */
374 private static function remove_excess_cols( $atts, &$result ) {
375 global $frm_vars;
376
377 $remove_first = array(
378 $atts['form_id'] . '_item_key' => '',
379 $atts['form_id'] . '_id' => '',
380 );
381 $cols = $remove_first + array_reverse( $frm_vars['cols'], true );
382
383 $i = $atts['i'];
384
385 foreach ( $cols as $col_key => $col ) {
386 if ( $i <= $atts['max_columns'] ) {
387 break;
388 }
389
390 if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
391 $result[] = $col_key;
392 $i--;
393 }
394
395 unset( $col_key, $col );
396 }
397 }
398
399 public static function display_list( $message = '', $errors = array() ) {
400 global $wpdb, $frm_vars;
401
402 $form = FrmForm::maybe_get_current_form();
403 $params = FrmForm::get_admin_params( $form );
404
405 if ( $form ) {
406 $params['form'] = $form->id;
407 $frm_vars['current_form'] = $form;
408
409 self::get_delete_form_time( $form, $errors );
410 }
411
412 $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
413
414 $wp_list_table = new $table_class( array( 'params' => $params ) );
415
416 $pagenum = $wp_list_table->get_pagenum();
417
418 $wp_list_table->prepare_items();
419
420 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
421 if ( $pagenum > $total_pages && $total_pages > 0 ) {
422 $url = add_query_arg( 'paged', $total_pages );
423 if ( headers_sent() ) {
424 FrmAppHelper::js_redirect( $url, true );
425 } else {
426 wp_redirect( esc_url_raw( $url ) );
427 }
428 die();
429 }
430
431 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
432 $message = __( 'Your import is complete', 'formidable' );
433 }
434
435 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
436 }
437
438 private static function get_delete_form_time( $form, &$errors ) {
439 if ( 'trash' == $form->status ) {
440 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
441 $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
442
443 /* translators: %1$s: Time string */
444 $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 );
445 }
446 }
447
448 /**
449 * Back End CRUD.
450 */
451 public static function show( $id = 0 ) {
452 FrmAppHelper::permission_check( 'frm_view_entries' );
453
454 if ( ! $id ) {
455 $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
456
457 if ( ! $id ) {
458 $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
459 }
460 }
461
462 $entry = FrmEntry::getOne( $id, true );
463 if ( ! $entry ) {
464 echo '<div id="form_show_entry_page" class="wrap">' .
465 esc_html__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
466 '</div>';
467
468 return;
469 }
470
471 $data = $entry->description;
472 if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
473 $data = array( 'referrer' => $data );
474 }
475
476 $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
477 $form = FrmForm::getOne( $entry->form_id );
478
479 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
480 }
481
482 /**
483 * Destroy an entry from the admin page.
484 * This is triggered from the entries list from the "Delete" row action, and also from the "Delete Entry" trigger in the view/edit entry sidebar.
485 *
486 * @return void
487 */
488 public static function destroy() {
489 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
490 if ( false !== $permission_error ) {
491 $error_args = array(
492 'title' => __( 'Verification failed', 'formidable' ),
493 'body' => $permission_error,
494 'cancel_url' => admin_url( 'admin.php?page=formidable-entries' ),
495 );
496 FrmAppController::show_error_modal( $error_args );
497 return;
498 }
499
500 $params = FrmForm::get_admin_params();
501
502 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
503 self::unlink_post( $params['id'] );
504 }
505
506 $message = '';
507 if ( FrmEntry::destroy( $params['id'] ) ) {
508 $message = __( 'Entry was successfully deleted', 'formidable' );
509 }
510
511 self::display_list( $message );
512 }
513
514 /**
515 * @deprecated 4.02.04 - Moved to Pro since it was unused in Lite.
516 */
517 public static function destroy_all() {
518 _deprecated_function( __METHOD__, '4.02.04', 'FrmProEntriesController::destroy_all' );
519 if ( is_callable( 'FrmProEntriesController::destroy_all' ) ) {
520 FrmProEntriesController::destroy_all();
521 }
522 }
523
524 public static function process_entry( $errors = '', $ajax = false ) {
525 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
526 if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
527 return;
528 }
529
530 global $frm_vars;
531
532 $form = FrmForm::getOne( $form_id );
533 if ( ! $form ) {
534 return;
535 }
536
537 $params = FrmForm::get_params( $form );
538
539 if ( ! isset( $frm_vars['form_params'] ) ) {
540 $frm_vars['form_params'] = array();
541 }
542 $frm_vars['form_params'][ $form->id ] = $params;
543
544 if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
545 return;
546 }
547
548 if ( $errors == '' && ! $ajax ) {
549 $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
550 }
551
552 /**
553 * Use this filter to add trigger actions and add errors after
554 * all other errors have been processed
555 *
556 * @since 2.0.6
557 */
558 $errors = apply_filters( 'frm_entries_before_create', $errors, $form );
559
560 $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
561
562 if ( empty( $errors ) ) {
563 $_POST['frm_skip_cookie'] = 1;
564 $do_success = false;
565 if ( $params['action'] === 'create' ) {
566 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
567 $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
568
569 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
570 $do_success = true;
571 }
572 }
573
574 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
575 if ( $do_success ) {
576 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
577 }
578 unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
579 }
580 }
581
582 /**
583 * Escape url entities before redirect
584 *
585 * @since 3.0
586 *
587 * @param string $url
588 *
589 * @return string
590 */
591 public static function prepare_redirect_url( $url ) {
592 return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
593 }
594
595 public static function delete_entry_before_redirect( $url, $form, $atts ) {
596 self::_delete_entry( $atts['id'], $form );
597
598 return $url;
599 }
600
601 /**
602 * Delete entry if not redirected.
603 *
604 * @param array $atts
605 */
606 public static function delete_entry_after_save( $atts ) {
607 self::_delete_entry( $atts['entry_id'], $atts['form'] );
608 }
609
610 private static function _delete_entry( $entry_id, $form ) {
611 if ( ! $form ) {
612 return;
613 }
614
615 FrmAppHelper::unserialize_or_decode( $form->options );
616 if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
617 self::unlink_post( $entry_id );
618 FrmEntry::destroy( $entry_id );
619 }
620 }
621
622 /**
623 * Unlink entry from post
624 */
625 private static function unlink_post( $entry_id ) {
626 global $wpdb;
627 $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $entry_id ) );
628 FrmEntry::clear_cache();
629 }
630
631 /**
632 * @param array $atts
633 *
634 * @return array|string
635 */
636 public static function show_entry_shortcode( $atts ) {
637 $defaults = array(
638 'id' => false,
639 'entry' => false,
640 'fields' => false,
641 'plain_text' => false,
642 'user_info' => false,
643 'include_blank' => false,
644 'default_email' => false,
645 'form_id' => false,
646 'format' => 'text',
647 'array_key' => 'key',
648 'direction' => 'ltr',
649 'font_size' => '',
650 'text_color' => '',
651 'border_width' => '',
652 'border_color' => '',
653 'bg_color' => '',
654 'alt_bg_color' => '',
655 'class' => '',
656 'clickable' => false,
657 'exclude_fields' => '',
658 'include_fields' => '',
659 'include_extras' => '',
660 'inline_style' => 1,
661 // Return embedded fields as nested array.
662 'child_array' => false,
663 'line_breaks' => true,
664 'array_separator' => ', ',
665 );
666 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
667
668 $atts = shortcode_atts( $defaults, $atts );
669
670 if ( $atts['default_email'] ) {
671 $shortcode_atts = array(
672 'format' => $atts['format'],
673 'plain_text' => $atts['plain_text'],
674 );
675
676 $entry_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
677 $formatted_entry = $entry_formatter->content();
678
679 } else {
680
681 $entry_formatter = FrmEntryFactory::entry_formatter_instance( $atts );
682 $formatted_entry = $entry_formatter->get_formatted_entry_values();
683
684 }
685
686 return $formatted_entry;
687 }
688
689 public static function entry_sidebar( $entry = false ) {
690 $data = array();
691 $id = 0;
692
693 $date_format = get_option( 'date_format' );
694 $time_format = get_option( 'time_format' );
695
696 if ( $entry ) {
697 $id = $entry->id;
698 $data = $entry->description;
699 if ( isset( $data['browser'] ) ) {
700 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
701 }
702 /**
703 * Add or remove information in the entry sidebar.
704 *
705 * @since 5.5.2
706 * @param array $data
707 */
708 $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
709 }
710
711 include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
712 }
713
714 /**
715 * @deprecated 4.0
716 */
717 public static function contextual_help( $help, $screen_id, $screen ) {
718 _deprecated_function( __METHOD__, '4.0' );
719 return $help;
720 }
721 }
722