import-history.php
1 year ago
other-plugin-importer.php
1 week ago
page.php
3 months ago
plugin-settings.php
3 months ago
tab-importers.php
3 months ago
tab-status.php
3 months ago
tab-version.php
3 months ago
import-history.php
60 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Render import history table |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.50.0 |
| 8 | * |
| 9 | * phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 10 | */ |
| 11 | |
| 12 | $history = get_option( '_advads_importer_history', [] ); |
| 13 | if ( empty( $history ) ) { |
| 14 | return; |
| 15 | } |
| 16 | ?> |
| 17 | <div id="import-history" class="advads-import-history mt-8"> |
| 18 | <header> |
| 19 | <h2 class="advads-h2"><?php esc_html_e( 'Import History', 'advanced-ads' ); ?></h2> |
| 20 | <p class="text-sm"><?php esc_html_e( 'Import history to rollback changes.', 'advanced-ads' ); ?></p> |
| 21 | </header> |
| 22 | |
| 23 | <table class="widefat striped"> |
| 24 | <thead> |
| 25 | <tr> |
| 26 | <td>Importer</td> |
| 27 | <td>Session Key</td> |
| 28 | <td>Ads Created</td> |
| 29 | <td>Create At</td> |
| 30 | <td></td> |
| 31 | </tr> |
| 32 | </thead> |
| 33 | <tbody> |
| 34 | <?php |
| 35 | foreach ( $history as $session_key => $session ) : |
| 36 | $importer = wp_advads()->importers->get_importer( $session['importer_id'] ); |
| 37 | $delete_link = wp_nonce_url( |
| 38 | add_query_arg( |
| 39 | [ |
| 40 | 'action' => 'advads_import_delete', |
| 41 | 'session_key' => $session['session_key'], |
| 42 | ] |
| 43 | ), |
| 44 | 'advads_import_delete' |
| 45 | ); |
| 46 | ?> |
| 47 | <tr> |
| 48 | <td><?php echo $importer->get_title(); ?></td> |
| 49 | <td><?php echo $session['session_key']; ?></td> |
| 50 | <td><?php echo $session['count']; ?></td> |
| 51 | <td><?php echo wp_date( get_option( 'date_format' ), $session['created_at'] ); ?></td> |
| 52 | <td> |
| 53 | <a href="<?php echo esc_url( $delete_link ); ?>" class="button-link !text-red-500">Rollback Changes</a> |
| 54 | </td> |
| 55 | </tr> |
| 56 | <?php endforeach; ?> |
| 57 | </tbody> |
| 58 | </table> |
| 59 | </div> |
| 60 |