Completed
Push — master ( 2b2bc1...a58c0a )
by Stephanie
02:32
created

FrmEntriesController::remove_excess_cols()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 3
nop 2
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class FrmEntriesController {
4
5
	public static function menu() {
6
		FrmAppHelper::force_capability( 'frm_view_entries' );
7
8
		add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9
10
		self::load_manage_entries_hooks();
11
	}
12
13
	/**
14
	 * @since 2.05.07
15
	 */
16
	private static function load_manage_entries_hooks() {
17
		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
18
			$menu_name = FrmAppHelper::get_menu_name();
19
			$base = self::base_column_key( $menu_name );
20
21
			add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
22
			add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
23
			add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' );
24
		}
25
	}
26
27
    /* Display in Back End */
28
    public static function route() {
29
		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
30
31
        switch ( $action ) {
32
            case 'show':
33
            case 'destroy':
34
            case 'destroy_all':
35
                return self::$action();
36
37
            default:
38
                do_action( 'frm_entry_action_route', $action );
39
                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
40
                    return;
41
                }
42
43
                return self::display_list();
44
        }
45
    }
46
47
	public static function contextual_help( $help, $screen_id, $screen ) {
48
        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
49
        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
50
            return $help;
51
        }
52
53
		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
54
		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
55
		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
56
            return $help;
57
        }
58
59
		unset( $action, $page );
60
61
        $screen->add_help_tab( array(
62
            'id'      => 'formidable-entries-tab',
63
            'title'   => __( 'Overview', 'formidable' ),
64
			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
65
        ));
66
67
        $screen->set_help_sidebar(
68
			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
69
			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
70
			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
71
    	);
72
73
        return $help;
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' ] = __( 'Form', 'formidable' );
87
			$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
88
			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
89
		}
90
91
		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
92
		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
93
		self::maybe_add_ip_col( $form_id, $columns );
94
95
        $frm_vars['cols'] = $columns;
96
97
		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
98
		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
99
			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
100
        }
101
102
        return $columns;
103
    }
104
105
	private static function get_columns_for_form( $form_id, &$columns ) {
106
		$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
107
108
		foreach ( $form_cols as $form_col ) {
109
			if ( FrmField::is_no_save_field( $form_col->type ) ) {
110
				continue;
111
			}
112
113
			if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
114
				$sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] );
115
116
				if ( $sub_form_cols ) {
117
					foreach ( $sub_form_cols as $k => $sub_form_col ) {
118
						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
119
							unset( $sub_form_cols[ $k ] );
120
							continue;
121
						}
122
						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
123
						unset($sub_form_col);
124
					}
125
				}
126
				unset($sub_form_cols);
127
			} else {
128
				$col_id = $form_col->field_key;
129
				if ( $form_col->form_id != $form_id ) {
130
					$col_id .= '-_-form' . $form_col->form_id;
131
				}
132
				
133
				$has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' );
134
				$is_post_status     = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status';
135
				if ( $has_separate_value && ! $is_post_status ) {
136
					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
137
				}
138
				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
139
			}
140
		}
141
	}
142
143
	private static function maybe_add_ip_col( $form_id, &$columns ) {
144
		if ( FrmAppHelper::ips_saved() ) {
145
			$columns[ $form_id . '_ip' ] = 'IP';
146
		}
147
	}
148
149
	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
150
		$this_page_name = self::hidden_column_key();
151
		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
152
            return $check;
153
        }
154
155
		if ( empty( $prev_value ) ) {
156
			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
157
		}
158
159
        global $frm_vars;
160
        //add a check so we don't create a loop
161
        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
162
163
        return $check;
164
    }
165
166
    //add hidden columns back from other forms
167
	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
168
		$this_page_name = self::hidden_column_key();
169
		if ( $meta_key != $this_page_name ) {
170
            return;
171
        }
172
173
        global $frm_vars;
174
        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
175
            return; //don't continue if there's no previous value
176
        }
177
178
        foreach ( $meta_value as $mk => $mv ) {
179
            //remove blank values
180
            if ( empty( $mv ) ) {
181
                unset( $meta_value[ $mk ] );
182
            }
183
        }
184
185
        $cur_form_prefix = reset($meta_value);
186
        $cur_form_prefix = explode('_', $cur_form_prefix);
187
        $cur_form_prefix = $cur_form_prefix[0];
188
        $save = false;
189
190
        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
191
			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
192
                //don't add blank cols or process included cols
193
                continue;
194
            }
195
196
			$form_prefix = explode( '_', $prev_hidden );
197
            $form_prefix = $form_prefix[0];
198
            if ( $form_prefix == $cur_form_prefix ) {
199
                //don't add back columns that are meant to be hidden
200
                continue;
201
            }
202
203
            $meta_value[] = $prev_hidden;
204
            $save = true;
205
            unset($form_prefix);
206
        }
207
208
		if ( $save ) {
209
			$user_id = get_current_user_id();
210
			update_user_option( $user_id, $this_page_name, $meta_value, true );
211
        }
212
    }
213
214
	/**
215
	 * @since 2.05.07
216
	 */
217
	private static function hidden_column_key( $menu_name = '' ) {
218
		$base = self::base_column_key( $menu_name );
219
		return 'manage' . $base . 'columnshidden';
220
	}
221
222
	/**
223
	 * @since 2.05.07
224
	 */
225
	private static function base_column_key( $menu_name = '' ) {
226
		if ( empty( $menu_name ) ) {
227
			$menu_name = FrmAppHelper::get_menu_name();
228
		}
229
		return sanitize_title( $menu_name ) . '_page_formidable-entries';
230
	}
231
232
	public static function save_per_page( $save, $option, $value ) {
233
        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
234
            $save = (int) $value;
235
        }
236
        return $save;
237
    }
238
239
	public static function sortable_columns() {
240
		$form_id = FrmForm::get_current_form_id();
241
		$fields = FrmField::get_all_for_form( $form_id );
242
243
		$columns = array(
244
			$form_id . '_id'         => 'id',
245
			$form_id . '_created_at' => 'created_at',
246
			$form_id . '_updated_at' => 'updated_at',
247
			$form_id . '_ip'         => 'ip',
248
			$form_id . '_item_key'   => 'item_key',
249
			$form_id . '_is_draft'   => 'is_draft',
250
		);
251
252
		foreach ( $fields as $field ) {
253
			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
254
				// Can't sort on checkboxes because they are stored serialized, or post fields
255
				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
256
			}
257
		}
258
259
		return $columns;
260
	}
261
262
	public static function hidden_columns( $result ) {
263
		$form_id = FrmForm::get_current_form_id();
264
		$max_columns = 8;
265
266
		$hidden = self::user_hidden_columns_for_form( $form_id, $result );
267
268
		if ( ! empty( $hidden ) ) {
269
			$max_columns = 11;
270
			$result = $hidden;
271
		}
272
273
		global $frm_vars;
274
		$i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
275
		if ( $i <= $max_columns ) {
276
			return $result;
277
		}
278
279
		if ( $form_id ) {
280
			$result[] = $form_id . '_id';
281
			$i--;
282
		}
283
284
		$result[] = $form_id . '_item_key';
285
		$i--;
286
287
		self::remove_excess_cols( compact( 'i', 'max_columns' ), $result );
288
289
		return $result;
290
	}
291
292
	/**
293
	 * @since 2.05.07
294
	 */
295
	private static function user_hidden_columns_for_form( $form_id, $result ) {
296
		$hidden = array();
297
		foreach ( (array) $result as $r ) {
298
			if ( ! empty( $r ) ) {
299
				list( $form_prefix, $field_key ) = explode( '_', $r );
0 ignored issues
show
Unused Code introduced by
The assignment to $field_key is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
300
301
				if ( (int) $form_prefix == (int) $form_id ) {
302
					$hidden[] = $r;
303
				}
304
305
				unset( $form_prefix );
306
			}
307
		}
308
		return $hidden;
309
	}
310
311
	/**
312
	 * Remove some columns by default when there are too many
313
	 *
314
	 * @since 2.05.07
315
	 */
316
	private static function remove_excess_cols( $atts, &$result ) {
317
		global $frm_vars;
318
319
		$cols = $frm_vars['cols'];
320
		$cols = array_reverse( $cols, true );
321
		$i = $atts['i'];
322
323
		foreach ( $cols as $col_key => $col ) {
324
			if ( $i > $atts['max_columns'] ) {
325
				$result[] = $col_key;
326
			}
327
328
			$i--;
329
			unset( $col_key, $col );
330
		}
331
	}
332
333
	public static function display_list( $message = '', $errors = array() ) {
334
        global $wpdb, $frm_vars;
335
336
		$form = FrmForm::maybe_get_current_form();
337
		$params = FrmForm::get_admin_params( $form );
338
339
        if ( $form ) {
340
            $params['form'] = $form->id;
341
            $frm_vars['current_form'] = $form;
342
343
			self::get_delete_form_time( $form, $errors );
344
		}
345
346
        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
347
348
        $wp_list_table = new $table_class( array( 'params' => $params ) );
349
350
        $pagenum = $wp_list_table->get_pagenum();
351
352
        $wp_list_table->prepare_items();
353
354
        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
355
        if ( $pagenum > $total_pages && $total_pages > 0 ) {
356
			$url = add_query_arg( 'paged', $total_pages );
357
            if ( headers_sent() ) {
358
                echo FrmAppHelper::js_redirect($url);
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'FrmAppHelper'
Loading history...
359
            } else {
360
                wp_redirect( esc_url_raw( $url ) );
361
            }
362
            die();
363
        }
364
365
        if ( empty($message) && isset($_GET['import-message']) ) {
366
            $message = __( 'Your import is complete', 'formidable' );
367
        }
368
369
		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
370
    }
371
372
	private static function get_delete_form_time( $form, &$errors ) {
373
		if ( 'trash' == $form->status ) {
374
			$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
375
			$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
376
			$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 );
377
		}
378
	}
379
380
    /* Back End CRUD */
381
	public static function show( $id = 0 ) {
382
        FrmAppHelper::permission_check('frm_view_entries');
383
384
        if ( ! $id ) {
385
			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
386
387
            if ( ! $id ) {
388
				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
389
            }
390
        }
391
392
        $entry = FrmEntry::getOne($id, true);
393
		if ( ! $entry ) {
394
			echo '<div id="form_show_entry_page" class="wrap">' .
395
				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw '__'
Loading history...
396
				'</div>';
397
			return;
398
		}
399
400
        $data = maybe_unserialize($entry->description);
401
		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
402
			$data = array( 'referrer' => $data );
403
		}
404
405
		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
406
        $to_emails = array();
407
408
		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
409
    }
410
411
    public static function destroy() {
412
        FrmAppHelper::permission_check('frm_delete_entries');
413
414
		$params = FrmForm::get_admin_params();
415
416
        if ( isset($params['keep_post']) && $params['keep_post'] ) {
417
            //unlink entry from post
418
            global $wpdb;
419
			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
420
        }
421
422
        $message = '';
423
        if ( FrmEntry::destroy( $params['id'] ) ) {
424
            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
425
        }
426
427
        self::display_list( $message );
428
    }
429
430
    public static function destroy_all() {
431
        if ( ! current_user_can( 'frm_delete_entries' ) ) {
432
            $frm_settings = FrmAppHelper::get_settings();
433
            wp_die( $frm_settings->admin_permission );
434
        }
435
436
        global $wpdb;
437
		$params = FrmForm::get_admin_params();
438
        $message = '';
439
        $errors = array();
440
        $form_id = (int) $params['form'];
441
442
        if ( $form_id ) {
443
            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
444
			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
445
446
            if ( $action ) {
447
                // this action takes a while, so only trigger it if there are posts to delete
448
                foreach ( $entry_ids as $entry_id ) {
0 ignored issues
show
Bug introduced by
The expression $entry_ids of type array|null|string|object is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
449
                    do_action( 'frm_before_destroy_entry', $entry_id );
450
                    unset( $entry_id );
451
                }
452
            }
453
454
            $wpdb->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) and form_id=%d", $form_id ) );
455
            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
456
            if ( $results ) {
457
				FrmEntry::clear_cache();
458
                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
459
            }
460
        } else {
461
            $errors = __( 'No entries were specified', 'formidable' );
462
        }
463
464
        self::display_list( $message, $errors );
465
    }
466
467
    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
468
        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
469
        return FrmFormsController::show_form( $id, $key, $title, $description );
470
    }
471
472
    public static function get_form( $filename, $form, $title, $description ) {
473
        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
474
        return FrmFormsController::get_form( $form, $title, $description );
475
    }
476
477
    public static function process_entry( $errors = '', $ajax = false ) {
478
		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
479
		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
480
            return;
481
        }
482
483
        global $frm_vars;
484
485
		$form = FrmForm::getOne( $form_id );
486
        if ( ! $form ) {
487
            return;
488
        }
489
490
		$params = FrmForm::get_params( $form );
491
492
        if ( ! isset( $frm_vars['form_params'] ) ) {
493
            $frm_vars['form_params'] = array();
494
        }
495
		$frm_vars['form_params'][ $form->id ] = $params;
496
497
		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
498
            return;
499
        }
500
501
        if ( $errors == '' && ! $ajax ) {
502
			$errors = FrmEntryValidate::validate( $_POST );
503
        }
504
505
		/**
506
		 * Use this filter to add trigger actions and add errors after
507
		 * all other errors have been processed
508
		 * @since 2.0.6
509
		 */
510
		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
511
512
		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
513
514
        if ( empty( $errors ) ) {
515
			$_POST['frm_skip_cookie'] = 1;
516
            if ( $params['action'] == 'create' ) {
517
				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
518
					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
519
                }
520
            }
521
522
            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
523
			unset( $_POST['frm_skip_cookie'] );
524
        }
525
    }
526
527
    public static function delete_entry_before_redirect( $url, $form, $atts ) {
528
        self::_delete_entry( $atts['id'], $form );
529
        return $url;
530
    }
531
532
    //Delete entry if not redirected
533
    public static function delete_entry_after_save( $atts ) {
534
        self::_delete_entry( $atts['entry_id'], $atts['form'] );
535
    }
536
537
    private static function _delete_entry( $entry_id, $form ) {
538
        if ( ! $form ) {
539
            return;
540
        }
541
542
        $form->options = maybe_unserialize( $form->options );
543
        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
544
            FrmEntry::destroy( $entry_id );
545
        }
546
    }
547
548
	/**
549
	 * @param $atts
550
	 *
551
	 * @return array|string
552
	 */
553
	public static function show_entry_shortcode( $atts ) {
554
		$defaults = array(
555
			'id'             => false,
556
			'entry'          => false,
557
			'fields'         => false,
558
			'plain_text'     => false,
559
			'user_info'      => false,
560
			'include_blank'  => false,
561
			'default_email'  => false,
562
			'form_id'        => false,
563
			'format'         => 'text',
564
			'array_key'      => 'key',
565
			'direction'      => 'ltr',
566
			'font_size'      => '',
567
			'text_color'     => '',
568
			'border_width'   => '',
569
			'border_color'   => '',
570
			'bg_color'       => '',
571
			'alt_bg_color'   => '',
572
			'clickable'      => false,
573
			'exclude_fields' => '',
574
			'include_fields' => '',
575
			'include_extras' => '',
576
			'inline_style'   => 1,
577
		);
578
579
		$atts = shortcode_atts( $defaults, $atts );
580
581
		if ( $atts['default_email'] ) {
582
			$shortcode_atts = array( 'format' => $atts['format'], 'plain_text' => $atts['plain_text'] );
583
			$entry_shortcode_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
584
			$formatted_entry = $entry_shortcode_formatter->content();
585
586
		} else {
587
588
			$entry_formatter = FrmEntryFactory::entry_formatter_instance( $atts );
589
			$formatted_entry = $entry_formatter->get_formatted_entry_values();
590
591
		}
592
593
		return $formatted_entry;
594
	}
595
596
	public static function get_params( $form = null ) {
597
		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
598
		return FrmForm::get_params( $form );
599
	}
600
601
	public static function entry_sidebar( $entry ) {
602
        $data = maybe_unserialize($entry->description);
603
        $date_format = get_option('date_format');
604
        $time_format = get_option('time_format');
605
		if ( isset( $data['browser'] ) ) {
606
			$browser = FrmEntriesHelper::get_browser( $data['browser'] );
607
		}
608
609
		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
610
    }
611
612
	/***********************************************************************
613
	 * Deprecated Functions
614
	 ************************************************************************/
615
616
	/**
617
	 * @deprecated 2.02.14
618
	 *
619
	 * @return mixed
620
	 */
621
	public static function filter_email_value( $value ) {
622
		_deprecated_function( __FUNCTION__, '2.02.14', 'FrmProEntriesController::filter_value_in_single_entry_table' );
623
		return $value;
624
	}
625
626
	/**
627
	 * @deprecated 2.02.14
628
	 *
629
	 * @return mixed
630
	 */
631
	public static function filter_display_value( $value ) {
632
		_deprecated_function( __FUNCTION__, '2.02.14', 'FrmProEntriesController::filter_display_value' );
633
		return $value;
634
	}
635
636
	/**
637
	 * @deprecated 2.03.04
638
	 *
639
	 * @return mixed
640
	 */
641
	public static function filter_shortcode_value( $value ) {
642
		_deprecated_function( __FUNCTION__, '2.03.04', 'custom code' );
643
		return $value;
644
	}
645
}
646