'elementor', // elementor 'vcv-action' => 'frontend', // visual composer 'fl_builder' => '', // beaver builder 'action' => 'in-front-editor', // brizy 'ct_builder' => 'true', // oxygen 'breakdance' => 'builder', // breakdance 'lc_action_launch_editing' => '1', // live canvas 'vc_action' => 'vc_inline', // wp bakery 'et_fb' => '1', // divi 'et_pb_preview' => 'true', // divi 'bricks' => 'run', // bricks 'action' => 'architect', // thrive architect 'page' => 'livecomposer_editor', // live composer ]; public static function getFormIdsFromPost() { global $post; global $wpdb; global $bfUniqFormIds; if (empty($post)) { $bfUniqFormIds = []; return; }; $postId = $post->ID; $formsIds = []; // $bfMetaValues = $wpdb->get_results("SELECT pmt1.meta_value FROM wp_postmeta pmt1 LEFT OUTER JOIN wp_postmeta pmt2 ON (pmt1.meta_id < pmt2.meta_id AND pmt1.meta_key = pmt2.meta_key) WHERE pmt2.meta_id IS NULL AND pmt1.post_id = {$postId} AND pmt1.meta_value LIKE '%[bitform%' ORDER BY pmt1.meta_id DESC"); $bfMetaValues = $wpdb->get_results('SELECT meta_value FROM `' . $wpdb->postmeta . "` WHERE `post_id`={$post->ID} AND meta_value LIKE '%[bitform id=%'"); $postContent = $post->post_content; $bfMetaValues[] = (object) ['meta_value' => $postContent]; foreach ($bfMetaValues as $bfShortcut) { $meta_value = $bfShortcut->meta_value; $meta_value = str_replace('\\', '', $meta_value); \preg_match_all("/\[bitform\s+id\s*=\s*('|\")\s*(\d+)\s*('|\")\]/", $meta_value, $shortCode); $shortCodes = $shortCode[2]; if (!empty($shortCodes)) { $formsIds = array_merge($formsIds, $shortCodes); } } $bfUniqFormIds = array_unique($formsIds); return $bfUniqFormIds; } public static function isPageBuilder() { global $bfMultipleFormsExists; global $isPageBuilder; $current_url = $_SERVER['REQUEST_URI']; $isAdminSide = false !== strpos($current_url, '/wp-admin/'); $isPageBuilder = get_transient('is_page_builder'); $isPageBuilderSessionExists = false !== $isPageBuilder; if ($isAdminSide) { $isPageBuilder = true; } if ($isPageBuilder) { $bfMultipleFormsExists = true; return true; } if ($isPageBuilderSessionExists) { set_transient('is_page_builder', $isPageBuilder); } self::getFormIdsFromPost(); global $bfUniqFormIds; $bfMultipleFormsExists = $isPageBuilder ? true : count($bfUniqFormIds) > 1; return $isPageBuilder; } public static function parseQueryParams($url) { $url_components = parse_url($url); if (isset($url_components['query'])) { parse_str($url_components['query'], $queryParams); return $queryParams; } return []; } public static function handleBfFormIdsSession($formId = null) { global $bfFrontendFormIds; $bfFrontendFormIds = get_transient('bf_frontend_form_ids'); if (empty($bfFrontendFormIds)) { $bfFrontendFormIds = []; } if (is_null($formId)) { return $bfFrontendFormIds; } $bfFrontendFormIds[] = $formId; set_transient('bf_frontend_form_ids', $bfFrontendFormIds); } }