| 1 |
<?php |
| 2 |
/** |
| 3 |
* @var string $domain |
| 4 |
* @var array<forge12\contactform7\CF7DoubleOptIn\OptIn> $listOfOptIns |
| 5 |
* @var int $numberOfPages |
| 6 |
* @var int $currentPage |
| 7 |
* @var string $slug |
| 8 |
*/ |
| 9 |
?> |
| 10 |
<form action="" method="get"> |
| 11 |
<input type="hidden" name="page" value="<?php esc_attr_e( sanitize_text_field( $_GET['page'] ) ); ?>"/> |
| 12 |
<input type="hidden" name="pageNum" value="<?php esc_attr_e( $currentPage ); ?>"/> |
| 13 |
<?php if ( isset( $_GET['id'] ) ): ?> |
| 14 |
<input type="hidden" name="id" value="<?php esc_attr_e( (int) $_GET['id'] ); ?>"/> |
| 15 |
<?php endif; ?> |
| 16 |
<ul class="ui-table-filter"> |
| 17 |
<?php do_action( 'f12_cf7_doubleoptin_ui_table_filter' ); ?> |
| 18 |
</ul> |
| 19 |
</form> |
| 20 |
|
| 21 |
<form action="" method="post"> |
| 22 |
<table> |
| 23 |
<tr> |
| 24 |
<th></th> |
| 25 |
<th> |
| 26 |
<?php _e( 'ID', 'double-opt-in' ); ?> |
| 27 |
</th> |
| 28 |
<th> |
| 29 |
<?php _e( 'Hash', 'double-opt-in' ); ?> |
| 30 |
</th> |
| 31 |
<th> |
| 32 |
<?php _e( 'E-Mail', 'double-opt-in' ); ?> |
| 33 |
</th> |
| 34 |
<th> |
| 35 |
<?php _e( 'Category', 'double-opt-in' ); ?> |
| 36 |
</th> |
| 37 |
<th> |
| 38 |
<?php _e( 'Form ID', 'double-opt-in' ); ?> |
| 39 |
</th> |
| 40 |
<th> |
| 41 |
<?php _e( 'Confirmed ? ', 'double-opt-in' ); ?> |
| 42 |
</th> |
| 43 |
<th> |
| 44 |
<?php _e( 'Registration Date', 'double-opt-in' ); ?> |
| 45 |
</th> |
| 46 |
</tr> |
| 47 |
<?php foreach ( $listOfOptIns as $OptIn /** @var OptIn $OptIn */ ) : ?> |
| 48 |
<tr> |
| 49 |
<td> |
| 50 |
<input type="checkbox" name="optin-id[]" value="<?php esc_attr_e( $OptIn->get_id() ); ?>"/> |
| 51 |
</td> |
| 52 |
<td> |
| 53 |
<div class="f12-cf7-details" data-hash="<?php esc_attr_e( $OptIn->get_hash() ); ?>"> |
| 54 |
<?php echo esc_html( $OptIn->get_id() ); ?> |
| 55 |
</div> |
| 56 |
</td> |
| 57 |
<td> |
| 58 |
<a href="javascript:void(0)" class="f12-cf7-details" |
| 59 |
data-hash="<?php esc_attr_e( $OptIn->get_hash() ); ?>" |
| 60 |
title="<?php _e( 'Show details', 'double-opt-in' ); ?>"><?php esc_attr_e( $OptIn->get_hash() ); ?></a> |
| 61 |
<div class="on-hover"> |
| 62 |
<a href="<?php echo admin_url( 'admin.php?page=f12-cf7-doubleoptin_optin_view&hash=' . esc_attr( $OptIn->get_hash() ) ); ?>"><?php _e( 'Details', 'double-opt-in' ); ?></a> |
| 63 |
</div> |
| 64 |
</td> |
| 65 |
<td> |
| 66 |
<div class="f12-cf7-details"> |
| 67 |
<?php echo esc_html( $OptIn->get_email() ); ?> |
| 68 |
</div> |
| 69 |
</td> |
| 70 |
<td> |
| 71 |
<?php |
| 72 |
if ( 0 === $OptIn->get_category() ) { |
| 73 |
echo '---'; |
| 74 |
} else { |
| 75 |
$Category = \forge12\contactform7\CF7DoubleOptIn\Category::get_by_id( $OptIn->get_category() ); |
| 76 |
|
| 77 |
if ( null === $Category ) { |
| 78 |
echo '---'; |
| 79 |
} else { |
| 80 |
$link = admin_url( 'admin.php' ) . '?page=f12-cf7-doubleoptin_categories_view&id=' . esc_attr( $Category->get_id() ); |
| 81 |
echo '<a href="' . esc_url_raw( $link ) . '">' . esc_attr( $Category->get_name() ) . '</a>'; |
| 82 |
} |
| 83 |
} |
| 84 |
?> |
| 85 |
</td> |
| 86 |
<td> |
| 87 |
<?php |
| 88 |
$form = ''; |
| 89 |
|
| 90 |
$link = $OptIn->get_form_link(); |
| 91 |
$name = $OptIn->get_form_name(); |
| 92 |
|
| 93 |
if ( ! empty( $link ) ) { |
| 94 |
$form = sprintf( '<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>', $link, $name ); |
| 95 |
} else { |
| 96 |
$form = $name; |
| 97 |
} |
| 98 |
echo wp_kses( $form, array( 'a' => array( 'href' => array(), 'target' => '', 'rel' => '' ) ) ); |
| 99 |
?> |
| 100 |
</td> |
| 101 |
<td> |
| 102 |
<?php if ( $OptIn->is_confirmed() ): ?> |
| 103 |
<div class="dashicons dashicons-yes"></div> |
| 104 |
<?php else: ?> |
| 105 |
<div class="dashicons dashicons-no"></div> |
| 106 |
<?php endif; ?> |
| 107 |
|
| 108 |
<?php ( $OptIn->is_confirmed() ) ? _e( 'Yes', 'double-opt-in' ) : _e( 'No', 'double-opt-in' ); ?> |
| 109 |
</td> |
| 110 |
<td> |
| 111 |
<?php |
| 112 |
/** |
| 113 |
* Compatibility < 1.3.2 |
| 114 |
*/ |
| 115 |
echo esc_html( $OptIn->get_createtime( 'formatted' ) ); |
| 116 |
?> |
| 117 |
</td> |
| 118 |
</tr> |
| 119 |
<?php endforeach; ?> |
| 120 |
</table> |
| 121 |
<ul class="ui-table-options"> |
| 122 |
<?php do_action( 'f12_cf7_doubleoptin_ui_table_options' ); ?> |
| 123 |
<?php wp_nonce_field( 'f12_cf7_doubleoptin_ui_table_options_action', 'f12_cf7_doubleoptin_ui_table_options_nonce' ); ?> |
| 124 |
</ul> |
| 125 |
</form> |
| 126 |
<div class="tablenav-pages"> |
| 127 |
<form action="<?php echo admin_url( 'admin.php' ); ?>" method="get"> |
| 128 |
<span class="pagination-links"> |
| 129 |
<?php |
| 130 |
$startPage = max( $currentPage - 5, 1 ); |
| 131 |
$endPage = min( $currentPage + 5, $numberOfPages ); |
| 132 |
|
| 133 |
// if currentPage greater than 1, then show first and previous page links |
| 134 |
if ( $currentPage > 1 ): ?> |
| 135 |
<a class="first-page button" |
| 136 |
href="<?php echo esc_url( apply_filters( 'f12_cf7_doubleoptin_pagination_link', admin_url( 'admin.php' ), array( |
| 137 |
'page' => sanitize_text_field( $_GET['page'] ), |
| 138 |
'pageNum' => 1 |
| 139 |
) ) ); ?>"> |
| 140 |
<span class="screen-reader-text"><?php _e( 'First Page', 'double-opt-in' ); ?></span><span |
| 141 |
aria-hidden="true">«</span> |
| 142 |
</a> |
| 143 |
<a class="previous-page button" |
| 144 |
href="<?php echo esc_url( apply_filters( 'f12_cf7_doubleoptin_pagination_link', admin_url( 'admin.php' ), array( |
| 145 |
'page' => sanitize_text_field( $_GET['page'] ), |
| 146 |
'pageNum' => ( $currentPage - 1 ) |
| 147 |
) ) ); ?>"> |
| 148 |
<span class="screen-reader-text"><?php _e( 'Previous Page', 'double-opt-in' ); ?></span><span |
| 149 |
aria-hidden="true">‹</span> |
| 150 |
</a> |
| 151 |
<?php else: ?> |
| 152 |
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span> |
| 153 |
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span> |
| 154 |
<?php endif; |
| 155 |
|
| 156 |
// form for current page input |
| 157 |
?> |
| 158 |
<span class="paging-input"> |
| 159 |
<input type="hidden" name="page" value="<?php echo sanitize_text_field( $_GET['page'] ); ?>"> |
| 160 |
<input name="pageNum" class="current-page" type="number" min="1" max="<?php echo $numberOfPages; ?>" |
| 161 |
value="<?php echo $currentPage; ?>" onchange="this.form.submit()"> |
| 162 |
<span class="tablenav-paging-text"> <?php _e( 'of' ); ?><span |
| 163 |
class="total-pages"> / <?php echo $numberOfPages; ?></span></span> |
| 164 |
</span> |
| 165 |
<?php |
| 166 |
|
| 167 |
// if currentPage less than numberOfPages, then show next and last page links |
| 168 |
if ( $currentPage < $numberOfPages ): ?> |
| 169 |
<a class="next-page button" |
| 170 |
href="<?php echo esc_url( apply_filters( 'f12_cf7_doubleoptin_pagination_link', admin_url( 'admin.php' ), array( |
| 171 |
'page' => sanitize_text_field( $_GET['page'] ), |
| 172 |
'pageNum' => ( $currentPage + 1 ) |
| 173 |
) ) ); ?>"> |
| 174 |
<span class="screen-reader-text"><?php _e( 'Next Page', 'double-opt-in' ); ?></span><span |
| 175 |
aria-hidden="true">›</span> |
| 176 |
</a> |
| 177 |
<a class="last-page button" |
| 178 |
href="<?php echo esc_url( apply_filters( 'f12_cf7_doubleoptin_pagination_link', admin_url( 'admin.php' ), array( |
| 179 |
'page' => sanitize_text_field( $_GET['page'] ), |
| 180 |
'pageNum' => $numberOfPages |
| 181 |
) ) ); ?>"> |
| 182 |
<span class="screen-reader-text"><?php _e( 'Last Page', 'double-opt-in' ); ?></span><span |
| 183 |
aria-hidden="true">»</span> |
| 184 |
</a> |
| 185 |
<?php else: ?> |
| 186 |
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span> |
| 187 |
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span> |
| 188 |
<?php endif; ?> |
| 189 |
</span> |
| 190 |
|
| 191 |
</form> |
| 192 |
</div> |