DataInconsistency
2 weeks ago
License
2 months ago
Notices
2 months ago
pQuery
2 months ago
APIPermissionHelper.php
1 year ago
CdnAssetUrl.php
3 years ago
ConflictResolver.php
1 month ago
Cookies.php
2 months ago
DBCollationChecker.php
2 months ago
DOM.php
2 years ago
DateConverter.php
3 years ago
FreeDomains.php
3 years ago
Headers.php
1 year ago
Helpers.php
1 month ago
Installation.php
1 year ago
LegacyDatabase.php
1 year ago
Request.php
2 months ago
SecondLevelDomainNames.php
3 years ago
Security.php
2 months ago
ThirdPartyOutput.php
1 month ago
Url.php
2 months ago
index.php
3 years ago
Headers.php
28 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Util; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\WP\Functions as WPFunctions; |
| 9 | |
| 10 | class Headers { |
| 11 | public static function setNoCacheHeaders(): void { |
| 12 | $wp = WPFunctions::get(); |
| 13 | if ($wp->headersSent()) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | // Set default no-cache headers: |
| 18 | header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1+ |
| 19 | header('Pragma: no-cache'); // HTTP 1.0 |
| 20 | header('Expires: 0'); // proxies |
| 21 | header('X-Cache-Enabled: False'); // SG Optimizer on SiteGround |
| 22 | header('X-LiteSpeed-Cache-Control: no-cache'); // LiteSpeed server |
| 23 | |
| 24 | // Use WP-native nocache_headers(). This can override the defaults above. |
| 25 | $wp->nocacheHeaders(); |
| 26 | } |
| 27 | } |
| 28 |