/** * Update the cache. * * @since 1.8.6 * * @param bool $force Whether to force update the cache. * * @return bool */ public function update( bool $force = false ): bool { $result = parent::update( $force ); if ( ! $result ) { return false; } $this->wipe_content_cache(); return $result; } /** * Get cached templates content. * * @since 1.8.6 * * @return string */ public function get_content_cache(): string { // phpcs:ignore Universal.Operators.DisallowShortTernary.Found return File::get_contents( $this->get_content_cache_file() ) ?: ''; } /** * Save templates content cache. * * @since 1.8.6 * * @param string|mixed $content Templates content. * * @return bool */ public function save_content_cache( $content ): bool { return File::put_contents( $this->get_content_cache_file(), (string) $content ); } /** * Wipe cached templates content. * * @since 1.8.6 */ public function wipe_content_cache() { $cache_dir = $this->get_cache_dir(); // Delete the template content cache files. They will be regenerated on the first visit. foreach ( self::CONTENT_CACHE_FILES as $file ) { $cache_file = $cache_dir . $file; if ( is_file( $cache_file ) && is_readable( $cache_file ) ) { // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink unlink( $cache_file ); } } } /** * Get templates content cache file path. * * @since 1.8.6 * * @return string */ private function get_content_cache_file(): string { $context = wpforms_is_admin_page( 'templates' ) ? 'admin-page' : 'builder'; return File::get_cache_dir() . self::CONTENT_CACHE_FILES[ $context ]; } }
Warning: Cannot modify header information - headers already sent by (output started at /htdocs/lactualiteinter.com/wp-content/plugins/wpforms-lite/src/Admin/Builder/TemplatesCache.php:1) in /htdocs/lactualiteinter.com/wp-includes/pluggable.php on line 1531

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/lactualiteinter.com/wp-content/plugins/wpforms-lite/src/Admin/Builder/TemplatesCache.php:1) in /htdocs/lactualiteinter.com/wp-includes/pluggable.php on line 1534