AcfBulkEditNotice.php
3 months ago
AcfNotice.php
3 months ago
AcfSortAndFilterNotice.php
3 months ago
EventsCalendarNotice.php
3 months ago
GravityFormsNotice.php
3 months ago
IntegrationNotice.php
3 months ago
IntegrationNoticeRenderer.php
3 months ago
PostEditReferrerAware.php
3 months ago
UsageAwareNotice.php
3 months ago
WooCommerceOrdersFilterNotice.php
3 months ago
WooCommerceOrdersNotice.php
3 months ago
WooCommerceOrdersScreenAware.php
3 months ago
WooCommerceOrdersSearchNotice.php
3 months ago
WooCommerceProductsBulkEditNotice.php
3 months ago
WooCommerceProductsFilterNotice.php
3 months ago
WooCommerceProductsNotice.php
3 months ago
WooCommerceProductsSearchNotice.php
3 months ago
PostEditReferrerAware.php
36 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 | |
| 14 | private function is_post_edit_referrer(): bool |
| 15 | { |
| 16 | $referrer = $_SERVER['HTTP_REFERER'] ?? ''; |
| 17 | |
| 18 | if (empty($referrer)) { |
| 19 | return false; |
| 20 | } |
| 21 | |
| 22 | $parsed = parse_url($referrer); |
| 23 | $path = $parsed['path'] ?? ''; |
| 24 | $query = $parsed['query'] ?? ''; |
| 25 | |
| 26 | if ('post.php' !== basename($path)) { |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | parse_str($query, $params); |
| 31 | |
| 32 | return isset($params['action'], $params['post']) && 'edit' === $params['action']; |
| 33 | } |
| 34 | |
| 35 | } |
| 36 |