AcfBulkEditNotice.php
2 days ago
AcfNotice.php
2 days ago
AcfSortAndFilterNotice.php
2 days ago
EventsCalendarNotice.php
2 days ago
GravityFormsNotice.php
2 days ago
IntegrationNotice.php
2 days ago
IntegrationNoticeRenderer.php
2 days ago
PostEditReferrerAware.php
2 days ago
UsageAwareNotice.php
2 days ago
WooCommerceOrdersFilterNotice.php
2 days ago
WooCommerceOrdersNotice.php
2 days ago
WooCommerceOrdersScreenAware.php
2 days ago
WooCommerceOrdersSearchNotice.php
2 days ago
WooCommerceProductsBulkEditNotice.php
2 days ago
WooCommerceProductsFilterNotice.php
2 days ago
WooCommerceProductsNotice.php
2 days ago
WooCommerceProductsSearchNotice.php
2 days ago
PostEditReferrerAware.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Check\Integration; |
| 6 | |
| 7 | /** |
| 8 | * Detects if the user arrived from a post edit screen (post.php?action=edit). |
| 9 | * Used by bulk edit notices to identify repetitive single-post editing behavior. |
| 10 | */ |
| 11 | trait PostEditReferrerAware |
| 12 | { |
| 13 | private function is_post_edit_referrer(): bool |
| 14 | { |
| 15 | $referrer = $_SERVER['HTTP_REFERER'] ?? ''; |
| 16 | |
| 17 | if (empty($referrer)) { |
| 18 | return false; |
| 19 | } |
| 20 | |
| 21 | $parsed = parse_url($referrer); |
| 22 | $path = $parsed['path'] ?? ''; |
| 23 | $query = $parsed['query'] ?? ''; |
| 24 | |
| 25 | if ('post.php' !== basename($path)) { |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | parse_str($query, $params); |
| 30 | |
| 31 | return isset($params['action'], $params['post']) && 'edit' === $params['action']; |
| 32 | } |
| 33 | |
| 34 | } |
| 35 |