| @@ -14,9 +14,11 @@ | ||
| 14 | 14 | use BitCode\BitForm\Core\Database\FormModel; |
| 15 | 15 | use BitCode\BitForm\Core\Fallback\FormFallback; |
| 16 | 16 | use BitCode\BitForm\Core\Form\FormHandler; |
| 17 | 17 | use BitCode\BitForm\Core\Integration\Integrations; |
| 18 | +use BitCode\BitForm\Core\Util\CacheCompat; | |
| 18 | 19 | use BitCode\BitForm\Core\Util\FileDownloadProvider; |
| 20 | +use BitCode\BitForm\Core\Util\Translation\TranslationManager; | |
| 19 | 21 | use BitCode\BitForm\Core\Util\Utilities; |
| 20 | 22 | use BitCode\BitForm\Core\WorkFlow\WorkflowExecutor; |
| 21 | 23 | use BitCode\BitForm\Frontend\ConversationalFormView; |
| 22 | 24 | use BitCode\BitForm\Frontend\StandaloneFormView; |
| @@ -44,8 +46,9 @@ | ||
| 44 | 46 | add_action('bitform_dequeue_styles', [Hooks::class, 'dequeueStyles'], 1000, 100); |
| 45 | 47 | add_action('init', [ConversationalFormView::class, 'conversationalFormView']); |
| 46 | 48 | add_action('init', [StandaloneFormView::class, 'standaloneFormView']); |
| 47 | 49 | add_action('bitform_admin_form_changed', [Hooks::class, 'invalidateCustomUrlCache']); |
| 50 | + \BitCode\BitForm\Core\Util\CacheCompat::registerPurgeHooks(); | |
| 48 | 51 | add_action('wp_footer', [Hooks::class, 'updateBitFormVersion'], 9999, 0); |
| 49 | 52 | |
| 50 | 53 | // Register the BitForm widget for Gutenberg, and Bricks Builder |
| 51 | 54 | add_action('init', [new RegisterGutenBlock(), 'register']); |
| @@ -64,8 +67,12 @@ | ||
| 64 | 67 | $currentBitFormVersion = BITFORMS_VERSION; |
| 65 | 68 | $installedBitFormVersion = get_option('bitforms_version'); |
| 66 | 69 | if ($currentBitFormVersion !== $installedBitFormVersion) { |
| 67 | 70 | (new FormFallback())->resetJsGeneratedPageIds(); |
| 71 | + // Without this the regenerated bundle keeps its ?bfv= URL and browsers | |
| 72 | + // and CDNs keep serving the stale file. | |
| 73 | + $formUpdateVersion = (int) get_option('bitform_form_update_version'); | |
| 74 | + update_option('bitform_form_update_version', $formUpdateVersion ? $formUpdateVersion + 1 : 1); | |
| 68 | 75 | update_option('bitforms_version', $currentBitFormVersion); |
| 69 | 76 | } |
| 70 | 77 | } |
| 71 | 78 | |
| @@ -109,15 +116,19 @@ | ||
| 109 | 116 | public static function init_classes() |
| 110 | 117 | { |
| 111 | 118 | if (Request::Check('admin')) { |
| 112 | 119 | (new Admin_Bar())->register(); |
| 120 | + TranslationManager::boot('admin'); | |
| 113 | 121 | } |
| 114 | 122 | if (Request::Check('ajax')) { |
| 115 | 123 | new AjaxService(); |
| 124 | + TranslationManager::boot('ajax'); | |
| 116 | 125 | } |
| 117 | 126 | if (Request::Check('frontend')) { |
| 118 | 127 | $formHandler = new FormHandler(); |
| 119 | 128 | $formHandler->frontend; |
| 129 | + TranslationManager::boot('frontend'); | |
| 130 | + CacheCompat::register(); | |
| 120 | 131 | } |
| 121 | 132 | if (Request::isPluginPage()) { |
| 122 | 133 | (new FileDownloadProvider())->register(); |
| 123 | 134 | } |