Conversation
Shows WordPress-formatted timestamps below relative times in import list. Uses date_i18n() with site date/time format settings. Timestamps are visually de-emphasized (small, gray). Only display-only changes - no functional modifications. Co-authored-by: ineagu <1849868+ineagu@users.noreply.github.com> Agent-Logs-Url: https://github.com/Codeinwp/feedzy-rss-feeds/sessions/a6dbeeaf-bb57-4df5-ba98-1b34eb0805ed
There was a problem hiding this comment.
Pull request overview
Improves the Feedzy Imports list table UX by displaying an absolute, site-localized timestamp alongside the existing relative “Last Run” and “Next Run” times to help users correlate imports with server logs and cron schedules.
Changes:
- Appends a WordPress date/time formatted timestamp below “Last Run” relative time when a job has run.
- Appends a WordPress date/time formatted timestamp below “Next Run” relative time when a job is scheduled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $date_format = get_option( 'date_format' ); | ||
| $time_format = get_option( 'time_format' ); | ||
| $timestamp = date_i18n( $date_format . ' ' . $time_format, $last ); | ||
| $msg .= '<br><small style="color:#888;">' . esc_html( $timestamp ) . '</small>'; | ||
| } |
There was a problem hiding this comment.
In this list-table callback, get_option( 'date_format' ) / get_option( 'time_format' ) are fetched for every row and column. Even with WP option caching, it’s avoidable duplication—consider caching the combined format (or both options) once per request (e.g., static vars) and reusing it for both Last Run / Next Run rendering.
| echo wp_kses_post( human_time_diff( $next, time() ) ); | ||
| // Add actual timestamp below relative time. | ||
| $date_format = get_option( 'date_format' ); | ||
| $time_format = get_option( 'time_format' ); | ||
| $timestamp = date_i18n( $date_format . ' ' . $time_format, $next ); | ||
| echo '<br><small style="color:#888;">' . esc_html( $timestamp ) . '</small>'; |
There was a problem hiding this comment.
human_time_diff() is echoed via wp_kses_post(), but the appended <br><small ...> timestamp is echoed without any kses/escaping of the HTML wrapper. Since this is still HTML output, consider building a single string and outputting it via wp_kses_post() (the timestamp itself can remain esc_html()), to keep output escaping consistent within this branch.
| echo wp_kses_post( human_time_diff( $next, time() ) ); | |
| // Add actual timestamp below relative time. | |
| $date_format = get_option( 'date_format' ); | |
| $time_format = get_option( 'time_format' ); | |
| $timestamp = date_i18n( $date_format . ' ' . $time_format, $next ); | |
| echo '<br><small style="color:#888;">' . esc_html( $timestamp ) . '</small>'; | |
| $relative_time = human_time_diff( $next, time() ); | |
| // Add actual timestamp below relative time. | |
| $date_format = get_option( 'date_format' ); | |
| $time_format = get_option( 'time_format' ); | |
| $timestamp = date_i18n( $date_format . ' ' . $time_format, $next ); | |
| $output = $relative_time . '<br><small style="color:#888;">' . esc_html( $timestamp ) . '</small>'; | |
| echo wp_kses_post( $output ); |
| $date_format = get_option( 'date_format' ); | ||
| $time_format = get_option( 'time_format' ); | ||
| $timestamp = date_i18n( $date_format . ' ' . $time_format, $last ); | ||
| $msg .= '<br><small style="color:#888;">' . esc_html( $timestamp ) . '</small>'; |
There was a problem hiding this comment.
This file mixes wp_date() (used elsewhere) and date_i18n() (used here) for localized timestamps. Consider using wp_date( $date_format . ' ' . $time_format, (int) $last ) for consistency and future-proofing, since wp_date() is the newer WP API for timezone/locale-aware formatting.
|
@claude[agent] can you fix the review items? |
…t escaping - Cache date/time format with static var to avoid repeated get_option() calls per row - Replace date_i18n() with wp_date() for consistency with rest of codebase - Build single output string for Next Run and use wp_kses_post() consistently Co-authored-by: ineagu <1849868+ineagu@users.noreply.github.com> Agent-Logs-Url: https://github.com/Codeinwp/feedzy-rss-feeds/sessions/65c79e55-9a5a-4071-83f9-6d8396d3dc32
Fixed in 9d9e87f:
|
Original prompt