PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 7.1.1
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v7.1.1
7.2.1 7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 6.0.5 All 36 releases
mlsimport / admin / partials / mlsimport-history.php

mlsimport-history.php in MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings 7.1.1, at admin/partials/mlsimport-history.php

91 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin partial: "Import History" screen.
4 *
5 * Renders the import-activity log (last 30 days) via the
6 * Mlsimport_Activity_List_Table WP_List_Table, with search + action + import-task
7 * filters read from the query string. Administrator-only.
8 *
9 * @package mlsimport
10 * @subpackage mlsimport/admin/partials
11 */
12
13 // Block direct access outside of WordPress.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 // Restrict this screen to administrators.
19 if ( ! current_user_can( 'administrator' ) ) {
20 wp_die( esc_html__( 'You do not have permission to view this page.', 'mlsimport' ) );
21 }
22
23 // Load WP_List_Table base class (admin-only; must not be loaded in mlsimport.php).
24 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
25 // __FILE__ = mlsimport/admin/partials/mlsimport-history.php — dirname x3 = plugin root.
26 require_once dirname( __FILE__, 3 ) . '/includes/class-mlsimport-activity-list-table.php';
27
28 // Filter GET keys — MUST match the keys read in Mlsimport_Activity_List_Table::prepare_items().
29 // 'mlsimport_action' = action filter; 'mlsimport_item' = import-task filter.
30 $filter_action = isset( $_GET['mlsimport_action'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
31 ? sanitize_text_field( wp_unslash( $_GET['mlsimport_action'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
32 : '';
33
34 $filter_item = isset( $_GET['mlsimport_item'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
35 ? absint( $_GET['mlsimport_item'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
36 : 0;
37
38 // Search term — matches Listing ID or ListingKey. Key 'mlsimport_s' MUST match prepare_items().
39 $filter_search = isset( $_GET['mlsimport_s'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
40 ? trim( sanitize_text_field( wp_unslash( $_GET['mlsimport_s'] ) ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
41 : '';
42
43 // Build the list table and populate it (applies the filters read above).
44 $list_table = new Mlsimport_Activity_List_Table();
45 $list_table->prepare_items();
46
47 // Import-task options for the "Import Task" filter dropdown.
48 $import_task_options = $list_table->get_import_task_options();
49 ?>
50 <div class="wrap">
51 <h1><?php echo esc_html__( 'Import History', 'mlsimport' ); ?></h1>
52 <p><?php echo esc_html__( 'Showing import activity from the last 30 days.', 'mlsimport' ); ?></p>
53
54 <form method="get" action="" class="notice notice-info mlsimport-history-filters">
55 <input type="hidden" name="page" value="mlsimport_history">
56
57 <label for="mlsimport-search"><?php echo esc_html__( 'Search:', 'mlsimport' ); ?></label>
58 <input type="search" id="mlsimport-search" name="mlsimport_s" value="<?php echo esc_attr( $filter_search ); ?>" placeholder="<?php echo esc_attr__( 'MLS #, Listing ID or ListingKey', 'mlsimport' ); ?>">
59
60 <label for="mlsimport-action-filter"><?php echo esc_html__( 'Action:', 'mlsimport' ); ?></label>
61 <select id="mlsimport-action-filter" name="mlsimport_action">
62 <option value=""><?php echo esc_html__( 'All', 'mlsimport' ); ?></option>
63 <option value="added" <?php selected( $filter_action, 'added' ); ?>><?php echo esc_html__( 'Added', 'mlsimport' ); ?></option>
64 <option value="edited" <?php selected( $filter_action, 'edited' ); ?>><?php echo esc_html__( 'Edited', 'mlsimport' ); ?></option>
65 <option value="deleted" <?php selected( $filter_action, 'deleted' ); ?>><?php echo esc_html__( 'Deleted', 'mlsimport' ); ?></option>
66 </select>
67
68 <?php if ( ! empty( $import_task_options ) ) : ?>
69 <label for="mlsimport-item-filter"><?php echo esc_html__( 'Import Task:', 'mlsimport' ); ?></label>
70 <select id="mlsimport-item-filter" name="mlsimport_item">
71 <option value=""><?php echo esc_html__( 'All', 'mlsimport' ); ?></option>
72 <?php foreach ( $import_task_options as $task_id => $task_title ) : ?>
73 <?php
74 // Skip any entry with an empty title — defensive guard (import_item_id=0 is excluded by get_import_task_options()).
75 if ( '' === trim( (string) $task_title ) ) {
76 continue;
77 }
78 ?>
79 <option value="<?php echo esc_attr( (string) $task_id ); ?>" <?php selected( $filter_item, $task_id ); ?>>
80 <?php echo esc_html( $task_title ); ?>
81 </option>
82 <?php endforeach; ?>
83 </select>
84 <?php endif; ?>
85
86 <?php submit_button( __( 'Filter', 'mlsimport' ), 'secondary', 'submit', false ); ?>
87 </form>
88
89 <?php $list_table->display(); ?>
90 </div>
91