Completed
Push — master ( c8461e...05dfa7 )
by Stephanie
21s queued 10s
created

FrmEntriesHelper::maybe_set_other_validation()   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
nc 3
nop 3
dl 0
loc 21
rs 8.9617
c 0
b 0
f 0
1
<?php
2
if ( ! defined( 'ABSPATH' ) ) {
3
	die( 'You are not allowed to call this page directly.' );
4
}
5
6
class FrmEntriesHelper {
7
8
	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
		$values = array(
10
			'name'        => '',
11
			'description' => '',
12
			'item_key'    => '',
13
		);
14
15
		$values['fields'] = array();
16
		if ( empty( $fields ) ) {
17
			return apply_filters( 'frm_setup_new_entry', $values );
18
		}
19
20
		foreach ( (array) $fields as $field ) {
21
			$original_default = $field->default_value;
22
			self::prepare_field_default_value( $field );
23
			$new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
24
25
			$field_array                     = FrmAppHelper::start_field_array( $field );
26
			$field_array['value']            = $new_value;
27
			$field_array['type']             = apply_filters( 'frm_field_type', $field->type, $field, $new_value );
28
			$field_array['parent_form_id']   = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
29
			$field_array['reset_value']      = $reset;
30
			$field_array['in_embed_form']    = isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0';
31
			$field_array['original_default'] = $original_default;
32
33
			FrmFieldsHelper::prepare_new_front_field( $field_array, $field, $args );
34
35
			$field_array = array_merge( $field->field_options, $field_array );
36
37
			$values['fields'][] = $field_array;
38
39
			if ( ! $form || ! isset( $form->id ) ) {
40
				$form = FrmForm::getOne( $field->form_id );
41
			}
42
		}
43
44
		$form->options = maybe_unserialize( $form->options );
45
		if ( is_array( $form->options ) ) {
46
			$values = array_merge( $values, $form->options );
47
		}
48
49
		$form_defaults = FrmFormsHelper::get_default_opts();
50
		$frm_settings  = FrmAppHelper::get_settings();
51
52
		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
53
54
		$values = array_merge( $form_defaults, $values );
55
56
		return apply_filters( 'frm_setup_new_entry', $values );
57
	}
58
59
	/**
60
	 * @since 2.05
61
	 *
62
	 * @param object $field
63
	 */
64
	private static function prepare_field_default_value( &$field ) {
65
		//If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array
66
		$return_array = FrmField::is_field_with_multiple_values( $field );
67
68
		/**
69
		 * Do any shortcodes in default value and allow customization of default value.
70
		 * Calls FrmProFieldsHelper::get_default_value
71
		 */
72
		$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array );
73
74
		if ( isset( $field->field_options['placeholder'] ) ) {
75
			$field->field_options['placeholder'] = apply_filters( 'frm_get_default_value', $field->field_options['placeholder'], $field, false, false );
76
		}
77
	}
78
79
	/**
80
	 * Set the value for each field
81
	 * This function is used when the form is first loaded and on all page turns *for a new entry*
82
	 *
83
	 * @since 2.0.13
84
	 *
85
	 * @param object $field - this is passed by reference since it is an object
86
	 * @param boolean $reset
87
	 * @param array $args
88
	 *
89
	 * @return string|array $new_value
90
	 */
91
	private static function get_field_value_for_new_entry( $field, $reset, $args ) {
92
		$new_value = $field->default_value;
93
94
		if ( ! $reset && self::value_is_posted( $field, $args ) ) {
95
			self::get_posted_value( $field, $new_value, $args );
96
		}
97
98
		if ( ! is_array( $new_value ) ) {
99
			$new_value = str_replace( '"', '&quot;', $new_value );
100
		}
101
102
		return $new_value;
103
	}
104
105
	/**
106
	 * Check if a field has a posted value
107
	 *
108
	 * @since 2.01.0
109
	 *
110
	 * @param object $field
111
	 * @param array $args
112
	 *
113
	 * @return boolean $value_is_posted
114
	 */
115
	public static function value_is_posted( $field, $args ) {
116
		$value_is_posted = false;
117
		if ( $_POST ) {
118
			$repeating = isset( $args['repeating'] ) && $args['repeating'];
119
			if ( $repeating ) {
120
				if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) {
121
					$value_is_posted = true;
122
				}
123
			} elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) {
124
				$value_is_posted = true;
125
			}
126
		}
127
128
		return $value_is_posted;
129
	}
130
131
	public static function setup_edit_vars( $values, $record ) {
132
		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
133
		$values['form_id']  = $record->form_id;
134
		$values['is_draft'] = $record->is_draft;
135
136
		return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
137
	}
138
139
	public static function replace_default_message( $message, $atts ) {
140
		if ( strpos( $message, '[default-message' ) === false &&
141
			strpos( $message, '[default_message' ) === false &&
142
			! empty( $message ) ) {
143
			return $message;
144
		}
145
146
		if ( empty( $message ) ) {
147
			$message = '[default-message]';
148
		}
149
150
		preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
151
152
		foreach ( $shortcodes[0] as $short_key => $tag ) {
153
			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
154
			if ( ! empty( $add_atts ) ) {
155
				$this_atts = array_merge( $atts, $add_atts );
156
			} else {
157
				$this_atts = $atts;
158
			}
159
160
			$default = FrmEntriesController::show_entry_shortcode( $this_atts );
161
162
			// Add the default message.
163
			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
164
		}
165
166
		return $message;
167
	}
168
169
	public static function prepare_display_value( $entry, $field, $atts ) {
170
		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
171
172
		if ( FrmAppHelper::pro_is_installed() ) {
173
			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
174
		}
175
176
		if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
177
			return self::display_value( $field_value, $field, $atts );
178
		}
179
180
		// This is an embeded form.
181
		$val = '';
182
183
		if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
184
			// This is a repeating section.
185
			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
186
		} else {
187
			// Get all values for this field.
188
			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
189
190
			if ( $child_values ) {
191
				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
192
			}
193
		}
194
195
		$field_value = array();
196
197
		if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
198
			return $val;
199
		}
200
201
		foreach ( $child_entries as $child_entry ) {
202
			$atts['item_id'] = $child_entry->id;
203
			$atts['post_id'] = $child_entry->post_id;
204
205
			// Fet the value for this field -- check for post values as well.
206
			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
207
208
			if ( $entry_val ) {
209
				// foreach entry get display_value.
210
				$field_value[] = self::display_value( $entry_val, $field, $atts );
211
			}
212
213
			unset( $child_entry );
214
		}
215
216
		$val = implode( ', ', (array) $field_value );
217
218
		return FrmAppHelper::kses( $val, 'all' );
219
	}
220
221
	/**
222
	 * Prepare the saved value for display
223
	 *
224
	 * @param array|string $value
225
	 * @param object $field
226
	 * @param array $atts
227
	 *
228
	 * @return string
229
	 */
230
	public static function display_value( $value, $field, $atts = array() ) {
231
232
		$defaults = array(
233
			'type'          => '',
234
			'html'          => false,
235
			'show_filename' => true,
236
			'truncate'      => false,
237
			'sep'           => ', ',
238
			'post_id'       => 0,
239
			'form_id'       => $field->form_id,
240
			'field'         => $field,
241
			'keepjs'        => 0,
242
			'return_array'  => false,
243
		);
244
245
		$atts = wp_parse_args( $atts, $defaults );
246
247
		if ( FrmField::is_image( $field ) || $field->type == 'star' ) {
248
			$atts['truncate'] = false;
249
			$atts['html']     = true;
250
		}
251
252
		$atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
253
254
		if ( ! isset( $field->field_options['post_field'] ) ) {
255
			$field->field_options['post_field'] = '';
256
		}
257
258
		if ( ! isset( $field->field_options['custom_field'] ) ) {
259
			$field->field_options['custom_field'] = '';
260
		}
261
262
		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
263
			$atts['pre_truncate'] = $atts['truncate'];
264
			$atts['truncate']     = true;
265
			$atts['exclude_cat']  = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
266
267
			$value            = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
268
			$atts['truncate'] = $atts['pre_truncate'];
269
		}
270
271
		if ( $value == '' ) {
272
			return $value;
273
		}
274
275
		$unfiltered_value = maybe_unserialize( $value );
276
277
		$value = apply_filters( 'frm_display_value_custom', $unfiltered_value, $field, $atts );
278
		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
279
280
		if ( $value == $unfiltered_value ) {
281
			$value = FrmFieldsHelper::get_unfiltered_display_value( compact( 'value', 'field', 'atts' ) );
282
		}
283
284
		if ( $atts['truncate'] && $atts['type'] != 'url' ) {
285
			$value = FrmAppHelper::truncate( $value, 50 );
286
		}
287
288
		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
289
			$value = FrmAppHelper::kses( $value, 'all' );
290
		}
291
292
		return apply_filters( 'frm_display_value', $value, $field, $atts );
293
	}
294
295
	public static function set_posted_value( $field, $value, $args ) {
296
		// If validating a field with "other" opt, set back to prev value now.
297
		if ( isset( $args['other'] ) && $args['other'] ) {
298
			$value = $args['temp_value'];
299
		}
300
		if ( empty( $args['parent_field_id'] ) ) {
301
			$_POST['item_meta'][ $field->id ] = $value;
302
		} else {
303
			self::set_parent_field_posted_value( $field, $value, $args );
304
		}
305
	}
306
307
	public static function set_parent_field_posted_value( $field, $value, $args ) {
308
		// init arrays if necessary, else we get fatal error
309
		if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && 
310
			 is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) {
311
312
			if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ||
313
				 ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) {
314
				$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array();
315
			}
316
		} else {
317
			// All of the section was probably removed.
318
			$_POST['item_meta'][ $args['parent_field_id'] ] = array();
319
			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array();
320
		}
321
322
		$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
323
	}
324
325
	public static function get_posted_value( $field, &$value, $args ) {
326
		$field_id = is_object( $field ) ? $field->id : $field;
327
328
		if ( empty( $args['parent_field_id'] ) ) {
329
			$value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : '';
330
		} else {
331
			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : '';
332
		}
333
334
		if ( is_array( $field ) ) {
335
			$field_obj = FrmFieldFactory::get_field_object( $field['id'] );
336
		} else {
337
			$field_obj = FrmFieldFactory::get_field_object( $field );
338
		}
339
340
		$field_obj->sanitize_value( $value );
341
	}
342
343
	/**
344
	 * Check if field has an "Other" option and if any other values are posted
345
	 *
346
	 * @since 2.0
347
	 *
348
	 * @param object $field
349
	 * @param string|array $value
350
	 * @param array $args
351
	 */
352
	public static function maybe_set_other_validation( $field, &$value, &$args ) {
353
		$args['other'] = false;
354
		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
355
			return;
356
		}
357
358
		// Get other value for fields in repeating section.
359
		self::set_other_repeating_vals( $field, $value, $args );
360
361
		// Check if there are any posted "Other" values.
362
		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
363
364
			// Save original value.
365
			$args['temp_value'] = $value;
366
			$args['other']      = true;
367
			$other_vals         = wp_unslash( $_POST['item_meta']['other'][ $field->id ] );
368
369
			// Set the validation value now
370
			self::set_other_validation_val( $value, $other_vals, $field, $args );
371
		}
372
	}
373
374
	/**
375
	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
376
	 *
377
	 * @since 2.0
378
	 *
379
	 * @param object $field
380
	 * @param string|array $value
381
	 * @param array $args
382
	 */
383
	public static function set_other_repeating_vals( $field, &$value, &$args ) {
384
		if ( ! $args['parent_field_id'] ) {
385
			return;
386
		}
387
388
		// Check if there are any other posted "other" values for this field.
389
		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
390
			// Save original value
391
			$args['temp_value'] = $value;
392
			$args['other']      = true;
393
394
			$other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] );
395
396
			// Set the validation value now.
397
			self::set_other_validation_val( $value, $other_vals, $field, $args );
398
		}
399
	}
400
401
	/**
402
	 * Modify value used for validation
403
	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
404
	 * It also adds any text from the free text fields to the value
405
	 *
406
	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
407
	 *
408
	 * @since 2.0
409
	 *
410
	 * @param string|array $value
411
	 * @param string|array $other_vals (usually of posted values)
412
	 * @param object $field
413
	 * @param array $args
414
	 */
415
	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
416
		// Checkboxes and multi-select dropdowns.
417
		if ( is_array( $value ) && $field->type == 'checkbox' ) {
418
			// Combine "Other" values with checked values. "Other" values will override checked box values.
419
			$value = array_merge( $value, $other_vals );
420
			$value = array_filter( $value );
421
			if ( count( $value ) == 0 ) {
422
				$value = '';
423
			}
424
		} else {
425
			// Radio and dropdowns.
426
			$other_key = array_filter( array_keys( $field->options ), 'is_string' );
427
			$other_key = reset( $other_key );
428
429
			// Multi-select dropdown.
430
			if ( is_array( $value ) ) {
431
				$o_key = array_search( $field->options[ $other_key ], $value );
432
433
				if ( $o_key !== false ) {
434
					// Modify the original value so other key will be preserved.
435
					$value[ $other_key ] = $value[ $o_key ];
436
437
					// By default, the array keys will be numeric for multi-select dropdowns.
438
					// If going backwards and forwards between pages, the array key will match the other key.
439
					if ( $o_key !== $other_key ) {
440
						unset( $value[ $o_key ] );
441
					}
442
443
					$args['temp_value']  = $value;
444
					$value[ $other_key ] = reset( $other_vals );
445
					if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) {
446
						unset( $value[ $other_key ] );
447
					}
448
				}
449
			} elseif ( $field->options[ $other_key ] == $value ) {
450
				$value = $other_vals;
451
			}
452
		}
453
	}
454
455
	/**
456
	 * Add submitted values to a string for spam checking.
457
	 *
458
	 * @param array $values
459
	 */
460
	public static function entry_array_to_string( $values ) {
461
		$content = '';
462
		foreach ( $values['item_meta'] as $val ) {
463
			if ( $content != '' ) {
464
				$content .= "\n\n";
465
			}
466
467
			if ( is_array( $val ) ) {
468
				$val = FrmAppHelper::array_flatten( $val );
469
				$val = implode( ', ', $val );
470
			}
471
472
			$content .= $val;
473
		}
474
475
		return $content;
476
	}
477
478
	/**
479
	 * Get the browser from the user agent
480
	 *
481
	 * @since 2.04
482
	 *
483
	 * @param string $u_agent
484
	 *
485
	 * @return string
486
	 */
487
	public static function get_browser( $u_agent ) {
488
		$bname    = __( 'Unknown', 'formidable' );
489
		$platform = __( 'Unknown', 'formidable' );
490
		$ub       = '';
491
492
		// Get the operating system
493
		if ( preg_match( '/windows|win32/i', $u_agent ) ) {
494
			$platform = 'Windows';
495
		} elseif ( preg_match( '/android/i', $u_agent ) ) {
496
			$platform = 'Android';
497
		} elseif ( preg_match( '/linux/i', $u_agent ) ) {
498
			$platform = 'Linux';
499
		} elseif ( preg_match( '/macintosh|mac os x/i', $u_agent ) ) {
500
			$platform = 'OS X';
501
		}
502
503
		$agent_options = array(
504
			'Chrome'   => 'Google Chrome',
505
			'Safari'   => 'Apple Safari',
506
			'Opera'    => 'Opera',
507
			'Netscape' => 'Netscape',
508
			'Firefox'  => 'Mozilla Firefox',
509
		);
510
511
		// Next get the name of the useragent yes seperately and for good reason
512
		if ( strpos( $u_agent, 'MSIE' ) !== false && strpos( $u_agent, 'Opera' ) === false ) {
513
			$bname = 'Internet Explorer';
514
			$ub    = 'MSIE';
515
		} else {
516
			foreach ( $agent_options as $agent_key => $agent_name ) {
517
				if ( strpos( $u_agent, $agent_key ) !== false ) {
518
					$bname = $agent_name;
519
					$ub    = $agent_key;
520
					break;
521
				}
522
			}
523
		}
524
525
		// finally get the correct version number
526
		$known   = array( 'Version', $ub, 'other' );
527
		$pattern = '#(?<browser>' . join( '|', $known ) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
528
		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
529
530
		// see how many we have
531
		$i = count( $matches['browser'] );
532
533
		if ( $i > 1 ) {
534
			//we will have two since we are not using 'other' argument yet
535
			//see if version is before or after the name
536
			if ( strripos( $u_agent, 'Version' ) < strripos( $u_agent, $ub ) ) {
537
				$version = $matches['version'][0];
538
			} else {
539
				$version = $matches['version'][1];
540
			}
541
		} elseif ( $i === 1 ) {
542
			$version = $matches['version'][0];
543
		} else {
544
			$version = '';
545
		}
546
547
		// check if we have a number
548
		if ( $version == '' ) {
549
			$version = '?';
550
		}
551
552
		return $bname . ' ' . $version . ' / ' . $platform;
553
	}
554
555
	/**
556
	 * @since 3.0
557
	 */
558
	public static function actions_dropdown( $atts ) {
559
		$id    = isset( $atts['id'] ) ? $atts['id'] : FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
560
		$links = self::get_action_links( $id, $atts['entry'] );
561
562
		foreach ( $links as $link ) {
563
			?>
564
		<div class="misc-pub-section">
565
			<a href="<?php echo esc_url( FrmAppHelper::maybe_full_screen_link( $link['url'] ) ); ?>"
566
				<?php
567 View Code Duplication
				if ( isset( $link['data'] ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
568
					foreach ( $link['data'] as $data => $value ) {
569
						echo 'data-' . esc_attr( $data ) . '="' . esc_attr( $value ) . '" ';
570
					}
571
				}
572
				if ( isset( $link['class'] ) ) {
573
					echo 'class="' . esc_attr( $link['class'] ) . '" ';
574
				}
575
				if ( isset( $link['id'] ) ) {
576
					echo 'id="' . esc_attr( $link['id'] ) . '" ';
577
				}
578
				?>
579
				>
580
				<?php FrmAppHelper::icon_by_class( $link['icon'], array( 'aria-hidden' => 'true' ) ); ?>
581
				<span class="frm_link_label"><?php echo esc_html( $link['label'] ); ?></span>
582
			</a>
583
		</div>
584
			<?php
585
		}
586
	}
587
588
	/**
589
	 * @since 3.0
590
	 */
591
	private static function get_action_links( $id, $entry ) {
592
		$page    = FrmAppHelper::get_param( 'frm_action' );
593
		$actions = array();
594
595
		if ( $page != 'show' ) {
596
			$actions['frm_view'] = array(
597
				'url'   => admin_url( 'admin.php?page=formidable-entries&frm_action=show&id=' . $id . '&form=' . $entry->form_id ),
598
				'label' => __( 'View Entry', 'formidable' ),
599
				'icon'  => 'frm_icon_font frm_save_icon',
600
			);
601
		}
602
603
		if ( current_user_can( 'frm_delete_entries' ) ) {
604
			$actions['frm_delete'] = array(
605
				'url'   => admin_url( 'admin.php?page=formidable-entries&frm_action=destroy&id=' . $id . '&form=' . $entry->form_id ),
606
				'label' => __( 'Delete Entry', 'formidable' ),
607
				'icon'  => 'frm_icon_font frm_delete_icon',
608
				'data'  => array(
609
					'frmverify' => __( 'Delete this form entry?', 'formidable' ),
610
				),
611
			);
612
		}
613
614
		if ( $page == 'show' ) {
615
			$actions['frm_print'] = array(
616
				'url'   => '#',
617
				'label' => __( 'Print Entry', 'formidable' ),
618
				'data'  => array(
619
					'frmprint' => '1',
620
				),
621
				'icon'  => 'frm_icon_font frm_printer_icon',
622
			);
623
		}
624
625
		$actions['frm_resend'] = array(
626
			'url'   => '#',
627
			'label' => __( 'Resend Emails', 'formidable' ),
628
			'class' => 'frm_noallow',
629
			'data'  => array(
630
				'upgrade' => __( 'Resend Emails', 'formidable' ),
631
				'medium'  => 'resend-email',
632
				'content' => 'entry',
633
			),
634
			'icon'  => 'frm_icon_font frm_email_icon',
635
		);
636
637
		$actions['frm_edit'] = array(
638
			'url'   => '#',
639
			'label' => __( 'Edit Entry', 'formidable' ),
640
			'class' => 'frm_noallow',
641
			'data'  => array(
642
				'upgrade' => __( 'Entry edits', 'formidable' ),
643
				'medium'  => 'edit-entries',
644
				'content' => 'entry',
645
			),
646
			'icon'  => 'frm_icon_font frm_pencil_icon',
647
		);
648
649
		return apply_filters( 'frm_entry_actions_dropdown', $actions, compact( 'id', 'entry' ) );
650
	}
651
}
652