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