| @@ -271,8 +271,34 @@ | ||
| 271 | 271 | { |
| 272 | 272 | return array_unique(self::getAllFormIdsInPage()); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | + /** | |
| 276 | + * URL of a generated stylesheet, carrying the form update version in the src. | |
| 277 | + * | |
| 278 | + * WP's own $ver argument is stripped by "remove query strings from static | |
| 279 | + * resources" hardening (WP Ghost, optimizer snippets), which leaves a | |
| 280 | + * regenerated stylesheet behind a CDN under its unchanged URL - the markup | |
| 281 | + * then carries class names the cached CSS has never heard of. bfv rides | |
| 282 | + * inside the src the way the generated JS bundle already does, so those | |
| 283 | + * filters leave it alone. Falls back to the plugin version so the URL always | |
| 284 | + * changes on upgrade, even where the option was never written. | |
| 285 | + * | |
| 286 | + * @param string $relativePath path under the bitforms upload dir, e.g. form-styles/bitform-15.css | |
| 287 | + * | |
| 288 | + * @return string | |
| 289 | + */ | |
| 290 | + public static function styleSrc($relativePath) | |
| 291 | + { | |
| 292 | + $version = get_option('bitform_form_update_version'); | |
| 293 | + if (!$version) { | |
| 294 | + $version = BITFORMS_VERSION; | |
| 295 | + } | |
| 296 | + $src = BITFORMS_UPLOAD_BASE_URL . '/' . ltrim((string) $relativePath, '/'); | |
| 297 | + | |
| 298 | + return add_query_arg('bfv', rawurlencode((string) $version), $src); | |
| 299 | + } | |
| 300 | + | |
| 275 | 301 | public static function hasMultipleForms() |
| 276 | 302 | { |
| 277 | 303 | $bfUniqFormIds = self::getAllFormIdsInPage(); |
| 278 | 304 | self::checkIsPageBuilder($_SERVER); |