| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.9 Free | |
| 4 | + * @version 3.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -25,8 +25,11 @@ | ||
| 25 | 25 | { |
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | + // Keep FireBox assets out of WP Rocket's JS delay/defer/minify and CSS optimizations | |
| 30 | + new \FireBox\Core\Libs\WPRocket(); | |
| 31 | + | |
| 29 | 32 | wp_register_script( |
| 30 | 33 | 'firebox-main', |
| 31 | 34 | FBOX_MEDIA_PUBLIC_URL . 'js/firebox.js', |
| 32 | 35 | [], |
| @@ -32,8 +35,35 @@ | ||
| 32 | 35 | [], |
| 33 | 36 | FBOX_VERSION, |
| 34 | 37 | ['in_footer' => true, 'strategy' => 'defer'] |
| 35 | 38 | ); |
| 39 | + | |
| 40 | + // The session stamper on its own, for pages where no campaign renders but a | |
| 41 | + // campaign elsewhere depends on the session cookies staying accurate. | |
| 42 | + wp_register_script( | |
| 43 | + 'firebox-session-stamp', | |
| 44 | + FBOX_MEDIA_PUBLIC_URL . 'js/session-stamp.js', | |
| 45 | + [], | |
| 46 | + FBOX_VERSION, | |
| 47 | + ['in_footer' => true, 'strategy' => 'defer'] | |
| 48 | + ); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * The session stamper writes the cookies PHP reads back | |
| 52 | + * (FPFramework\Base\Factory\Session), so it has to name and scope them | |
| 53 | + * the same way. Attached to both handles because either one can carry | |
| 54 | + * the stamper: it is bundled into the runtime and also ships alone. | |
| 55 | + */ | |
| 56 | + $scope = wp_json_encode([ | |
| 57 | + 'name_prefix' => \FPFramework\Helpers\CookieScope::name(''), | |
| 58 | + 'path' => \FPFramework\Helpers\CookieScope::path(), | |
| 59 | + 'domain' => \FPFramework\Helpers\CookieScope::domain() | |
| 60 | + ]); | |
| 61 | + | |
| 62 | + foreach (['firebox-main', 'firebox-session-stamp'] as $handle) | |
| 63 | + { | |
| 64 | + wp_add_inline_script($handle, 'window.fpfCookieScope = ' . $scope . ';', 'before'); | |
| 65 | + } | |
| 36 | 66 | |
| 37 | 67 | // Prepare Gutenberg Blocks that contain attributes by FireBox |
| 38 | 68 | new \FireBox\Core\FB\BoxBlocksParser(); |
| 39 | 69 | |