BitFormPublicApi::getCrmIntegratedForms(), 10, 1); add_filter('bitform/api/toggle_form_status', fn ($default = null, $formId = 0, $status = 0) => BitFormPublicApi::toggleFormStatus($formId, $status), 10, 3); add_filter('bitform/api/create_form_url', fn ($default = null, $args = []) => BitFormPublicApi::getCreateFormUrl($args), 10, 2); } public static function updateBitFormVersion() { $currentBitFormVersion = BITFORMS_VERSION; $installedBitFormVersion = get_option('bitforms_version'); if ($currentBitFormVersion !== $installedBitFormVersion) { (new FormFallback())->resetJsGeneratedPageIds(); update_option('bitforms_version', $currentBitFormVersion); } } public static function registerRoutes() { $routes = new Routes(); $routes->register_routes(); } public static function isGeneratedScript($postId, $oldPost, $updatedPost) { $oldContent = $oldPost->post_content; $updatedContent = $updatedPost->post_content; $oldShortCodeMatch = \preg_match_all("/\[bitform\s+id\s*=\s*('|\")\s*(\d+)\s*('|\")\]/", $oldContent, $oldShortCodes); $updatedShortCodeMatch = \preg_match_all("/\[bitform\s+id\s*=\s*('|\")\s*(\d+)\s*('|\")\]/", $updatedContent, $updatedShortCodes); if ($oldShortCodeMatch && $updatedShortCodeMatch) { $oldShortCodes = $oldShortCodes[2]; $updatedShortCodes = $updatedShortCodes[2]; $checkEqualArray = array_diff($oldShortCodes, $updatedShortCodes); if (!empty($checkEqualArray)) { $formModel = new FormModel(); $value = "%$postId%"; $condtions = [ 'generated_script_page_ids' => ['operator' => 'LIKE', 'value' => $value], ]; $forms = $formModel->get('generated_script_page_ids,id', $condtions); foreach ($forms as $form) { $pageIds = Utilities::jsonObj($form->generated_script_page_ids ?? ''); if ($pageIds && property_exists($pageIds, $postId)) { unset($pageIds->{$postId}); $formModel->update(['generated_script_page_ids' => \wp_json_encode($pageIds)], ['id' => $form->id]); } } } } } public static function init_classes() { if (Request::Check('admin')) { (new Admin_Bar())->register(); } if (Request::Check('ajax')) { new AjaxService(); } if (Request::Check('frontend')) { $formHandler = new FormHandler(); $formHandler->frontend; } if (Request::isPluginPage()) { (new FileDownloadProvider())->register(); } // if (current_user_can('edit_posts')) { // (new RegisterGutenBlock())->register(); // } include BITFORMS_PLUGIN_DIR_PATH . 'includes' . DIRECTORY_SEPARATOR . 'Frontend' . DIRECTORY_SEPARATOR . 'InitRoutes.php'; } public static function versionUpdateRunFallbacks() { $dir = BITFORMS_PLUGIN_DIR_PATH . 'includes' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'Fallback'; if (is_dir($dir) && is_file($dir . DIRECTORY_SEPARATOR . 'Init.php')) { include $dir . DIRECTORY_SEPARATOR . 'Init.php'; } } public static function plugin_action_links($links) { $links[] = '' . __('Docs', 'bit-form') . ''; if (!Utilities::isProLicensed()) { $links[] = '' . __('Upgrade to Pro', 'bit-form') . ''; // $links[] = '' . __('Get 50% Off! Christmas Deal.', 'bit-form') . ''; } return $links; } public static function dequeueScripts(...$formIds) { foreach ($formIds as $formId) { wp_deregister_script("bitform-script-{$formId}"); wp_dequeue_script("bitform-script-{$formId}"); } global $bitform_dequeued_scripts; if (!is_array($bitform_dequeued_scripts)) { $bitform_dequeued_scripts = []; } $bitform_dequeued_scripts = array_merge($bitform_dequeued_scripts, $formIds); } public static function dequeueStyles(...$formIds) { foreach ($formIds as $formId) { wp_deregister_style("bitform-style-{$formId}"); wp_dequeue_style("bitform-style-{$formId}"); wp_deregister_style("bitform-style-{$formId}-formid"); wp_dequeue_style("bitform-style-{$formId}-formid"); } global $bitform_dequeued_styles; if (!is_array($bitform_dequeued_styles)) { $bitform_dequeued_styles = []; } $bitform_dequeued_styles = array_merge($bitform_dequeued_styles, $formIds); } public static function invalidateCustomUrlCache() { delete_transient('bitform_standalone_url_map'); delete_transient('bitform_conversational_url_map'); } public static function bitformMenuAccessCapability() { if (current_user_can('manage_bitform')) { return 'manage_bitform'; } elseif (current_user_can('access_bitform')) { return 'access_bitform'; } return 'manage_options'; } }