| 1 |
<?php |
| 2 |
/** |
| 3 |
* @var \forge12\contactform7\CF7DoubleOptIn\OptIn $optin |
| 4 |
* @var string $domain |
| 5 |
*/ |
| 6 |
$formfields = maybe_unserialize( $optin->get_content() );; |
| 7 |
$Category = \forge12\contactform7\CF7DoubleOptIn\Category::get_by_id( $optin->get_category() ); |
| 8 |
$category_html = '---'; |
| 9 |
|
| 10 |
if ( null != $Category ) { |
| 11 |
$category_html = '<a href="' . esc_url( $Category->get_link_ui() ) . '">' . esc_attr( $Category->get_name() ) . '</a>'; |
| 12 |
} |
| 13 |
|
| 14 |
function flatten_array( $array, $prefix = '' ) { |
| 15 |
$result = array(); |
| 16 |
foreach ( $array as $key => $value ) { |
| 17 |
if ( is_array( $value ) ) { |
| 18 |
$result = $result + flatten_array( $value, $prefix . $key . '.' ); |
| 19 |
} else { |
| 20 |
$result[ $prefix . $key ] = $value; |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
return $result; |
| 25 |
} |
| 26 |
|
| 27 |
?> |
| 28 |
<script>hljs.highlightAll();</script> |
| 29 |
<p> |
| 30 |
<?php _e( 'Category', 'double-opt-in' ) ?> |
| 31 |
: <?php echo wp_kses( $category_html, array( 'a' => array( 'href' => array() ) ) ); ?> |
| 32 |
</p> |
| 33 |
<?php if ( current_user_can( 'manage_options' ) ): ?> |
| 34 |
<div class="options"> |
| 35 |
<?php |
| 36 |
/** |
| 37 |
* Opt-in View Options |
| 38 |
* |
| 39 |
* This action is used to extend the options for the pro version. |
| 40 |
* |
| 41 |
* @param \forge12\contactform7\CF7DoubleOptIn\OptIn $optin |
| 42 |
* |
| 43 |
* @since 3.0.0 |
| 44 |
*/ |
| 45 |
do_action( 'f12_cf7_doubleoptin_ui_view_optin_options', $optin ); |
| 46 |
?> |
| 47 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=f12-cf7-doubleoptin&option=delete&hash=' . $optin->get_hash() ) ); ?>" |
| 48 |
class="button" |
| 49 |
><?php _e( 'Delete DOI', 'double-opt-in' ); ?></a> |
| 50 |
</div> |
| 51 |
<?php endif; ?> |
| 52 |
<table class="view-optin"> |
| 53 |
<tr> |
| 54 |
<td><?php _e( 'Key', 'double-opt-in' ); ?></td> |
| 55 |
<td><?php _e( 'Value', 'double-opt-in' ); ?></td> |
| 56 |
</tr> |
| 57 |
<tr> |
| 58 |
<td> |
| 59 |
<?php _e( 'ID', 'double-opt-in' ); ?> |
| 60 |
</td> |
| 61 |
<td> |
| 62 |
<?php echo esc_html( $optin->get_id() ); ?> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
<tr> |
| 66 |
<td> |
| 67 |
<?php _e( 'CF7 Form ID', 'double-opt-in' ); ?> |
| 68 |
</td> |
| 69 |
<td> |
| 70 |
<?php echo esc_html( $optin->get_cf_form_id() ); ?> |
| 71 |
</td> |
| 72 |
</tr> |
| 73 |
<tr> |
| 74 |
<td> |
| 75 |
<?php _e( 'E-Mail', 'double-opt-in' ); ?> |
| 76 |
</td> |
| 77 |
<td> |
| 78 |
<?php echo esc_html( $optin->get_email() ); ?> |
| 79 |
</td> |
| 80 |
</tr> |
| 81 |
<tr> |
| 82 |
<td> |
| 83 |
<?php _e( 'Registration Date', 'double-opt-in' ); ?> |
| 84 |
</td> |
| 85 |
<td> |
| 86 |
<?php |
| 87 |
echo esc_html( $optin->get_createtime( 'formatted' ) ); |
| 88 |
?> |
| 89 |
</td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<td> |
| 93 |
<?php _e( 'Registration IP', 'double-opt-in' ); ?> |
| 94 |
</td> |
| 95 |
<td> |
| 96 |
<?php echo esc_html( $optin->get_ipaddr_register() ); ?> |
| 97 |
</td> |
| 98 |
</tr> |
| 99 |
<tr> |
| 100 |
<td> |
| 101 |
<?php _e( 'Confirmation Date', 'double-opt-in' ); ?> |
| 102 |
</td> |
| 103 |
<td> |
| 104 |
<?php |
| 105 |
if ( $optin->is_confirmed() ) { |
| 106 |
echo esc_html( $optin->get_updatetime( 'formatted' ) ); |
| 107 |
} |
| 108 |
?> |
| 109 |
</td> |
| 110 |
</tr> |
| 111 |
<tr> |
| 112 |
<td> |
| 113 |
<?php _e( 'Confirmation IP', 'double-opt-in' ); ?> |
| 114 |
</td> |
| 115 |
<td> |
| 116 |
<?php |
| 117 |
echo esc_html( $optin->get_ipaddr_confirmation() ); |
| 118 |
?> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
<?php |
| 122 |
/** |
| 123 |
* Opt-in View Table |
| 124 |
* |
| 125 |
* This action is used to extend the table for the pro version. |
| 126 |
* |
| 127 |
* @param \forge12\contactform7\CF7DoubleOptIn\OptIn $optin |
| 128 |
* |
| 129 |
* @since 3.0.0 |
| 130 |
*/ |
| 131 |
do_action( 'f12_cf7_doubleoptin_ui_view_optin_table', $optin ); |
| 132 |
?> |
| 133 |
</table> |
| 134 |
|
| 135 |
<h3><?php _e( 'Form Fields', 'double-opt-in' ); ?></h3> |
| 136 |
<table class="view-optin"> |
| 137 |
<tr> |
| 138 |
<td><?php _e( 'Key', 'double-opt-in' ); ?></td> |
| 139 |
<td><?php _e( 'Value', 'double-opt-in' ); ?></td> |
| 140 |
</tr> |
| 141 |
<?php if ( isset( $formfields['fields'] ) ): ?> |
| 142 |
<?php foreach ( $formfields['fields'] as $key => $value ): ?> |
| 143 |
<tr> |
| 144 |
<td> |
| 145 |
<?php echo esc_attr( $key ); ?> |
| 146 |
</td> |
| 147 |
<td> |
| 148 |
<?php if ( is_array( $value ) ) { |
| 149 |
echo esc_html( implode( ',', $value ) ); |
| 150 |
} else { |
| 151 |
echo esc_html( $value ); |
| 152 |
} |
| 153 |
?> |
| 154 |
</td> |
| 155 |
</tr> |
| 156 |
<?php endforeach; ?> |
| 157 |
<?php else: ?> |
| 158 |
<?php foreach ( $formfields as $key => $value ): ?> |
| 159 |
<tr> |
| 160 |
<td> |
| 161 |
<?php echo $key; ?> |
| 162 |
</td> |
| 163 |
<td> |
| 164 |
<?php if ( is_array( $value ) ): |
| 165 |
$flattened_array = flatten_array( $value ); |
| 166 |
|
| 167 |
?> |
| 168 |
<table> |
| 169 |
<tr> |
| 170 |
<td><?php _e( 'Key', 'double-opt-in' ); ?></td> |
| 171 |
<td><?php _e( 'Value', 'double-opt-in' ); ?></td> |
| 172 |
</tr> |
| 173 |
<?php if ( empty( $flattened_array ) ) : ?> |
| 174 |
<tr> |
| 175 |
<td colspan="2"><?php _e( 'No entries', 'double-opt-in' ); ?></td> |
| 176 |
</tr> |
| 177 |
<?php else: ?> |
| 178 |
<?php foreach ( $flattened_array as $k => $v ): ?> |
| 179 |
<tr> |
| 180 |
<td><?php esc_html_e( $k ); ?></td> |
| 181 |
<td><?php esc_html_e( $v ); ?>'</td> |
| 182 |
</tr> |
| 183 |
<?php endforeach; ?> |
| 184 |
<?php endif; ?> |
| 185 |
</table> |
| 186 |
<?php else: ?> |
| 187 |
<?php esc_html_e( $value ); ?> |
| 188 |
<?php endif; ?> |
| 189 |
</td> |
| 190 |
</tr> |
| 191 |
<?php endforeach; ?> |
| 192 |
<?php endif; ?> |
| 193 |
</table> |
| 194 |
|
| 195 |
</div> |
| 196 |
<div class="box"> |
| 197 |
<h2><?php _e( 'Formular', 'double-opt-in' ); ?></h2> |
| 198 |
<p> |
| 199 |
<?php _e( 'The data above was collected by the following form used from the visitor. The data has been saved as plain text. You can copy the plain content to a html file to see the original formular.', 'double-opt-in' ); ?> |
| 200 |
</p> |
| 201 |
<div class="option"> |
| 202 |
<div class="label"> |
| 203 |
<label for="category"><?php _e( 'HTML:', 'double-opt-in' ); ?></label> |
| 204 |
</div> |
| 205 |
<div class="input"> |
| 206 |
<pre> |
| 207 |
<code class="language-html"> |
| 208 |
<?php echo esc_html( $optin->get_form() ); ?> |
| 209 |
</code> |
| 210 |
</pre> |
| 211 |
</div> |
| 212 |
</div> |
| 213 |
</div> |
| 214 |
<div class="box"> |
| 215 |
<h2><?php _e( 'Opt-In Mail', 'double-opt-in' ); ?></h2> |
| 216 |
<p> |
| 217 |
<?php _e( 'The following Opt-In mail has been submitted to the visitor to get the confirmation. The data has been saved as plain text. Depending on the form it may contain html content.', 'double-opt-in' ); ?> |
| 218 |
</p> |
| 219 |
<div class="option"> |
| 220 |
<div class="label"> |
| 221 |
<label for="category"><?php _e( 'HTML:', 'double-opt-in' ); ?></label> |
| 222 |
</div> |
| 223 |
<div class="input"> |
| 224 |
<pre> |
| 225 |
<code class="language-html"> |
| 226 |
<?php echo esc_html( str_replace( '<br />', '\n', $optin->get_mail_optin() ) ); ?> |
| 227 |
</code> |
| 228 |
</pre> |
| 229 |
</div> |
| 230 |
</div> |