Repository navigation
Show the date listings are sorted by in the default listings layout - #172
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Both functions have been no-ops since PHP 8.0 and are deprecated in PHP 8.5, which fails the PHPCS inspection.
There was a problem hiding this comment.
Approve. The default listings layout now shows the date the date-based sort orders use, and renewed listings show their renewal date.
What I ran (WordPress Playground, base 357533e vs this PR at 80e31d3): two listings, "Renewed" (start 2026-01-10, renewed and _awpcp_most_recent_start_date 2026-09-20) and "Plain" (start and most-recent 2026-03-05). I rendered both through awpcp_render_listings_items() with six saved-layout cases and read the dates out of the output.
| Layout case | Base, Renewed listing | PR, Renewed listing |
|---|---|---|
| unset (default) | 2026-01-10 | 2026-09-20 |
| saved copy of the old default | 2026-01-10 | 2026-09-20 |
| saved old default with CRLF and extra blank lines | 2026-01-10 | 2026-09-20 |
| saved old default plus a custom edit | 2026-01-10 | 2026-01-10 (custom layout kept) |
custom layout using $awpcpadpostdate |
2026-01-10 | 2026-01-10 (unchanged) |
custom layout using $most_recent_start_date |
placeholder not replaced | 2026-09-20 |
The Plain listing shows 2026-03-05 in every case, so listings that were never renewed look the same as before. CI is green (PHPUnit 7.4/8, PHPStan, PHPCS).
Not covered: I did not render the real Browse Listings page, so there is no screenshot of the final markup. The in-process render shows the date text, not the page styling. I also did not run the PHPUnit suite locally; CI did.
Non-blocking notes
- A saved layout that someone edited at all (even one character) keeps
$awpcpadpostdate, so those sites keep showing the original date. That matches the PR description. A line in the changelog or the setting's help text would save a support question. awpcp_get_listings_layout()has no unit test. The whitespace-insensitive match against the previous default is the only non-obvious logic in the PR.- The
finfo_close()/imagedestroy()tounset()change inclass-mime-types.phpanddeprecated.phpis unrelated to the ticket (the same change is in #171). Fine to keep, but it would read better as its own commit or PR.
Fixes Strategy11/awpcp#3118
Adds a $most_recent_start_date placeholder and uses it in the default listings layout (including saved copies of the unchanged old default), so renewed listings show the renewal date that places them in the date sort.