index.php
237 lines
| 1 | <?php if ( ! defined( 'ABSPATH' ) ) exit; // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals ?> |
| 2 | <h4> |
| 3 | <?php if ($import->friendly_name): ?> |
| 4 | <em><?php printf( |
| 5 | /* translators: 1: import friendly name, 2: import ID */ |
| 6 | esc_html__('%1$s - ID: %2$s Import History', 'wp-all-import'), |
| 7 | esc_html($import->friendly_name), |
| 8 | intval($import->id) |
| 9 | ); ?></em> |
| 10 | <?php else: ?> |
| 11 | <em><?php printf( |
| 12 | /* translators: 1: import name, 2: import ID */ |
| 13 | esc_html__('%1$s - ID: %2$s Import History', 'wp-all-import'), |
| 14 | esc_html($import->name), |
| 15 | intval($import->id) |
| 16 | ); ?></em> |
| 17 | <?php endif ?> |
| 18 | </h4> |
| 19 | |
| 20 | <?php if ($this->errors->get_error_codes()): ?> |
| 21 | <?php $this->error() ?> |
| 22 | <?php endif ?> |
| 23 | |
| 24 | <?php |
| 25 | // define the columns to display, the syntax is 'internal name' => 'display name' |
| 26 | $columns = array( |
| 27 | 'id' => __('ID', 'wp-all-import'), |
| 28 | 'date' => __('Date', 'wp-all-import'), |
| 29 | 'time_run' => __('Run Time', 'wp-all-import'), |
| 30 | 'type' => __('Type', 'wp-all-import'), |
| 31 | 'summary' => __('Summary', 'wp-all-import'), |
| 32 | 'download' => '', |
| 33 | ); |
| 34 | ?> |
| 35 | |
| 36 | <?php if ( $import->triggered ): ?> |
| 37 | <p> <strong><?php esc_html_e('Scheduling Status', 'wp-all-import'); ?>:</strong> <?php esc_html_e('triggered', 'wp-all-import'); ?> <?php if ($import->processing) esc_html_e('and processing', 'wp-all-import'); ?>...</p> |
| 38 | <?php endif; ?> |
| 39 | |
| 40 | <form method="post" id="import-list" action="<?php echo esc_url(remove_query_arg('pmxi_nt')); ?>"> |
| 41 | <input type="hidden" name="action" value="bulk" /> |
| 42 | <?php wp_nonce_field('bulk-imports', '_wpnonce_bulk-imports') ?> |
| 43 | |
| 44 | <div class="tablenav"> |
| 45 | <div class="alignleft actions"> |
| 46 | <select name="bulk-action"> |
| 47 | <option value="" selected="selected"><?php esc_html_e('Bulk Actions', 'wp-all-import') ?></option> |
| 48 | <option value="delete"><?php esc_html_e('Delete', 'wp-all-import') ?></option> |
| 49 | </select> |
| 50 | <input type="submit" value="<?php esc_attr_e('Apply', 'wp-all-import') ?>" name="doaction" id="doaction" class="button-secondary action" /> |
| 51 | </div> |
| 52 | |
| 53 | <?php if ($page_links): ?> |
| 54 | <div class="tablenav-pages"> |
| 55 | <?php $page_links_html = sprintf( |
| 56 | /* translators: 1: from number, 2: to number, 3: total count, 4: page links HTML */ |
| 57 | '<span class="displaying-num">' . esc_html__('Displaying %1$s–%2$s of %3$s', 'wp-all-import') . '</span>%s', |
| 58 | esc_html(number_format_i18n(($pagenum - 1) * $perPage + 1)), |
| 59 | esc_html(number_format_i18n(min($pagenum * $perPage, $list->total()))), |
| 60 | esc_html(number_format_i18n($list->total())), |
| 61 | wp_kses_post($page_links) |
| 62 | ); echo wp_kses_post($page_links_html); ?> |
| 63 | </div> |
| 64 | <?php endif ?> |
| 65 | </div> |
| 66 | <div class="clear"></div> |
| 67 | |
| 68 | <table class="widefat pmxi-admin-imports"> |
| 69 | <thead> |
| 70 | <tr> |
| 71 | <th class="manage-column column-cb check-column" scope="col" style="padding: 8px 10px;"> |
| 72 | <input type="checkbox" style="margin-top:1px;"/> |
| 73 | </th> |
| 74 | <?php |
| 75 | $col_html = ''; |
| 76 | foreach ($columns as $column_id => $column_display_name) { |
| 77 | if ( ! in_array($column_id, array('download'))){ |
| 78 | $column_link = "<a href='"; |
| 79 | $order2 = 'ASC'; |
| 80 | if ($order_by == $column_id) |
| 81 | $order2 = ($order == 'DESC') ? 'ASC' : 'DESC'; |
| 82 | |
| 83 | $column_link .= esc_url(add_query_arg(array('id' => $id, 'order' => $order2, 'order_by' => $column_id), $this->baseUrl)); |
| 84 | $column_link .= "'>{$column_display_name}</a>"; |
| 85 | $col_html .= '<th scope="col" class="column-' . $column_id . ' ' . ($order_by == $column_id ? $order : '') . '">' . $column_link . '</th>'; |
| 86 | } |
| 87 | else $col_html .= '<th scope="col" class="column-' . $column_id . '">' . $column_display_name . '</th>'; |
| 88 | } |
| 89 | echo wp_kses_post($col_html); |
| 90 | ?> |
| 91 | </tr> |
| 92 | </thead> |
| 93 | <tfoot> |
| 94 | <tr> |
| 95 | <th class="manage-column column-cb check-column" scope="col" style="padding: 8px 10px;"> |
| 96 | <input type="checkbox" /> |
| 97 | </th> |
| 98 | <?php echo wp_kses_post($col_html); ?> |
| 99 | </tr> |
| 100 | </tfoot> |
| 101 | <tbody id="the-pmxi-admin-import-list" class="list:pmxi-admin-imports"> |
| 102 | <?php if ($list->isEmpty()): ?> |
| 103 | <tr> |
| 104 | <td colspan="<?php echo count($columns) + 1 ?>"><?php esc_html_e('No previous history found.', 'wp-all-import') ?></td> |
| 105 | </tr> |
| 106 | <?php else: ?> |
| 107 | <?php |
| 108 | $class = ''; |
| 109 | ?> |
| 110 | <?php foreach ($list as $item): ?> |
| 111 | <?php $class = ('alternate' == $class) ? '' : 'alternate'; ?> |
| 112 | <tr class="<?php echo esc_attr($class); ?>" valign="middle"> |
| 113 | <th scope="row" class="check-column" style="vertical-align: middle; padding: 8px 10px;"> |
| 114 | <input type="checkbox" id="item_<?php echo esc_attr($item['id']); ?>" name="items[]" value="<?php echo esc_attr($item['id']) ?>" /> |
| 115 | </th> |
| 116 | <?php foreach ($columns as $column_id => $column_display_name): ?> |
| 117 | <?php |
| 118 | switch ($column_id): |
| 119 | case 'id': |
| 120 | ?> |
| 121 | <th valign="top" scope="row" style="vertical-align: middle;"> |
| 122 | <?php echo esc_html($item['id']); ?> |
| 123 | </th> |
| 124 | <?php |
| 125 | break; |
| 126 | case 'date': |
| 127 | ?> |
| 128 | <td style="vertical-align: middle;"> |
| 129 | <?php if ('0000-00-00 00:00:00' == $item['date']): ?> |
| 130 | <em>never</em> |
| 131 | <?php else: ?> |
| 132 | <?php echo esc_html(get_date_from_gmt($item['date'], "m/d/Y g:i a")); ?> |
| 133 | <?php endif ?> |
| 134 | </td> |
| 135 | <?php |
| 136 | break; |
| 137 | case 'time_run': |
| 138 | ?> |
| 139 | <td style="vertical-align: middle;"> |
| 140 | <?php echo ($item['time_run'] and is_numeric($item['time_run'])) ? esc_html(gmdate("H:i:s", $item['time_run'])) : '-'; ?> |
| 141 | </td> |
| 142 | <?php |
| 143 | break; |
| 144 | case 'summary': |
| 145 | ?> |
| 146 | <td style="vertical-align: middle;"> |
| 147 | <?php echo esc_html($item['summary']);?> |
| 148 | </td> |
| 149 | <?php |
| 150 | break; |
| 151 | case 'type': |
| 152 | ?> |
| 153 | <td style="vertical-align: middle;"> |
| 154 | <?php |
| 155 | switch ($item['type']) { |
| 156 | case 'manual': |
| 157 | esc_html_e('manual run', 'wp-all-import'); |
| 158 | break; |
| 159 | case 'continue': |
| 160 | esc_html_e('continue run', 'wp-all-import'); |
| 161 | break; |
| 162 | case 'processing': |
| 163 | esc_html_e('cron processing', 'wp-all-import'); |
| 164 | break; |
| 165 | case 'trigger': |
| 166 | esc_html_e('triggered by cron', 'wp-all-import'); |
| 167 | break; |
| 168 | default: |
| 169 | # code... |
| 170 | break; |
| 171 | } |
| 172 | ?> |
| 173 | </td> |
| 174 | <?php |
| 175 | break; |
| 176 | case 'download': |
| 177 | ?> |
| 178 | <td style="vertical-align: middle;"> |
| 179 | <?php |
| 180 | if ( ! in_array($item['type'], array('trigger'))){ |
| 181 | $wp_uploads = wp_upload_dir(); |
| 182 | $log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $item['id'], false, false ) . DIRECTORY_SEPARATOR . $item['id'] . '.html'; |
| 183 | if (file_exists($log_file)){ |
| 184 | ?> |
| 185 | <a href="<?php echo esc_url(add_query_arg(array('id' => $import->id, 'action' => 'log', 'history_id' => $item['id'], '_wpnonce' => wp_create_nonce( '_wpnonce-download_log' )), $this->baseUrl)); ?>"><?php esc_html_e('Download Log', 'wp-all-import'); ?></a> |
| 186 | <?php |
| 187 | } |
| 188 | else { |
| 189 | esc_html_e('Log Unavailable', 'wp-all-import'); |
| 190 | } |
| 191 | } |
| 192 | else { |
| 193 | ?> |
| 194 | |
| 195 | <?php |
| 196 | }; |
| 197 | ?> |
| 198 | </td> |
| 199 | <?php |
| 200 | break; |
| 201 | default: |
| 202 | ?> |
| 203 | <td> |
| 204 | <?php echo esc_html($item[$column_id]); ?> |
| 205 | </td> |
| 206 | <?php |
| 207 | break; |
| 208 | endswitch; |
| 209 | ?> |
| 210 | <?php endforeach; ?> |
| 211 | </tr> |
| 212 | <?php endforeach; ?> |
| 213 | <?php endif ?> |
| 214 | </tbody> |
| 215 | </table> |
| 216 | |
| 217 | <div class="tablenav"> |
| 218 | <?php if ($page_links): ?><div class="tablenav-pages"><?php echo wp_kses_post($page_links_html); ?></div><?php endif ?> |
| 219 | |
| 220 | <div class="alignleft actions"> |
| 221 | <select name="bulk-action2"> |
| 222 | <option value="" selected="selected"><?php esc_html_e('Bulk Actions', 'wp-all-import') ?></option> |
| 223 | <?php if ( empty($type) or 'trash' != $type): ?> |
| 224 | <option value="delete"><?php esc_html_e('Delete', 'wp-all-import') ?></option> |
| 225 | <?php else: ?> |
| 226 | <option value="restore"><?php esc_html_e('Restore', 'wp-all-import')?></option> |
| 227 | <option value="delete"><?php esc_html_e('Delete Permanently', 'wp-all-import')?></option> |
| 228 | <?php endif ?> |
| 229 | </select> |
| 230 | <input type="submit" value="<?php esc_attr_e('Apply', 'wp-all-import') ?>" name="doaction2" id="doaction2" class="button-secondary action" /> |
| 231 | </div> |
| 232 | </div> |
| 233 | <div class="clear"></div> |
| 234 | <div class="wpallimport-display-columns wpallimport-margin-top-forty"> |
| 235 | <?php echo wp_kses_post( apply_filters('wpallimport_footer', '') ); ?> |
| 236 | </div> |
| 237 | </form> |