AdvancedMathCaptcha.php
3 years ago
AeliaCurrencySwitcher.php
3 years ago
BeaverBuilder.php
4 years ago
CF_Helper.php
3 years ago
Cloudflare.php
2 years ago
CommonHelpers.php
3 years ago
CookieNotice.php
4 years ago
DownloadManager.php
4 years ago
Elementor.php
3 years ago
Ezoic.php
4 years ago
FusionBuilder.php
4 years ago
GeoTargetingWP.php
2 years ago
GravityForms.php
2 years ago
JetPackNP.php
3 years ago
NginxHelper.php
2 years ago
RC.php
3 years ago
RankMathNP.php
3 years ago
ShortPixel.php
4 years ago
SquirrlySEO.php
3 years ago
TheEventsCalendar.php
3 years ago
ThriveTheme.php
4 years ago
WCML.php
3 years ago
WPBakeryNP.php
3 years ago
WPCacheHelper.php
3 years ago
WPForms.php
3 years ago
WPRocket.php
4 years ago
Woocommerce.php
4 years ago
WoocommerceCacheHandler.php
4 years ago
YoastSEO.php
3 years ago
WPForms.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Plugin; |
| 4 | use NitroPack\WordPress\NitroPack; |
| 5 | |
| 6 | class WPForms { |
| 7 | |
| 8 | const STAGE = "late"; |
| 9 | protected $np_wpform_cache_valid = false; |
| 10 | |
| 11 | public static function isActive() { |
| 12 | $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
| 13 | return function_exists( 'wpforms' ) || in_array( 'wpforms/wpforms.php', $active_plugins ); |
| 14 | } |
| 15 | |
| 16 | public function init( $stage ) { |
| 17 | add_filter( 'wpforms_form_token_check_before_today', array( $this, 'extend_wpforms_token_expiration' ) ); |
| 18 | } |
| 19 | |
| 20 | public function extend_wpforms_token_expiration( $times ) { |
| 21 | $nitro = NitroPack::getInstance(); |
| 22 | if ($nitro && $nitro->getSdk()) { |
| 23 | $config = $nitro->getSdk()->getConfig(); |
| 24 | $cacheTtlDays = (int)($config->PageCache->ExpireTime / DAY_IN_SECONDS); |
| 25 | for ($day = 1; $day <= $cacheTtlDays; $day++) { |
| 26 | $times[] = $day * DAY_IN_SECONDS; |
| 27 | } |
| 28 | } |
| 29 | return $times; |
| 30 | } |
| 31 | |
| 32 | } |
| 33 |