bulk.php
1 month ago
delete.php
1 month ago
index.php
1 month ago
scheduling.php
1 month ago
update.php
1 month ago
index.php
418 lines
| 1 | <?php if ( ! defined( 'ABSPATH' ) ) exit; // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals ?> |
| 2 | <h2></h2> <!-- Do not remove --> |
| 3 | |
| 4 | <?php |
| 5 | // notify user |
| 6 | if (!PMXI_Plugin::getInstance()->getOption('dismiss_manage_bottom')) { |
| 7 | ?> |
| 8 | <div class="updated_bottom"> |
| 9 | <?php echo wp_kses( |
| 10 | __('<span><a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" target="_blank">If our plugin helped you, please rate us on WordPress.org. It would really help us!</a><a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" class="pmxi_stars" target="_blank"></a></span><a href="javascript:void(0);" id="dismiss_manage_bottom">dismiss</a>', 'wp-all-import'), |
| 11 | array('span' => array(), 'a' => array('href' => array(), 'target' => array(), 'class' => array(), 'id' => array())) |
| 12 | ) ?> |
| 13 | </div> |
| 14 | <?php |
| 15 | } |
| 16 | ?> |
| 17 | |
| 18 | |
| 19 | <div class="wpallimport-header" style="overflow:hidden; height: 70px; padding-top: 10px; margin-bottom: -15px;"> |
| 20 | <div class="wpallimport-logo"></div> |
| 21 | <div class="wpallimport-title"> |
| 22 | <h3><?php esc_html_e('Manage Imports', 'wp-all-import'); ?></h3> |
| 23 | </div> |
| 24 | </div> |
| 25 | |
| 26 | <?php if ($this->errors->get_error_codes()): ?> |
| 27 | <?php $this->error() ?> |
| 28 | <?php endif ?> |
| 29 | |
| 30 | <form method="get"> |
| 31 | <input type="hidden" name="page" value="<?php echo esc_attr($this->input->get('page')) ?>" /> |
| 32 | <p class="search-box"> |
| 33 | <label for="search-input" class="screen-reader-text"><?php esc_html_e('Search Imports', 'wp-all-import') ?>:</label> |
| 34 | <input id="search-input" type="text" name="s" value="<?php echo esc_attr($s) ?>" /> |
| 35 | <input type="submit" class="button" value="<?php esc_html_e('Search Imports', 'wp-all-import') ?>"> |
| 36 | </p> |
| 37 | </form> |
| 38 | |
| 39 | <?php |
| 40 | // define the columns to display, the syntax is 'internal name' => 'display name' |
| 41 | $columns = array( |
| 42 | 'id' => __('ID', 'wp-all-import'), |
| 43 | 'name' => __('File', 'wp-all-import'), |
| 44 | 'actions' => '', |
| 45 | 'summary' => __('Summary', 'wp-all-import'), |
| 46 | 'info' => __('Info & Options', 'wp-all-import'), |
| 47 | ); |
| 48 | |
| 49 | $columns = apply_filters('pmxi_manage_imports_columns', $columns); |
| 50 | |
| 51 | ?> |
| 52 | <form method="post" id="import-list" action="<?php echo esc_url(remove_query_arg('pmxi_nt')); ?>"> |
| 53 | <input type="hidden" name="action" value="bulk" /> |
| 54 | <?php wp_nonce_field('bulk-imports', '_wpnonce_bulk-imports') ?> |
| 55 | |
| 56 | <div class="tablenav"> |
| 57 | <div class="alignleft actions"> |
| 58 | <select name="bulk-action"> |
| 59 | <option value="" selected="selected"><?php esc_html_e('Bulk Actions', 'wp-all-import') ?></option> |
| 60 | <option value="delete"><?php esc_html_e('Delete', 'wp-all-import') ?></option> |
| 61 | </select> |
| 62 | <input type="submit" value="<?php esc_attr_e('Apply', 'wp-all-import') ?>" name="doaction" id="doaction" class="button-secondary action" /> |
| 63 | </div> |
| 64 | |
| 65 | <?php if ($page_links): ?> |
| 66 | <div class="tablenav-pages"> |
| 67 | <?php $page_links_html = sprintf( |
| 68 | /* translators: 1: from number, 2: to number, 3: total count, 4: page links HTML */ |
| 69 | '<span class="displaying-num">' . esc_html__('Displaying %1$s–%2$s of %3$s', 'wp-all-import') . '</span>%s', |
| 70 | esc_html(number_format_i18n(($pagenum - 1) * $perPage + 1)), |
| 71 | esc_html(number_format_i18n(min($pagenum * $perPage, $list->total()))), |
| 72 | esc_html(number_format_i18n($list->total())), |
| 73 | wp_kses_post($page_links) |
| 74 | ); echo wp_kses_post($page_links_html); ?> |
| 75 | </div> |
| 76 | <?php endif ?> |
| 77 | </div> |
| 78 | <div class="clear"></div> |
| 79 | |
| 80 | <table class="widefat pmxi-admin-imports"> |
| 81 | <thead> |
| 82 | <tr> |
| 83 | <th class="manage-column column-cb check-column" scope="col"> |
| 84 | <input type="checkbox" /> |
| 85 | </th> |
| 86 | <?php |
| 87 | $col_html = ''; |
| 88 | foreach ($columns as $column_id => $column_display_name) { |
| 89 | if (in_array($column_id, array('id', 'name'))){ |
| 90 | $column_link = "<a href='"; |
| 91 | $order2 = 'ASC'; |
| 92 | if ($order_by == $column_id) |
| 93 | $order2 = ($order == 'DESC') ? 'ASC' : 'DESC'; |
| 94 | |
| 95 | $column_link .= esc_url(add_query_arg(array('order' => $order2, 'order_by' => $column_id), $this->baseUrl)); |
| 96 | $column_link .= "'>{$column_display_name}</a>"; |
| 97 | $col_html .= '<th scope="col" class="column-' . $column_id . ' ' . ($order_by == $column_id ? $order : '') . '">' . $column_link . '</th>'; |
| 98 | } |
| 99 | else $col_html .= '<th scope="col" class="column-' . $column_id . '">' . $column_display_name . '</th>'; |
| 100 | } |
| 101 | echo wp_kses_post($col_html); |
| 102 | ?> |
| 103 | </tr> |
| 104 | </thead> |
| 105 | <tfoot> |
| 106 | <tr> |
| 107 | <th class="manage-column column-cb check-column" scope="col"> |
| 108 | <input type="checkbox" /> |
| 109 | </th> |
| 110 | <?php echo wp_kses_post($col_html); ?> |
| 111 | </tr> |
| 112 | </tfoot> |
| 113 | <tbody id="the-pmxi-admin-import-list" class="list:pmxi-admin-imports"> |
| 114 | <?php if ($list->isEmpty()): ?> |
| 115 | <tr> |
| 116 | <td colspan="<?php echo intval(count($columns) + 1) ?>"><?php echo wp_kses( sprintf( |
| 117 | /* translators: %s: URL to start a new import */ |
| 118 | __('No previous imports found. <a href="%s">Start a new import...</a>', 'wp-all-import'), |
| 119 | esc_url(add_query_arg(array('page' => 'pmxi-admin-import'), admin_url('admin.php'))) |
| 120 | ), array('a' => array('href' => array())) ); ?></td> |
| 121 | </tr> |
| 122 | <?php else: ?> |
| 123 | <?php |
| 124 | $class = ''; |
| 125 | ?> |
| 126 | <?php foreach ($list as $item): ?> |
| 127 | <?php $class = ('alternate' == $class) ? '' : 'alternate'; ?> |
| 128 | <tr class="<?php echo esc_attr($class); ?>" valign="middle"> |
| 129 | <th scope="row" class="check-column"> |
| 130 | <input type="checkbox" id="item_<?php echo esc_attr($item['id']) ?>" name="items[]" value="<?php echo esc_attr($item['id']) ?>" /> |
| 131 | </th> |
| 132 | <?php foreach ($columns as $column_id => $column_display_name): ?> |
| 133 | <?php |
| 134 | switch ($column_id): |
| 135 | case 'id': |
| 136 | ?> |
| 137 | <th valign="top" scope="row"> |
| 138 | <?php echo esc_html($item['id']) ?> |
| 139 | </th> |
| 140 | <?php |
| 141 | break; |
| 142 | case 'first_import': |
| 143 | ?> |
| 144 | <td> |
| 145 | <?php if ('0000-00-00 00:00:00' == $item['first_import']): ?> |
| 146 | <em>never</em> |
| 147 | <?php else: ?> |
| 148 | <?php echo esc_html(get_date_from_gmt($item['first_import'], 'Y/m/d g:i a')); ?> |
| 149 | <?php endif ?> |
| 150 | </td> |
| 151 | <?php |
| 152 | break; |
| 153 | case 'registered_on': |
| 154 | ?> |
| 155 | <td> |
| 156 | <?php if ('0000-00-00 00:00:00' == $item['registered_on']): ?> |
| 157 | <em>never</em> |
| 158 | <?php else: ?> |
| 159 | <?php echo esc_html(get_date_from_gmt($item['registered_on'], 'Y/m/d g:i a')); ?> |
| 160 | <?php endif ?> |
| 161 | </td> |
| 162 | <?php |
| 163 | break; |
| 164 | case 'name': |
| 165 | ?> |
| 166 | <td> |
| 167 | <strong><?php echo esc_html(apply_filters("pmxi_import_name", (!empty($item['friendly_name'])) ? $item['friendly_name'] : $item['name'], $item['id'])); ?></strong><br> |
| 168 | |
| 169 | <?php if ($item['path']): ?> |
| 170 | <?php if ( in_array($item['type'], array('upload'))): ?> |
| 171 | <?php $item['path'] = wp_all_import_get_absolute_path($item['path']); ?> |
| 172 | <?php |
| 173 | $path = $item['path']; |
| 174 | $path_parts = pathinfo($item['path']); |
| 175 | if ( ! empty($path_parts['dirname'])){ |
| 176 | $path_all_parts = explode('/', $path_parts['dirname']); |
| 177 | $dirname = array_pop($path_all_parts); |
| 178 | if ( wp_all_import_isValidMd5($dirname)){ |
| 179 | $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $item['path'])); |
| 180 | } |
| 181 | } |
| 182 | ?> |
| 183 | <em><a href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'feed', '_wpnonce' => wp_create_nonce( '_wpnonce-download_feed' )), $this->baseUrl)); ?>" class="wp_all_import_show_path" rel="<?php echo esc_attr($item['path']); ?>"><?php echo esc_html(preg_replace('%.*wp-content/%', 'wp-content/', $path)); ?></a></em> |
| 184 | <?php elseif (in_array($item['type'], array('file'))):?> |
| 185 | <?php $item['path'] = wp_all_import_get_absolute_path($item['path']); ?> |
| 186 | <em><a href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'feed', '_wpnonce' => wp_create_nonce( '_wpnonce-download_feed' )), $this->baseUrl)); ?>" class="wp_all_import_show_path" rel="<?php echo esc_attr($item['path']); ?>"><?php echo esc_html(preg_replace('%.*wp-content/%', 'wp-content/', $item['path'])); ?></a></em> |
| 187 | <?php else: ?> |
| 188 | <em><?php echo esc_html(str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $item['path']))); ?></em> |
| 189 | <?php endif; ?> |
| 190 | <?php endif ?> |
| 191 | <div class="row-actions"> |
| 192 | <?php do_action('pmxi_import_menu', $item['id'], $this->baseUrl); ?> |
| 193 | <?php |
| 194 | $import_actions = array( |
| 195 | 'import_template' => array( |
| 196 | 'url' => ( ! $item['processing'] and ! $item['executing'] ) ? esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl)) : '', |
| 197 | 'title' => __('Edit Template', 'wp-all-import'), |
| 198 | 'class' => 'edit' |
| 199 | ), |
| 200 | 'import_settings' => array( |
| 201 | 'url' => ( ! $item['processing'] and ! $item['executing'] ) ? esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl)) : '', |
| 202 | 'title' => __('Settings', 'wp-all-import'), |
| 203 | 'class' => 'edit' |
| 204 | ), |
| 205 | 'delete' => array( |
| 206 | 'url' => esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'delete'), $this->baseUrl)), |
| 207 | 'title' => __('Delete', 'wp-all-import'), |
| 208 | 'class' => 'delete' |
| 209 | ), |
| 210 | ); |
| 211 | |
| 212 | $import_actions = apply_filters('pmxi_import_actions', $import_actions, $item ); |
| 213 | |
| 214 | $ai = 1; |
| 215 | foreach ($import_actions as $key => $action) { |
| 216 | switch ($key) { |
| 217 | default: |
| 218 | ?> |
| 219 | <span class="<?php echo esc_attr($action['class']); ?>"> |
| 220 | <?php if ( ! empty($action['url']) ): ?> |
| 221 | <a class="<?php echo esc_attr($action['class']); ?>" href="<?php echo esc_url($action['url']); ?>"><?php echo esc_html($action['title']); ?></a> |
| 222 | <?php else: ?> |
| 223 | <span class="wpallimport-disabled"><?php echo esc_html($action['title']); ?></span> |
| 224 | <?php endif; ?> |
| 225 | </span> <?php if ($ai != count($import_actions)): ?>|<?php endif; ?> |
| 226 | <?php |
| 227 | break; |
| 228 | } |
| 229 | $ai++; |
| 230 | } |
| 231 | ?> |
| 232 | |
| 233 | </div> |
| 234 | </td> |
| 235 | <?php |
| 236 | break; |
| 237 | case 'summary': |
| 238 | ?> |
| 239 | <td> |
| 240 | <?php |
| 241 | if ($item['triggered'] and ! $item['processing']){ |
| 242 | esc_html_e('triggered with cron', 'wp-all-import'); |
| 243 | if ($item['last_activity'] != '0000-00-00 00:00:00'){ |
| 244 | $diff = ceil((time() - strtotime($item['last_activity']))/60); |
| 245 | ?> |
| 246 | <br> |
| 247 | <span <?php if ($diff >= 10) echo 'style="color:red;"';?>> |
| 248 | <?php |
| 249 | printf( |
| 250 | /* translators: %s: human-readable time difference */ |
| 251 | esc_html__('last activity %s ago', 'wp-all-import'), |
| 252 | esc_html(human_time_diff(strtotime($item['last_activity']), time())) |
| 253 | ); |
| 254 | ?> |
| 255 | </span> |
| 256 | <?php |
| 257 | } |
| 258 | } |
| 259 | elseif ($item['processing']){ |
| 260 | esc_html_e('currently processing with cron', 'wp-all-import'); echo '<br/>'; |
| 261 | printf( |
| 262 | /* translators: %s: number of records processed */ |
| 263 | esc_html__('Records Processed %s', 'wp-all-import'), |
| 264 | esc_html($item['imported']) |
| 265 | ); |
| 266 | if ($item['last_activity'] != '0000-00-00 00:00:00'){ |
| 267 | $diff = ceil((time() - strtotime($item['last_activity']))/60); |
| 268 | ?> |
| 269 | <br> |
| 270 | <span <?php if ($diff >= 10) echo 'style="color:red;"';?>> |
| 271 | <?php |
| 272 | printf( |
| 273 | /* translators: %s: human-readable time difference */ |
| 274 | esc_html__('last activity %s ago', 'wp-all-import'), |
| 275 | esc_html(human_time_diff(strtotime($item['last_activity']), time())) |
| 276 | ); |
| 277 | ?> |
| 278 | </span> |
| 279 | <?php |
| 280 | } |
| 281 | } |
| 282 | elseif($item['executing']){ |
| 283 | esc_html_e('Import currently in progress', 'wp-all-import'); |
| 284 | if ($item['last_activity'] != '0000-00-00 00:00:00'){ |
| 285 | $diff = ceil((time() - strtotime($item['last_activity']))/60); |
| 286 | ?> |
| 287 | <br> |
| 288 | <span <?php if ($diff >= 10) echo 'style="color:red;"';?>> |
| 289 | <?php |
| 290 | printf( |
| 291 | /* translators: %s: human-readable time difference */ |
| 292 | esc_html__('last activity %s ago', 'wp-all-import'), |
| 293 | esc_html(human_time_diff(strtotime($item['last_activity']), time())) |
| 294 | ); |
| 295 | ?> |
| 296 | </span> |
| 297 | <?php |
| 298 | } |
| 299 | } |
| 300 | elseif($item['canceled'] and $item['canceled_on'] != '0000-00-00 00:00:00'){ |
| 301 | printf( |
| 302 | /* translators: %s: date and time of import attempt */ |
| 303 | esc_html__('Import Attempt at %s', 'wp-all-import'), |
| 304 | esc_html(get_date_from_gmt($item['canceled_on'], "m/d/Y g:i a")) |
| 305 | ); echo '<br/>'; |
| 306 | esc_html_e('Import canceled', 'wp-all-import'); |
| 307 | } |
| 308 | elseif($item['failed'] and $item['failed_on'] != '0000-00-00 00:00:00'){ |
| 309 | printf( |
| 310 | /* translators: %s: date and time of import attempt */ |
| 311 | esc_html__('Import Attempt at %s', 'wp-all-import'), |
| 312 | esc_html(get_date_from_gmt($item['failed_on'], "m/d/Y g:i a")) |
| 313 | ); echo '<br/>'; |
| 314 | esc_html_e('Import failed, please check logs', 'wp-all-import'); |
| 315 | } |
| 316 | else{ |
| 317 | if (!empty($item['options']['custom_type'])){ |
| 318 | $custom_type = get_post_type_object( $item['options']['custom_type'] ); |
| 319 | $cpt_name = ( ! empty($custom_type)) ? $custom_type->label : ''; |
| 320 | } |
| 321 | else{ |
| 322 | $cpt_name = ''; |
| 323 | } |
| 324 | printf( |
| 325 | /* translators: %s: date and time of last run */ |
| 326 | esc_html__('Last run: %s', 'wp-all-import'), |
| 327 | esc_html(($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp-all-import') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")) |
| 328 | ); echo '<br/>'; |
| 329 | printf( |
| 330 | /* translators: 1: number of posts created, 2: post type label */ |
| 331 | esc_html__('%1$d %2$s created', 'wp-all-import'), |
| 332 | intval($item['created']), |
| 333 | esc_html($cpt_name) |
| 334 | ); echo '<br/>'; |
| 335 | printf( |
| 336 | /* translators: 1: updated count, 2: skipped count, 3: deleted count */ |
| 337 | esc_html__('%1$d updated, %2$d skipped, %3$d deleted', 'wp-all-import'), |
| 338 | intval($item['updated']), |
| 339 | intval($item['skipped']), |
| 340 | intval($item['deleted']) |
| 341 | ); |
| 342 | } |
| 343 | |
| 344 | if ($item['settings_update_on'] != '0000-00-00 00:00:00' and $item['last_activity'] != '0000-00-00 00:00:00' and strtotime($item['settings_update_on']) > strtotime($item['last_activity'])){ |
| 345 | echo '<br/>'; |
| 346 | ?> |
| 347 | <strong><?php esc_html_e('settings edited since last run', 'wp-all-import'); ?></strong> |
| 348 | <?php |
| 349 | } |
| 350 | |
| 351 | ?> |
| 352 | </td> |
| 353 | <?php |
| 354 | break; |
| 355 | case 'info': |
| 356 | ?> |
| 357 | <td> |
| 358 | <a href="#" class="scheduling-disabled"><?php esc_html_e('Scheduling Options', 'wp-all-import'); ?></a> |
| 359 | <a href="#help" class="wpallimport-help" style="position: relative; top: -2px; margin-left: 0;" title="<?php esc_html_e("To run this import on a schedule you must use the 'Download from URL' or 'Use existing file' option on the Import Settings page.", 'wp-all-import');?>">?</a> |
| 360 | <br/> |
| 361 | <a href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-history', 'id' => $item['id']), remove_query_arg('pagenum', $this->baseUrl))); ?>"><?php esc_html_e('History Logs', 'wp-all-import'); ?></a> |
| 362 | </td> |
| 363 | <?php |
| 364 | break; |
| 365 | case 'actions': |
| 366 | ?> |
| 367 | <td style="width: 130px;"> |
| 368 | <?php if ( ! $item['processing'] and ! $item['executing'] ): ?> |
| 369 | <h2 style="float:left;"><a class="add-new-h2" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'update'), remove_query_arg('pagenum', $this->baseUrl))); ?>"><?php esc_html_e('Run Import', 'wp-all-import'); ?></a></h2> |
| 370 | <?php elseif ($item['processing']) : ?> |
| 371 | <h2 style="float:left;"><a class="add-new-h2" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), remove_query_arg('pagenum', $this->baseUrl))); ?>"><?php esc_html_e('Cancel Cron', 'wp-all-import'); ?></a></h2> |
| 372 | <?php elseif ($item['executing']) : ?> |
| 373 | <h2 style="float:left;"><a class="add-new-h2" href="<?php echo esc_url(add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), remove_query_arg('pagenum', $this->baseUrl))); ?>"><?php esc_html_e('Cancel', 'wp-all-import'); ?></a></h2> |
| 374 | <?php endif; ?> |
| 375 | </td> |
| 376 | <?php |
| 377 | break; |
| 378 | default: |
| 379 | ?> |
| 380 | <td> |
| 381 | <?php do_action('pmxi_manage_imports_column', $column_id, $item); ?> |
| 382 | </td> |
| 383 | <?php |
| 384 | break; |
| 385 | endswitch; |
| 386 | ?> |
| 387 | <?php endforeach; ?> |
| 388 | </tr> |
| 389 | <?php do_action('pmxi_manage_imports', $item, $class); ?> |
| 390 | <?php endforeach; ?> |
| 391 | <?php endif ?> |
| 392 | </tbody> |
| 393 | </table> |
| 394 | |
| 395 | <div class="tablenav"> |
| 396 | <?php if ($page_links): ?><div class="tablenav-pages"><?php echo wp_kses_post($page_links_html) ?></div><?php endif ?> |
| 397 | |
| 398 | <div class="alignleft actions"> |
| 399 | <select name="bulk-action2"> |
| 400 | <option value="" selected="selected"><?php esc_html_e('Bulk Actions', 'wp-all-import') ?></option> |
| 401 | <?php if ( empty($type) or 'trash' != $type): ?> |
| 402 | <option value="delete"><?php esc_html_e('Delete', 'wp-all-import') ?></option> |
| 403 | <?php else: ?> |
| 404 | <option value="restore"><?php esc_html_e('Restore', 'wp-all-import')?></option> |
| 405 | <option value="delete"><?php esc_html_e('Delete Permanently', 'wp-all-import')?></option> |
| 406 | <?php endif ?> |
| 407 | </select> |
| 408 | <input type="submit" value="<?php esc_attr_e('Apply', 'wp-all-import') ?>" name="doaction2" id="doaction2" class="button-secondary action" /> |
| 409 | </div> |
| 410 | </div> |
| 411 | <div class="clear"></div> |
| 412 | |
| 413 | <div class="wpallimport-display-columns wpallimport-margin-top-forty"> |
| 414 | <?php echo wp_kses_post( apply_filters('wpallimport_footer', '') ); ?> |
| 415 | </div> |
| 416 | |
| 417 | </form> |
| 418 |