BeaverBuilder.php
4 years ago
CF_Helper.php
4 years ago
Cloudflare.php
4 years ago
CookieNotice.php
4 years ago
DownloadManager.php
4 years ago
Ezoic.php
4 years ago
NginxHelper.php
4 years ago
RC.php
4 years ago
ShortPixel.php
4 years ago
WPCacheHelper.php
4 years ago
WPRocket.php
4 years ago
NginxHelper.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Plugin; |
| 4 | |
| 5 | class NginxHelper { |
| 6 | const STAGE = "late"; |
| 7 | |
| 8 | public static function isActive() { |
| 9 | return defined('NGINX_HELPER_BASEPATH'); |
| 10 | } |
| 11 | |
| 12 | public function init($stage) { |
| 13 | if (self::isActive()) { |
| 14 | add_action('nitropack_execute_purge_url', [$this, 'purgeUrl']); |
| 15 | add_action('nitropack_execute_purge_all', [$this, 'purgeAll']); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function purgeUrl($url) { |
| 20 | global $nginx_purger; |
| 21 | if ($nginx_purger) { |
| 22 | $nginx_purger->purge_url($url); |
| 23 | } |
| 24 | return true; |
| 25 | } |
| 26 | |
| 27 | public function purgeAll() { |
| 28 | global $nginx_purger; |
| 29 | if ($nginx_purger) { |
| 30 | $nginx_purger->purge_all(); |
| 31 | } |
| 32 | return true; |
| 33 | } |
| 34 | } |
| 35 |