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

713 lines 20.4 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' && ! 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'] = ! empty( $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 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
298 foreach ( $fields as $field ) {
299 if ( self::field_supports_sorting( $field ) ) {
300 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
301 }
302 }
303
304 return $columns;
305 }
306
307 /**
308 * Can't sort on checkboxes because they are sorted serialized.
309 * Some post content can be sorted but not everything.
310 *
311 * @param stdClass $field
312 * @return bool
313 */
314 private static function field_supports_sorting( $field ) {
315 $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
316 return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field );
317 }
318
319 /**
320 * @param mixed $result Option value from database for hidden columns in entries table.
321 * @return array
322 */
323 public static function hidden_columns( $result ) {
324 if ( ! is_array( $result ) ) {
325 // Force an unexpected value to be an array.
326 // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
327 // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
328 $result = array();
329 }
330
331 $form_id = FrmForm::get_current_form_id();
332
333 $hidden = self::user_hidden_columns_for_form( $form_id, $result );
334
335 global $frm_vars;
336 $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
337
338 if ( ! empty( $hidden ) ) {
339 $result = $hidden;
340 $i = $i - count( $result );
341 $max_columns = 11;
342 } else {
343 $max_columns = 8;
344 }
345
346 if ( $i <= $max_columns ) {
347 return $result;
348 }
349
350 self::remove_excess_cols( compact( 'i', 'max_columns', 'form_id' ), $result );
351
352 return $result;
353 }
354
355 /**
356 * @since 2.05.07
357 */
358 private static function user_hidden_columns_for_form( $form_id, $result ) {
359 $hidden = array();
360 foreach ( (array) $result as $r ) {
361 if ( ! empty( $r ) ) {
362 list( $form_prefix, $field_key ) = explode( '_', $r );
363
364 if ( (int) $form_prefix === (int) $form_id ) {
365 $hidden[] = $r;
366 }
367
368 unset( $form_prefix );
369 }
370 }
371
372 return $hidden;
373 }
374
375 /**
376 * Remove some columns by default when there are too many
377 *
378 * @since 2.05.07
379 */
380 private static function remove_excess_cols( $atts, &$result ) {
381 global $frm_vars;
382
383 $remove_first = array(
384 $atts['form_id'] . '_item_key' => '',
385 $atts['form_id'] . '_id' => '',
386 );
387 $cols = $remove_first + array_reverse( $frm_vars['cols'], true );
388
389 $i = $atts['i'];
390
391 foreach ( $cols as $col_key => $col ) {
392 if ( $i <= $atts['max_columns'] ) {
393 break;
394 }
395
396 if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
397 $result[] = $col_key;
398 --$i;
399 }
400
401 unset( $col_key, $col );
402 }
403 }
404
405 public static function display_list( $message = '', $errors = array() ) {
406 global $wpdb, $frm_vars;
407
408 $form = FrmForm::maybe_get_current_form();
409 $params = FrmForm::get_admin_params( $form );
410
411 if ( $form ) {
412 $params['form'] = $form->id;
413 $frm_vars['current_form'] = $form;
414
415 self::get_delete_form_time( $form, $errors );
416 }
417
418 $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
419
420 $wp_list_table = new $table_class( array( 'params' => $params ) );
421
422 $pagenum = $wp_list_table->get_pagenum();
423
424 $wp_list_table->prepare_items();
425
426 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
427 if ( $pagenum > $total_pages && $total_pages > 0 ) {
428 $url = add_query_arg( 'paged', $total_pages );
429 if ( headers_sent() ) {
430 FrmAppHelper::js_redirect( $url, true );
431 } else {
432 wp_redirect( esc_url_raw( $url ) );
433 }
434 die();
435 }
436
437 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
438 $message = __( 'Your import is complete', 'formidable' );
439 }
440
441 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
442 }
443
444 private static function get_delete_form_time( $form, &$errors ) {
445 if ( 'trash' === $form->status ) {
446 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
447 $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? $form->options['trash_time'] : time() ) );
448
449 /* translators: %1$s: Time string */
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 );
451 }
452 }
453
454 /**
455 * Back End CRUD.
456 */
457 public static function show( $id = 0 ) {
458 FrmAppHelper::permission_check( 'frm_view_entries' );
459
460 if ( ! $id ) {
461 $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
462
463 if ( ! $id ) {
464 $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
465 }
466 }
467
468 $entry = FrmEntry::getOne( $id, true );
469 if ( ! $entry ) {
470 FrmAppController::show_error_modal(
471 array(
472 'title' => __( 'You can\'t view the entry', 'formidable' ),
473 'body' => __( 'You are trying to view an entry that does not exist', 'formidable' ),
474 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
475 )
476 );
477 return;
478 }
479
480 $data = $entry->description;
481 if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
482 $data = array( 'referrer' => $data );
483 }
484
485 $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
486 $form = FrmForm::getOne( $entry->form_id );
487
488 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php';
489 }
490
491 /**
492 * Destroy an entry from the admin page.
493 * 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.
494 *
495 * @return void
496 */
497 public static function destroy() {
498 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
499 if ( false !== $permission_error ) {
500 $error_args = array(
501 'title' => __( 'Verification failed', 'formidable' ),
502 'body' => $permission_error,
503 'cancel_url' => admin_url( 'admin.php?page=formidable-entries' ),
504 );
505 FrmAppController::show_error_modal( $error_args );
506 return;
507 }
508
509 $params = FrmForm::get_admin_params();
510
511 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
512 self::unlink_post( $params['id'] );
513 }
514
515 $message = '';
516 if ( FrmEntry::destroy( $params['id'] ) ) {
517 $message = __( 'Entry was successfully deleted', 'formidable' );
518 }
519
520 self::display_list( $message );
521 }
522
523 public static function process_entry( $errors = '', $ajax = false ) {
524 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
525 if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
526 return;
527 }
528
529 global $frm_vars;
530
531 $form = FrmForm::getOne( $form_id );
532 if ( ! $form ) {
533 return;
534 }
535
536 $params = FrmForm::get_params( $form );
537
538 if ( ! isset( $frm_vars['form_params'] ) ) {
539 $frm_vars['form_params'] = array();
540 }
541 $frm_vars['form_params'][ $form->id ] = $params;
542
543 if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
544 return;
545 }
546
547 if ( $errors == '' && ! $ajax ) {
548 $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
549 }
550
551 /**
552 * Use this filter to add trigger actions and add errors after
553 * all other errors have been processed
554 *
555 * @since 2.0.6
556 */
557 $errors = apply_filters( 'frm_entries_before_create', $errors, $form );
558
559 $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
560
561 if ( empty( $errors ) ) {
562 $_POST['frm_skip_cookie'] = 1;
563 $do_success = false;
564 if ( $params['action'] === 'create' ) {
565 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
566 $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
567
568 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
569 $do_success = true;
570 }
571 }
572
573 do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
574 if ( $do_success ) {
575 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
576 }
577 unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
578 }
579 }
580
581 /**
582 * Escape url entities before redirect
583 *
584 * @since 3.0
585 *
586 * @param string $url
587 *
588 * @return string
589 */
590 public static function prepare_redirect_url( $url ) {
591 return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
592 }
593
594 public static function delete_entry_before_redirect( $url, $form, $atts ) {
595 self::_delete_entry( $atts['id'], $form );
596
597 return $url;
598 }
599
600 /**
601 * Delete entry if not redirected.
602 *
603 * @param array $atts
604 */
605 public static function delete_entry_after_save( $atts ) {
606 self::_delete_entry( $atts['entry_id'], $atts['form'] );
607 }
608
609 private static function _delete_entry( $entry_id, $form ) {
610 if ( ! $form ) {
611 return;
612 }
613
614 FrmAppHelper::unserialize_or_decode( $form->options );
615 if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
616 self::unlink_post( $entry_id );
617 FrmEntry::destroy( $entry_id );
618 }
619 }
620
621 /**
622 * Unlink entry from post
623 */
624 private static function unlink_post( $entry_id ) {
625 global $wpdb;
626 $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $entry_id ) );
627 FrmEntry::clear_cache();
628 }
629
630 /**
631 * @param array $atts
632 *
633 * @return array|string
634 */
635 public static function show_entry_shortcode( $atts ) {
636 $defaults = array(
637 'id' => false,
638 'entry' => false,
639 'fields' => false,
640 'plain_text' => false,
641 'user_info' => false,
642 'include_blank' => false,
643 'default_email' => false,
644 'form_id' => false,
645 'format' => 'text',
646 'array_key' => 'key',
647 'direction' => 'ltr',
648 'font_size' => '',
649 'text_color' => '',
650 'border_width' => '',
651 'border_color' => '',
652 'bg_color' => '',
653 'alt_bg_color' => '',
654 'class' => '',
655 'clickable' => false,
656 'exclude_fields' => '',
657 'include_fields' => '',
658 'include_extras' => '',
659 'inline_style' => 1,
660 // Return embedded fields as nested array.
661 'child_array' => false,
662 'line_breaks' => true,
663 'array_separator' => ', ',
664 );
665 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
666
667 $atts = shortcode_atts( $defaults, $atts );
668
669 if ( $atts['default_email'] ) {
670 $shortcode_atts = array(
671 'format' => $atts['format'],
672 'plain_text' => $atts['plain_text'],
673 );
674
675 $entry_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
676 $formatted_entry = $entry_formatter->content();
677
678 } else {
679
680 $entry_formatter = FrmEntryFactory::entry_formatter_instance( $atts );
681 $formatted_entry = $entry_formatter->get_formatted_entry_values();
682
683 }
684
685 return $formatted_entry;
686 }
687
688 public static function entry_sidebar( $entry = false ) {
689 $data = array();
690 $id = 0;
691
692 $date_format = get_option( 'date_format' );
693 $time_format = get_option( 'time_format' );
694
695 if ( $entry ) {
696 $id = $entry->id;
697 $data = $entry->description;
698 if ( isset( $data['browser'] ) ) {
699 $browser = FrmEntriesHelper::get_browser( $data['browser'] );
700 }
701 /**
702 * Add or remove information in the entry sidebar.
703 *
704 * @since 5.5.2
705 * @param array $data
706 */
707 $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
708 }
709
710 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php';
711 }
712 }
713