PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
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 +330 -576 6.263.06.06 View file →
@@ -1,161 +1,97 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 class FrmEntriesController {
7 4
8 - /**
9 - * @return void
10 - */
11 5 public static function menu() {
12 6 FrmAppHelper::force_capability( 'frm_view_entries' );
13 7
14 8 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
15 9
16 - $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed();
17 -
18 - if ( ! $views_installed ) {
19 - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
20 - self::maybe_redirect_to_views_upsell();
21 - } else {
22 - self::maybe_redirect_to_views_index();
23 - }
24 -
25 - if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
26 - self::load_manage_entries_hooks();
27 - }
10 + self::load_manage_entries_hooks();
28 11 }
29 12
30 13 /**
31 - * This function is called when views is installed.
32 - * The Views add-on uses a different URL for the Views tab than the upsell page.
33 - * If the user is on the upsell page, instead of showing a permission error on reload,
34 - * redirect to the views index page.
35 - *
36 - * @since 6.14.1
37 - *
38 - * @return void
39 - */
40 - private static function maybe_redirect_to_views_index() {
41 - if ( ! FrmAppHelper::is_admin_page( 'formidable-views' ) ) {
42 - return;
43 - }
44 -
45 - $query_args = array(
46 - 'post_type' => 'frm_display',
47 - );
48 - $query_args = self::add_url_params_to_views_redirect_query_args( $query_args );
49 -
50 - wp_safe_redirect( add_query_arg( $query_args, admin_url( 'edit.php' ) ) );
51 - die();
52 - }
53 -
54 - /**
55 - * This function is called when views is inactive.
56 - * A user may deactivate views but then try to reload the views index.
57 - * Instead of showing a permission error, redirect to the views upsell page.
58 - *
59 - * @since 6.14.1
60 - *
61 - * @return void
62 - */
63 - private static function maybe_redirect_to_views_upsell() {
64 - global $pagenow;
65 -
66 - if ( 'edit.php' !== $pagenow || 'frm_display' !== FrmAppHelper::simple_get( 'post_type' ) ) {
67 - return;
68 - }
69 -
70 - $query_args = array(
71 - 'page' => 'formidable-views',
72 - );
73 - $query_args = self::add_url_params_to_views_redirect_query_args( $query_args );
74 -
75 - wp_safe_redirect( add_query_arg( $query_args, admin_url( 'admin.php' ) ) );
76 - die();
77 - }
78 -
79 - /**
80 - * @since 6.14.1
81 - *
82 - * @param array $query_args
83 - *
84 - * @return array
85 - */
86 - private static function add_url_params_to_views_redirect_query_args( $query_args ) {
87 - $query_args['show_nav'] = FrmAppHelper::simple_get( 'show_nav', 'absint', 0 );
88 -
89 - $form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 );
90 -
91 - if ( $form_id ) {
92 - $query_args['form'] = $form_id;
93 - }
94 -
95 - return $query_args;
96 - }
97 -
98 - /**
99 14 * @since 2.05.07
100 - *
101 - * @return void
102 15 */
103 16 private static function load_manage_entries_hooks() {
104 - if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) {
17 + if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new' ) ) ) {
105 18 $menu_name = FrmAppHelper::get_menu_name();
106 - $base = self::base_column_key( $menu_name );
19 + $base = self::base_column_key( $menu_name );
107 20
108 21 add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
109 22 add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
110 23 add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' );
111 24 } else {
112 - add_filter( 'screen_options_show_screen', self::class . '::remove_screen_options', 10, 2 );
25 + add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
113 26 }
114 27 }
115 28
116 - /**
117 - * Display in Back End.
118 - *
119 - * @return mixed
120 - */
121 - public static function route() {
29 + /* Display in Back End */
30 + public static function route() {
122 31 $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
123 - FrmAppHelper::include_svg();
124 32
125 - switch ( $action ) {
126 - case 'show':
127 - case 'destroy':
128 - return self::$action();
33 + switch ( $action ) {
34 + case 'show':
35 + case 'destroy':
36 + case 'destroy_all':
37 + return self::$action();
129 38
130 - default:
131 - do_action( 'frm_entry_action_route', $action );
39 + default:
40 + do_action( 'frm_entry_action_route', $action );
41 + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
42 + return;
43 + }
132 44
133 - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
134 - return;
135 - }
45 + return self::display_list();
46 + }
47 + }
136 48
137 - self::display_list();
138 - return;
139 - }
140 - }
49 + public static function contextual_help( $help, $screen_id, $screen ) {
50 + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
51 + if ( ! method_exists( $screen, 'add_help_tab' ) ) {
52 + return $help;
53 + }
141 54
55 + $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
56 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
57 + $show_help = ( $page == 'formidable-entries' && ( empty( $action ) || $action == 'list' ) );
58 + if ( ! $show_help ) {
59 + return $help;
60 + }
61 +
62 + unset( $action, $page );
63 +
64 + $screen->add_help_tab(
65 + array(
66 + 'id' => 'formidable-entries-tab',
67 + 'title' => __( 'Overview', 'formidable' ),
68 + 'content' => '<p>' .
69 + esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .
70 + '</p> <p>' .
71 + esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) .
72 + '</p>',
73 + )
74 + );
75 +
76 + $screen->set_help_sidebar(
77 + '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
78 + '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
79 + '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/support/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
80 + );
81 +
82 + return $help;
83 + }
84 +
142 85 /**
143 86 * Prevent the "screen options" tab from showing when
144 87 * editing or creating an entry
145 88 *
146 89 * @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 90 */
153 91 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' ) {
92 + $menu_name = sanitize_title( FrmAppHelper::get_menu_name() );
93 + if ( $screen->id == $menu_name . '_page_formidable-entries' ) {
158 94 $show_screen = false;
159 95 }
160 96
161 97 return $show_screen;
@@ -160,77 +96,53 @@
160 96
161 97 return $show_screen;
162 98 }
163 99
164 - /**
165 - * @param array $columns
166 - *
167 - * @return array
168 - */
169 100 public static function manage_columns( $columns ) {
170 - global $frm_vars;
101 + global $frm_vars;
171 102 $form_id = FrmForm::get_current_form_id();
172 103
173 - $columns[ $form_id . '_id' ] = 'ID';
104 + $columns[ $form_id . '_id' ] = 'ID';
174 105 $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
175 106
176 107 if ( $form_id ) {
177 108 self::get_columns_for_form( $form_id, $columns );
178 109 } else {
179 - $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' );
180 - $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' );
181 - $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' );
110 + $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
111 + $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
112 + $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
182 113 }
183 114
184 - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' );
185 115 $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
186 116 $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
187 117 self::maybe_add_ip_col( $form_id, $columns );
188 118
189 - $frm_vars['cols'] = $columns;
119 + $frm_vars['cols'] = $columns;
190 120
191 121 $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
192 -
193 122 if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
194 123 add_screen_option(
195 124 'per_page',
196 125 array(
197 - 'label' => esc_html__( 'Entries', 'formidable' ),
126 + 'label' => __( 'Entries', 'formidable' ),
198 127 'default' => 20,
199 128 'option' => 'formidable_page_formidable_entries_per_page',
200 129 )
201 130 );
202 - }
131 + }
203 132
204 - return $columns;
205 - }
133 + return $columns;
134 + }
206 135
207 - /**
208 - * @param int|string $form_id
209 - * @param array $columns
210 - *
211 - * @return void
212 - */
213 136 private static function get_columns_for_form( $form_id, &$columns ) {
214 137 $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
215 138
216 - /**
217 - * Allows changing fields in the Entries list table heading.
218 - *
219 - * @since 5.0.04
220 - *
221 - * @param array $fields Array of fields.
222 - * @param array $args The arguments. Contains `form_id`.
223 - */
224 - $form_cols = apply_filters( 'frm_fields_in_entries_list_table', $form_cols, compact( 'form_id' ) );
225 -
226 139 foreach ( $form_cols as $form_col ) {
227 140 if ( FrmField::is_no_save_field( $form_col->type ) ) {
228 141 continue;
229 142 }
230 143
231 - $has_child_fields = $form_col->type === 'form' && ! empty( $form_col->field_options['form_select'] );
232 -
144 + $has_child_fields = $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] );
233 145 if ( $has_child_fields ) {
234 146 self::add_subform_cols( $form_col, $form_id, $columns );
235 147 } else {
236 148 self::add_field_cols( $form_col, $form_id, $columns );
@@ -239,18 +151,11 @@
239 151 }
240 152
241 153 /**
242 154 * @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 155 */
250 156 private static function add_subform_cols( $field, $form_id, &$columns ) {
251 157 $sub_form_cols = FrmField::get_all_for_form( $field->field_options['form_select'] );
252 -
253 158 if ( empty( $sub_form_cols ) ) {
254 159 return;
255 160 }
256 161
@@ -265,62 +170,24 @@
265 170 }
266 171
267 172 /**
268 173 * @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 174 */
276 175 private static function add_field_cols( $field, $form_id, &$columns ) {
277 176 $col_id = $field->field_key;
278 -
279 177 if ( $field->form_id != $form_id ) {
280 178 $col_id .= '-_-form' . $field->form_id;
281 179 }
282 180
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 );
181 + $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
182 + $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status';
183 + if ( $has_separate_value && ! $is_post_status ) {
184 + $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
289 185 }
290 186
291 - $columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false );
187 + $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
292 188 }
293 189
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 190 private static function maybe_add_ip_col( $form_id, &$columns ) {
324 191 if ( FrmAppHelper::ips_saved() ) {
325 192 $columns[ $form_id . '_ip' ] = 'IP';
326 193 }
@@ -325,147 +192,101 @@
325 192 $columns[ $form_id . '_ip' ] = 'IP';
326 193 }
327 194 }
328 195
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 196 public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
339 197 $this_page_name = self::hidden_column_key();
340 -
341 198 if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
342 - return $check;
343 - }
199 + return $check;
200 + }
344 201
345 202 if ( empty( $prev_value ) ) {
346 203 $prev_value = get_metadata( 'user', $object_id, $meta_key, true );
347 204 }
348 205
349 - global $frm_vars;
350 - // Add a check so we don't create a loop.
351 - $frm_vars['prev_hidden_cols'] = ! empty( $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
206 + global $frm_vars;
207 + //add a check so we don't create a loop
208 + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
352 209
353 - return $check;
354 - }
210 + return $check;
211 + }
355 212
356 - /**
357 - * 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 - */
213 + //add hidden columns back from other forms
366 214 public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
367 215 $this_page_name = self::hidden_column_key();
368 -
369 216 if ( $meta_key != $this_page_name ) {
370 - return;
371 - }
217 + return;
218 + }
372 219
373 220 global $frm_vars;
374 -
375 221 if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
376 - // Don't continue if there's no previous value.
377 - return;
222 + return; //don't continue if there's no previous value
378 223 }
379 224
380 - foreach ( $meta_value as $mk => $mv ) {
381 - // Remove blank values.
382 - if ( empty( $mv ) ) {
383 - unset( $meta_value[ $mk ] );
384 - }
385 - }
225 + foreach ( $meta_value as $mk => $mv ) {
226 + //remove blank values
227 + if ( empty( $mv ) ) {
228 + unset( $meta_value[ $mk ] );
229 + }
230 + }
386 231
387 232 $cur_form_prefix = reset( $meta_value );
388 233 $cur_form_prefix = explode( '_', $cur_form_prefix );
389 - $cur_form_prefix = $cur_form_prefix[0];
390 - $save = false;
234 + $cur_form_prefix = $cur_form_prefix[0];
235 + $save = false;
391 236
392 - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
237 + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
393 238 if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
394 - // Don't add blank cols or process included cols.
395 - continue;
396 - }
239 + //don't add blank cols or process included cols
240 + continue;
241 + }
397 242
398 243 $form_prefix = explode( '_', $prev_hidden );
399 - $form_prefix = $form_prefix[0];
244 + $form_prefix = $form_prefix[0];
245 + if ( $form_prefix == $cur_form_prefix ) {
246 + //don't add back columns that are meant to be hidden
247 + continue;
248 + }
400 249
401 - if ( $form_prefix === $cur_form_prefix ) {
402 - // Don't add back columns that are meant to be hidden.
403 - continue;
404 - }
405 -
406 - $meta_value[] = $prev_hidden;
407 - $save = true;
250 + $meta_value[] = $prev_hidden;
251 + $save = true;
408 252 unset( $form_prefix );
409 - }
253 + }
410 254
411 255 if ( $save ) {
412 256 $user_id = get_current_user_id();
413 257 update_user_option( $user_id, $this_page_name, $meta_value, true );
414 - }
415 - }
258 + }
259 + }
416 260
417 261 /**
418 262 * @since 2.05.07
419 - *
420 - * @param string $menu_name
421 - *
422 - * @return string
423 263 */
424 264 private static function hidden_column_key( $menu_name = '' ) {
425 265 $base = self::base_column_key( $menu_name );
426 -
427 266 return 'manage' . $base . 'columnshidden';
428 267 }
429 268
430 269 /**
431 270 * @since 2.05.07
432 - *
433 - * @param string $menu_name
434 - *
435 - * @return string
436 271 */
437 272 private static function base_column_key( $menu_name = '' ) {
438 273 if ( empty( $menu_name ) ) {
439 274 $menu_name = FrmAppHelper::get_menu_name();
440 275 }
441 -
442 - $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
443 -
444 - return sanitize_title( $menu_name ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-entries';
276 + return sanitize_title( $menu_name ) . '_page_formidable-entries';
445 277 }
446 278
447 - /**
448 - * @param int $save
449 - * @param string $option
450 - * @param string $value
451 - *
452 - * @return int
453 - */
454 279 public static function save_per_page( $save, $option, $value ) {
455 - if ( $option === 'formidable_page_formidable_entries_per_page' ) {
456 - $save = (int) $value;
457 - }
280 + if ( $option == 'formidable_page_formidable_entries_per_page' ) {
281 + $save = (int) $value;
282 + }
283 + return $save;
284 + }
458 285
459 - return $save;
460 - }
461 -
462 - /**
463 - * @return array
464 - */
465 286 public static function sortable_columns() {
466 287 $form_id = FrmForm::get_current_form_id();
467 - $fields = FrmField::get_all_for_form( $form_id );
288 + $fields = FrmField::get_all_for_form( $form_id );
468 289
469 290 $columns = array(
470 291 $form_id . '_id' => 'id',
471 292 $form_id . '_created_at' => 'created_at',
@@ -474,16 +295,11 @@
474 295 $form_id . '_item_key' => 'item_key',
475 296 $form_id . '_is_draft' => 'is_draft',
476 297 );
477 298
478 - if ( ! $form_id ) {
479 - $columns[ $form_id . '_user_id' ] = 'user_id';
480 - $columns[ $form_id . '_name' ] = 'name';
481 - $columns[ $form_id . '_form_id' ] = 'form_id';
482 - }
483 -
484 299 foreach ( $fields as $field ) {
485 - if ( self::field_supports_sorting( $field ) ) {
300 + if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
301 + // Can't sort on checkboxes because they are stored serialized, or post fields
486 302 $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
487 303 }
488 304 }
489 305
@@ -489,44 +305,22 @@
489 305
490 306 return $columns;
491 307 }
492 308
493 - /**
494 - * Can't sort on checkboxes because they are sorted serialized.
495 - * Some post content can be sorted but not everything.
496 - *
497 - * @param stdClass $field
498 - *
499 - * @return bool
500 - */
501 - private static function field_supports_sorting( $field ) {
502 - $is_sortable = 'checkbox' !== $field->type && empty( $field->field_options['post_field'] );
503 - return apply_filters( 'frm_field_column_is_sortable', $is_sortable, $field );
504 - }
505 -
506 - /**
507 - * @param mixed $result Option value from database for hidden columns in entries table.
508 - *
509 - * @return array
510 - */
511 309 public static function hidden_columns( $result ) {
512 - global $frm_vars;
310 + $form_id = FrmForm::get_current_form_id();
513 311
514 - if ( ! is_array( $result ) ) {
515 - // Force an unexpected value to be an array.
516 - // Since $result is a filtered option and gets saved to the database, it's possible it could be a string.
517 - // Since this code expects an array it would break with a "Uncaught Error: [] operator not supported for strings" error.
518 - $result = array();
519 - }
312 + $hidden = self::user_hidden_columns_for_form( $form_id, $result );
520 313
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;
314 + global $frm_vars;
315 + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
525 316
526 317 if ( ! empty( $hidden ) ) {
527 318 $result = $hidden;
528 - $i = $i - count( $result );
319 + $i = $i - count( $result );
320 + $max_columns = 11;
321 + } else {
322 + $max_columns = 8;
529 323 }
530 324
531 325 if ( $i <= $max_columns ) {
532 326 return $result;
@@ -538,22 +332,16 @@
538 332 }
539 333
540 334 /**
541 335 * @since 2.05.07
542 - *
543 - * @param int|string $form_id
544 - * @param mixed $result
545 - *
546 - * @return array
547 336 */
548 337 private static function user_hidden_columns_for_form( $form_id, $result ) {
549 338 $hidden = array();
550 -
551 339 foreach ( (array) $result as $r ) {
552 340 if ( ! empty( $r ) ) {
553 341 list( $form_prefix, $field_key ) = explode( '_', $r );
554 342
555 - if ( (int) $form_prefix === (int) $form_id ) {
343 + if ( (int) $form_prefix == (int) $form_id ) {
556 344 $hidden[] = $r;
557 345 }
558 346
559 347 unset( $form_prefix );
@@ -558,9 +346,8 @@
558 346
559 347 unset( $form_prefix );
560 348 }
561 349 }
562 -
563 350 return $hidden;
564 351 }
565 352
566 353 /**
@@ -566,13 +353,8 @@
566 353 /**
567 354 * Remove some columns by default when there are too many
568 355 *
569 356 * @since 2.05.07
570 - *
571 - * @param array $atts
572 - * @param array $result
573 - *
574 - * @return void
575 357 */
576 358 private static function remove_excess_cols( $atts, &$result ) {
577 359 global $frm_vars;
578 360
@@ -579,9 +361,9 @@
579 361 $remove_first = array(
580 362 $atts['form_id'] . '_item_key' => '',
581 363 $atts['form_id'] . '_id' => '',
582 364 );
583 - $cols = $remove_first + array_reverse( $frm_vars['cols'], true );
365 + $cols = $remove_first + array_reverse( $frm_vars['cols'], true );
584 366
585 367 $i = $atts['i'];
586 368
587 369 foreach ( $cols as $col_key => $col ) {
@@ -590,9 +372,9 @@
590 372 }
591 373
592 374 if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
593 375 $result[] = $col_key;
594 - --$i;
376 + $i--;
595 377 }
596 378
597 379 unset( $col_key, $col );
598 380 }
@@ -597,189 +379,206 @@
597 379 unset( $col_key, $col );
598 380 }
599 381 }
600 382
601 - /**
602 - * @param string $message
603 - * @param array $errors
604 - *
605 - * @return void
606 - */
607 383 public static function display_list( $message = '', $errors = array() ) {
608 - global $wpdb, $frm_vars;
384 + global $wpdb, $frm_vars;
609 385
610 - $form = FrmForm::maybe_get_current_form();
386 + $form = FrmForm::maybe_get_current_form();
611 387 $params = FrmForm::get_admin_params( $form );
612 388
613 - if ( $form ) {
614 - $params['form'] = $form->id;
615 - $frm_vars['current_form'] = $form;
389 + if ( $form ) {
390 + $params['form'] = $form->id;
391 + $frm_vars['current_form'] = $form;
616 392
617 393 self::get_delete_form_time( $form, $errors );
618 394 }
619 395
620 - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
396 + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
621 397
622 - $wp_list_table = new $table_class( array( 'params' => $params ) );
398 + $wp_list_table = new $table_class( array( 'params' => $params ) );
623 399
624 - $pagenum = $wp_list_table->get_pagenum();
400 + $pagenum = $wp_list_table->get_pagenum();
625 401
626 - $wp_list_table->prepare_items();
402 + $wp_list_table->prepare_items();
627 403
628 - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
629 -
630 - if ( $pagenum > $total_pages && $total_pages > 0 ) {
404 + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
405 + if ( $pagenum > $total_pages && $total_pages > 0 ) {
631 406 $url = add_query_arg( 'paged', $total_pages );
407 + if ( headers_sent() ) {
408 + echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
409 + } else {
410 + wp_redirect( esc_url_raw( $url ) );
411 + }
412 + die();
413 + }
632 414
633 - if ( headers_sent() ) {
634 - FrmAppHelper::js_redirect( $url, true );
635 - } else {
636 - wp_redirect( esc_url_raw( $url ) );
637 - }
638 - die();
639 - }
640 -
641 415 if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
642 - $message = __( 'Your import is complete', 'formidable' );
643 - }
416 + $message = __( 'Your import is complete', 'formidable' );
417 + }
644 418
645 - require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
646 - }
419 + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
420 + }
647 421
648 - /**
649 - * @param object $form
650 - * @param array $errors
651 - *
652 - * @return void
653 - */
654 422 private static function get_delete_form_time( $form, &$errors ) {
655 - if ( 'trash' === $form->status ) {
423 + if ( 'trash' == $form->status ) {
656 424 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
657 - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( $form->options['trash_time'] ?? time() ) );
658 -
659 - /* translators: %1$s: Time string */
425 + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
660 426 $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 427 }
662 428 }
663 429
664 - /**
665 - * Back End CRUD.
666 - *
667 - * @param int $id
668 - *
669 - * @return void
670 - */
430 + /* Back End CRUD */
671 431 public static function show( $id = 0 ) {
672 432 FrmAppHelper::permission_check( 'frm_view_entries' );
673 433
674 - if ( ! $id ) {
434 + if ( ! $id ) {
675 435 $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
676 436
677 - if ( ! $id ) {
437 + if ( ! $id ) {
678 438 $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
679 - }
680 - }
439 + }
440 + }
681 441
682 442 $entry = FrmEntry::getOne( $id, true );
683 -
684 443 if ( ! $entry ) {
685 - FrmAppController::show_error_modal(
686 - array(
687 - 'title' => __( 'You can\'t view the entry', 'formidable' ),
688 - 'body' => __( 'You are trying to view an entry that does not exist', 'formidable' ),
689 - 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
690 - )
691 - );
444 + echo '<div id="form_show_entry_page" class="wrap">' .
445 + esc_html__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
446 + '</div>';
692 447 return;
693 448 }
694 449
695 - $data = $entry->description;
696 -
450 + $data = maybe_unserialize( $entry->description );
697 451 if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
698 452 $data = array( 'referrer' => $data );
699 453 }
700 454
701 455 $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
702 - $form = FrmForm::getOne( $entry->form_id );
456 + $to_emails = array();
457 + $form = FrmForm::getOne( $entry->form_id );
703 458
704 - include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php';
705 - }
459 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
460 + }
706 461
707 - /**
708 - * Destroy an entry from the admin page.
709 - * 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.
710 - *
711 - * @return void
712 - */
713 - public static function destroy() {
714 - $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_entries', '_wpnonce', -1 );
462 + public static function destroy() {
463 + FrmAppHelper::permission_check( 'frm_delete_entries' );
715 464
716 - if ( false !== $permission_error ) {
717 - $error_args = array(
718 - 'title' => __( 'Verification failed', 'formidable' ),
719 - 'body' => $permission_error,
720 - 'cancel_url' => admin_url( 'admin.php?page=formidable-entries' ),
721 - );
722 - FrmAppController::show_error_modal( $error_args );
723 - return;
724 - }
725 -
726 465 $params = FrmForm::get_admin_params();
727 466
728 467 if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
729 468 self::unlink_post( $params['id'] );
730 - }
469 + }
731 470
732 - $message = '';
471 + $message = '';
472 + if ( FrmEntry::destroy( $params['id'] ) ) {
473 + $message = __( 'Entry was Successfully Destroyed', 'formidable' );
474 + }
733 475
734 - if ( FrmEntry::destroy( $params['id'] ) ) {
735 - $message = __( 'Entry was successfully deleted', 'formidable' );
736 - }
476 + self::display_list( $message );
477 + }
737 478
738 - self::display_list( $message );
739 - }
479 + public static function destroy_all() {
480 + if ( ! current_user_can( 'frm_delete_entries' ) ) {
481 + $frm_settings = FrmAppHelper::get_settings();
482 + wp_die( esc_html( $frm_settings->admin_permission ) );
483 + }
740 484
485 + $params = FrmForm::get_admin_params();
486 + $message = '';
487 + $errors = array();
488 + $form_id = (int) $params['form'];
489 +
490 + if ( $form_id ) {
491 + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
492 + $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
493 +
494 + if ( $action ) {
495 + // this action takes a while, so only trigger it if there are posts to delete
496 + foreach ( $entry_ids as $entry_id ) {
497 + do_action( 'frm_before_destroy_entry', $entry_id );
498 + unset( $entry_id );
499 + }
500 + }
501 +
502 + $results = self::delete_form_entries( $form_id );
503 + if ( $results ) {
504 + FrmEntry::clear_cache();
505 + $message = __( 'Entries were Successfully Destroyed', 'formidable' );
506 + }
507 + } else {
508 + $errors = __( 'No entries were specified', 'formidable' );
509 + }
510 +
511 + self::display_list( $message, $errors );
512 + }
513 +
741 514 /**
742 - * @param array|string $errors
743 - * @param bool $ajax
744 - *
745 - * @return void
515 + * @since 3.01
516 + * @param int $form_id
746 517 */
747 - public static function process_entry( $errors = '', $ajax = false ) {
748 - $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
518 + private static function delete_form_entries( $form_id ) {
519 + global $wpdb;
749 520
750 - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
751 - return;
521 + $form_ids = self::get_child_form_ids( $form_id );
522 +
523 + $meta_query = $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) WHERE form_id=%d", $form_id );
524 + $entry_query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id );
525 +
526 + if ( ! empty( $form_ids ) ) {
527 + $form_query = ' OR form_id in (' . $form_ids . ')';
528 + $meta_query .= $form_query;
529 + $entry_query .= $form_query;
752 530 }
753 531
754 - global $frm_vars;
532 + $wpdb->query( $meta_query ); // WPCS: unprepared SQL ok.
533 + return $wpdb->query( $entry_query ); // WPCS: unprepared SQL ok.
534 + }
755 535
756 - $form = FrmForm::getOne( $form_id );
536 + /**
537 + * @since 3.01
538 + * @param int $form_id
539 + * @param bool|string $implode
540 + */
541 + private static function get_child_form_ids( $form_id, $implode = ',' ) {
542 + $form_ids = array();
543 + $child_form_ids = FrmDb::get_col( 'frm_forms', array( 'parent_form_id' => $form_id ) );
544 + if ( $child_form_ids ) {
545 + $form_ids = $child_form_ids;
546 + }
547 + $form_ids = array_filter( $form_ids, 'is_numeric' );
548 + if ( $implode ) {
549 + $form_ids = implode( $implode, $form_ids );
550 + }
551 + return $form_ids;
552 + }
757 553
758 - if ( ! $form ) {
759 - return;
760 - }
554 + public static function process_entry( $errors = '', $ajax = false ) {
555 + $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
556 + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
557 + return;
558 + }
761 559
762 - $is_preview = 'frm_forms_preview' === FrmAppHelper::simple_get( 'action' );
560 + global $frm_vars;
763 561
764 - if ( $is_preview && FrmFormsHelper::should_block_preview( $form->form_key ) ) {
765 - return;
766 - }
562 + $form = FrmForm::getOne( $form_id );
563 + if ( ! $form ) {
564 + return;
565 + }
767 566
768 567 $params = FrmForm::get_params( $form );
769 568
770 - if ( ! isset( $frm_vars['form_params'] ) ) {
771 - $frm_vars['form_params'] = array();
772 - }
569 + if ( ! isset( $frm_vars['form_params'] ) ) {
570 + $frm_vars['form_params'] = array();
571 + }
773 572 $frm_vars['form_params'][ $form->id ] = $params;
774 573
775 574 if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
776 - return;
777 - }
575 + return;
576 + }
778 577
779 - if ( $errors == '' && ! $ajax ) {
780 - $errors = FrmEntryValidate::validate( wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
781 - }
578 + if ( $errors == '' && ! $ajax ) {
579 + $errors = FrmEntryValidate::validate( $_POST );
580 + }
782 581
783 582 /**
784 583 * Use this filter to add trigger actions and add errors after
785 584 * all other errors have been processed
@@ -789,29 +588,26 @@
789 588 $errors = apply_filters( 'frm_entries_before_create', $errors, $form );
790 589
791 590 $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
792 591
793 - if ( empty( $errors ) ) {
592 + if ( empty( $errors ) ) {
794 593 $_POST['frm_skip_cookie'] = 1;
795 - $do_success = false;
796 -
797 - if ( $params['action'] === 'create' ) {
594 + $do_success = false;
595 + if ( $params['action'] == 'create' ) {
798 596 if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
799 - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
800 -
597 + $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
801 598 $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
802 - $do_success = true;
803 - }
804 - }
599 + $do_success = true;
600 + }
601 + }
805 602
806 - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
807 -
603 + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
808 604 if ( $do_success ) {
809 605 FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
810 606 }
811 - unset( $_POST['frm_skip_cookie'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
812 - }
813 - }
607 + unset( $_POST['frm_skip_cookie'] );
608 + }
609 + }
814 610
815 611 /**
816 612 * Escape url entities before redirect
817 613 *
@@ -817,9 +613,8 @@
817 613 *
818 614 * @since 3.0
819 615 *
820 616 * @param string $url
821 - *
822 617 * @return string
823 618 */
824 619 public static function prepare_redirect_url( $url ) {
825 620 return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
@@ -824,61 +619,32 @@
824 619 public static function prepare_redirect_url( $url ) {
825 620 return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
826 621 }
827 622
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 - public static function delete_entry_before_redirect( $url, $form, $atts ) {
838 - self::_delete_entry( $atts['id'], $form );
623 + public static function delete_entry_before_redirect( $url, $form, $atts ) {
624 + self::_delete_entry( $atts['id'], $form );
625 + return $url;
626 + }
839 627
840 - return $url;
841 - }
628 + //Delete entry if not redirected
629 + public static function delete_entry_after_save( $atts ) {
630 + self::_delete_entry( $atts['entry_id'], $atts['form'] );
631 + }
842 632
843 - /**
844 - * Delete entry if not redirected.
845 - *
846 - * @param array $atts
847 - *
848 - * @return void
849 - */
850 - public static function delete_entry_after_save( $atts ) {
851 - self::_delete_entry( $atts['entry_id'], $atts['form'] );
852 - }
633 + private static function _delete_entry( $entry_id, $form ) {
634 + if ( ! $form ) {
635 + return;
636 + }
853 637
854 - /**
855 - * Delete entry if not redirected.
856 - *
857 - * @param int $entry_id
858 - * @param object $form
859 - *
860 - * @return void
861 - */
862 - private static function _delete_entry( $entry_id, $form ) {
863 - if ( ! $form ) {
864 - return;
865 - }
866 -
867 - FrmAppHelper::unserialize_or_decode( $form->options );
868 -
869 - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
638 + $form->options = maybe_unserialize( $form->options );
639 + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
870 640 self::unlink_post( $entry_id );
871 - FrmEntry::destroy( $entry_id );
872 - }
873 - }
641 + FrmEntry::destroy( $entry_id );
642 + }
643 + }
874 644
875 645 /**
876 646 * Unlink entry from post
877 - *
878 - * @param int $entry_id
879 - *
880 - * @return void
881 647 */
882 648 private static function unlink_post( $entry_id ) {
883 649 global $wpdb;
884 650 $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $entry_id ) );
@@ -885,42 +651,37 @@
885 651 FrmEntry::clear_cache();
886 652 }
887 653
888 654 /**
889 - * @param array $atts
655 + * @param $atts
890 656 *
891 657 * @return array|string
892 658 */
893 659 public static function show_entry_shortcode( $atts ) {
894 660 $defaults = array(
895 - 'id' => false,
896 - 'entry' => false,
897 - 'fields' => false,
898 - 'plain_text' => false,
899 - 'user_info' => false,
900 - 'include_blank' => false,
901 - 'default_email' => false,
902 - 'form_id' => false,
903 - 'format' => 'text',
904 - 'array_key' => 'key',
905 - 'direction' => 'ltr',
906 - 'font_size' => '',
907 - 'text_color' => '',
908 - 'border_width' => '',
909 - 'border_color' => '',
910 - 'bg_color' => '',
911 - 'alt_bg_color' => '',
912 - 'class' => '',
913 - 'clickable' => false,
914 - 'exclude_fields' => '',
915 - 'include_fields' => '',
916 - 'include_extras' => '',
917 - 'inline_style' => 1,
918 - 'table_style' => '',
919 - // Return embedded fields as nested array.
920 - 'child_array' => false,
921 - 'line_breaks' => true,
922 - 'array_separator' => ', ',
661 + 'id' => false,
662 + 'entry' => false,
663 + 'fields' => false,
664 + 'plain_text' => false,
665 + 'user_info' => false,
666 + 'include_blank' => false,
667 + 'default_email' => false,
668 + 'form_id' => false,
669 + 'format' => 'text',
670 + 'array_key' => 'key',
671 + 'direction' => 'ltr',
672 + 'font_size' => '',
673 + 'text_color' => '',
674 + 'border_width' => '',
675 + 'border_color' => '',
676 + 'bg_color' => '',
677 + 'alt_bg_color' => '',
678 + 'clickable' => false,
679 + 'exclude_fields' => '',
680 + 'include_fields' => '',
681 + 'include_extras' => '',
682 + 'inline_style' => 1,
683 + 'child_array' => false, // return embedded fields as nested array
923 684 );
924 685 $defaults = apply_filters( 'frm_show_entry_defaults', $defaults );
925 686
926 687 $atts = shortcode_atts( $defaults, $atts );
@@ -929,12 +690,11 @@
929 690 $shortcode_atts = array(
930 691 'format' => $atts['format'],
931 692 'plain_text' => $atts['plain_text'],
932 693 );
694 + $entry_shortcode_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
695 + $formatted_entry = $entry_shortcode_formatter->content();
933 696
934 - $entry_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
935 - $formatted_entry = $entry_formatter->content();
936 -
937 697 } else {
938 698
939 699 $entry_formatter = FrmEntryFactory::entry_formatter_instance( $atts );
940 700 $formatted_entry = $entry_formatter->get_formatted_entry_values();
@@ -943,37 +703,31 @@
943 703
944 704 return $formatted_entry;
945 705 }
946 706
947 - /**
948 - * @param false|object $entry
949 - *
950 - * @return void
951 - */
952 - public static function entry_sidebar( $entry = false ) {
953 - $data = array();
954 - $id = 0;
955 -
707 + public static function entry_sidebar( $entry ) {
708 + $data = maybe_unserialize( $entry->description );
956 709 $date_format = get_option( 'date_format' );
957 710 $time_format = get_option( 'time_format' );
711 + if ( isset( $data['browser'] ) ) {
712 + $browser = FrmEntriesHelper::get_browser( $data['browser'] );
713 + }
958 714
959 - if ( $entry ) {
960 - $id = $entry->id;
961 - $data = $entry->description;
715 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
716 + }
962 717
963 - if ( isset( $data['browser'] ) ) {
964 - $browser = FrmEntriesHelper::get_browser( $data['browser'] );
965 - }
966 - /**
967 - * Add or remove information in the entry sidebar.
968 - *
969 - * @since 5.5.2
970 - *
971 - * @param array $data
972 - * @param array{entry:\stdClass} $entry
973 - */
974 - $data = apply_filters( 'frm_sidebar_data', $data, compact( 'entry' ) );
975 - }
718 + /**
719 + * @deprecated 1.07.05
720 + * @codeCoverageIgnore
721 + */
722 + public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
723 + return FrmDeprecated::show_form( $id, $key, $title, $description );
724 + }
976 725
977 - include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php';
726 + /**
727 + * @deprecated 1.07.05
728 + * @codeCoverageIgnore
729 + */
730 + public static function get_form( $filename, $form, $title, $description ) {
731 + return FrmDeprecated::get_form( $filename, $form, $title, $description );
978 732 }
979 733 }