get_contents( $template ); $advanced_cache_content = preg_replace( '/{{swpsp-cache-dir}}/', swpsp_config_get( 'page_cache.cache_dir' ), $advanced_cache_content ); $advanced_cache_content = preg_replace( '/{{swpsp-plugin-file}}/', SWPSP_PLUGIN_FILE, $advanced_cache_content ); $advanced_cache_content = preg_replace( '/{{swpsp-plugin-dir}}/', $plugin_dir, $advanced_cache_content ); $advanced_cache_content = preg_replace( '/{{swpsp-advanced-cache-version}}/', $this->version, $advanced_cache_content ); $destination = $destination ?: WP_CONTENT_DIR . '/advanced-cache.php'; return $filesystem->put_contents( $destination, $advanced_cache_content, swpsp_get_file_mode() ); } /** * Removes the advanced-cache drop-in. * * @since 0.1.0 * * @return bool */ public function remove(): bool { $file = WP_CONTENT_DIR . '/advanced-cache.php'; if ( ! is_file( $file ) ) { return true; // There is no file to remove, just return successfully. } return swpsp_direct_filesystem()->delete( $file ); } }