| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) or exit; |
| 4 |
$datetime_format = sprintf('%s %s', get_option( 'date_format' ), get_option( 'time_format' ) ); |
| 5 |
?> |
| 6 |
|
| 7 |
<h2><?php _e( 'Viewing Form Submission', 'html-forms' ); ?></h2> |
| 8 |
|
| 9 |
<div> |
| 10 |
<style type="text/css"> |
| 11 |
table.hf-bordered { |
| 12 |
font-size: 13px; |
| 13 |
border-collapse: collapse; |
| 14 |
border-spacing: 0; |
| 15 |
background: white; |
| 16 |
width: 100%; |
| 17 |
table-layout: fixed; |
| 18 |
} |
| 19 |
|
| 20 |
table.hf-bordered th, |
| 21 |
table.hf-bordered td { |
| 22 |
border: 1px solid #ddd; |
| 23 |
padding: 12px; |
| 24 |
} |
| 25 |
|
| 26 |
table.hf-bordered th { |
| 27 |
width: 160px; |
| 28 |
font-size: 14px; |
| 29 |
text-align: left; |
| 30 |
} |
| 31 |
</style> |
| 32 |
|
| 33 |
<div class="hf-small-margin"> |
| 34 |
<table class="hf-bordered"> |
| 35 |
<tbody> |
| 36 |
<tr> |
| 37 |
<th><?php _e( 'Timestamp', 'html-forms' ); ?></th> |
| 38 |
<td><?php echo date( $datetime_format, strtotime( $submission->submitted_at ) ); ?></td> |
| 39 |
</tr> |
| 40 |
<tr> |
| 41 |
<th><?php _e( 'User Agent', 'html-forms' ); ?></th> |
| 42 |
<td><?php echo esc_html( $submission->user_agent ); ?></td> |
| 43 |
</tr> |
| 44 |
<tr> |
| 45 |
<th><?php _e( 'IP Address', 'html-forms' ); ?></th> |
| 46 |
<td><?php echo esc_html( $submission->ip_address ); ?></td> |
| 47 |
</tr> |
| 48 |
<tr> |
| 49 |
<th><?php _e( 'Referrer URL', 'html-forms' ); ?></th> |
| 50 |
<td><?php echo sprintf( '<a href="%s">%s</a>', esc_attr( $submission->referer_url ), esc_html( $submission->referer_url ) ); ?></td> |
| 51 |
</tr> |
| 52 |
</tbody> |
| 53 |
</table> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="hf-small-margin"> |
| 57 |
<h3><?php _e( 'Fields', 'html-forms' ); ?></h3> |
| 58 |
<table class="hf-bordered"> |
| 59 |
<tbody> |
| 60 |
<?php |
| 61 |
if( is_array( $submission->data ) ) { |
| 62 |
foreach( $submission->data as $field => $value ) { |
| 63 |
if( is_array( $value ) ) { |
| 64 |
$value = join( ', ', $value ); |
| 65 |
} |
| 66 |
$value = esc_html( $value ); |
| 67 |
echo '<tr>'; |
| 68 |
echo sprintf( '<th>%s</th>', esc_html( ucfirst( strtolower( $field ) ) ) ); |
| 69 |
echo sprintf( '<td>%s</td>', nl2br( $value ) ); |
| 70 |
echo '</tr>'; |
| 71 |
} |
| 72 |
} ?> |
| 73 |
</tbody> |
| 74 |
</table> |
| 75 |
</div> |
| 76 |
|
| 77 |
</div> |
| 78 |
|
| 79 |
<div class="hf-small-margin"> |
| 80 |
<h3><?php _e( 'Raw', 'html-forms' ); ?></h3> |
| 81 |
<pre class="hf-well"><?php print_r( $submission ); ?></pre> |
| 82 |
</div> |
| 83 |
|
| 84 |
<div class="hf-small-margin"> |
| 85 |
<p><a href="<?php echo esc_attr( remove_query_arg( 'submission_id' ) ); ?>">‹ <?php _e( 'Back to submissions list', 'html-forms' ); ?></a></p> |
| 86 |
</div> |
| 87 |
|