Skip to content

refactor: consolidate rewrite/plugin optimizations#15

Merged
ilicfilip merged 8 commits intomainfrom
optimize/rewrite-integration
Feb 26, 2026
Merged

refactor: consolidate rewrite/plugin optimizations#15
ilicfilip merged 8 commits intomainfrom
optimize/rewrite-integration

Conversation

@jdevalk
Copy link
Copy Markdown
Member

@jdevalk jdevalk commented Feb 17, 2026

This consolidates overlapping work from #10, #12, and #13 into one integration PR to reduce merge conflicts.

Included:

Notes:

Joost de Valk and others added 4 commits February 17, 2026 10:58
- Create PostTypeSupport utility class with static methods for post type validation
- Remove duplicated get_supported_post_types() and is_supported_post_type() methods from AlternateLinkHandler and RewriteHandler
- Update all post type checks to use PostTypeSupport::is_supported()
- Fix comment in AlternateLinkHandler from "published posts" to "published content"

This eliminates ~42 lines of duplicated code and provides a single source of truth for post type support logic. No behavior changes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
(cherry picked from commit e3ab727)
…istration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
(cherry picked from commit 9e862b3)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
(cherry picked from commit 9534de6)
Restore original logic for non-lowercase .md extension detection.
The simplified regex '/\.[Mm][Dd]$/' incorrectly matched lowercase
.md extensions, causing valid requests to be rejected. The original
two-part check correctly identifies only non-lowercase variants.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
(cherry picked from commit 69ff1f7)
…gration

# Conflicts:
#	src/Discovery/AlternateLinkHandler.php
@ilicfilip
Copy link
Copy Markdown
Contributor

@jdevalk , I have reviewed PR - it looks good to me, only thing I would point out is that maybe we dont have to remove all inline comments as some are useful (ie // Enforce lowercase .md extension - let WP 404 if wrong case).

Remove comments that restate what the code says (e.g. "Get the current
post", "Only for singular content", "Build markdown URL"). Keep and
refine comments that explain non-obvious decisions: URL precedence,
case-sensitivity enforcement, Nginx/Apache fallback, cache Vary header
purpose. Clean up stale TECH-XX and CONTEXT.md references in
set_response_headers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jdevalk
Copy link
Copy Markdown
Member Author

jdevalk commented Feb 26, 2026

Good point, did another pass, please re-review :)

jdevalk and others added 2 commits February 26, 2026 13:13
Resolve conflicts: take main's sanitization improvements
(sanitize_text_field, wp_unslash, wp_parse_url, wp_safe_redirect,
esc_url_raw) and password-protection check in AlternateLinkHandler,
while keeping the curated comment style from this branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ilicfilip ilicfilip merged commit 48297f3 into main Feb 26, 2026
@ilicfilip
Copy link
Copy Markdown
Contributor

@jdevalk , merged!

@ilicfilip ilicfilip deleted the optimize/rewrite-integration branch February 26, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants