shortcode_array = []; $this->init(); } /** * Initializes the plugin by setting localization, hooks, filters, * and administrative functions. * * @access public * @since 1.0 */ public function init() { add_filter( 'fusion_app_preview_data', [ $this, 'add_builder_data' ], 10 ); // If preview frame. if ( fusion_is_preview_frame() ) { if ( ! is_preview_only() ) { // Used to create shortcode map. add_filter( 'the_content', [ $this, 'front_end_content' ], 99 ); add_filter( 'body_class', [ $this, 'body_class' ] ); add_filter( 'do_shortcode_tag', [ $this, 'create_shortcode_contents_map' ], 10, 4 ); remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); add_action( 'wp_enqueue_scripts', [ $this, 'preview_live_scripts' ], 999 ); add_filter( 'revslider_include_libraries', [ $this, 'include_rev_scripts' ], 999 ); add_action( 'tribe_events_single_event_before_the_content', [ $this, 'set_real_event_content' ], 999 ); add_action( 'fusion_pause_live_editor_filter', [ $this, 'pause_content_filter' ], 999 ); add_action( 'fusion_resume_live_editor_filter', [ $this, 'resume_content_filter' ], 999 ); } else { // Preview only mode, just need to filter the unsaved content. add_filter( 'fusion_filter_data', [ $this, 'preview_only_content' ], 9999 ); } add_filter( 'woocommerce_product_tabs', [ $this, 'product_tabs' ] ); } if ( fusion_is_builder_frame() ) { update_option( 'avada_builder_frontend_loaded', true ); add_action( 'wp_enqueue_scripts', [ $this, 'live_scripts' ], 999 ); add_action( 'wp_footer', [ $this, 'load_templates' ] ); // Builder mce button. add_filter( 'mce_external_plugins', [ $this, 'add_rich_plugins' ], 999 ); add_action( 'wp_footer', [ $this, 'fusion_builder_add_quicktags_button' ], 999 ); add_filter( 'fusion_privacy_bar', [ $this, 'disable_privacy_bar' ] ); if ( class_exists( 'QM' ) ) { add_filter( 'user_has_cap', [ $this, 'disable_qm' ], 10, 1 ); } add_action( 'wp_footer', [ $this, 'enqueue_wp_editor_scripts' ] ); } // Deregister WP admin forms.css. if ( fusion_is_preview_frame() || fusion_is_builder_frame() ) { wp_deregister_style( 'forms' ); } add_action( 'wp_ajax_nopriv_get_shortcode_render', [ $this, 'get_shortcode_render' ] ); add_action( 'wp_ajax_get_shortcode_render', [ $this, 'get_shortcode_render' ] ); add_action( 'wp_ajax_fusion_create_post', [ $this, 'create_post' ] ); add_filter( 'fusion_save_post_object', [ $this, 'save_builder_content' ] ); // For hierarchical post types. add_filter( 'page_row_actions', [ $this, 'add_edit_link' ], 10, 2 ); // For non-hierarchical post types. add_filter( 'post_row_actions', [ $this, 'add_edit_link' ], 10, 2 ); remove_filter( 'the_posts', [ FusionBuilder::get_instance(), 'next_page' ], 10 ); } /** * Add necessary data for builder. * * @access public * @since 6.0 * @param array $data The data already added. * @return array $data The data with panel data added. */ public function add_builder_data( $data ) { $data['shortcodeMap'] = $this->shortcode_array; $data['next_page_elements_count'] = $this->next_page_elements_count; return $data; } /** * Add shortcode generator toggle button to text editor. * * @since 1.0 */ public function fusion_builder_add_quicktags_button() { ?> allowed_post_types(); // Does use have capability to edit. $post_id = '' === $post_id ? fusion_library()->get_page_id() : $post_id; $post_type = get_post_type( $post_id ); $post_type_object = get_post_type_object( $post_type ); return in_array( $post_type, $allowed, true ) && current_user_can( $post_type_object->cap->edit_post, $post_id ); } /** * Creates the shortcode map for contents. * * @access public * @since 2.0.0 * @param string $output The output. * @param string $tag The tag. * @param array $attr The attributes. * @param array $m Argument. */ public function create_shortcode_contents_map( $output, $tag, $attr, $m ) { // Add further checks here to only get necessary code. if ( ! fusion_doing_ajax() && is_main_query() && is_singular() && ! Fusion_App()->is_full_refresh() ) { $this->shortcode_array[] = [ 'shortcode' => $m[0], 'output' => $output, 'tag' => $tag, ]; } return $output; } /** * Get the content for front-end editor. * * @since 6.0.0 * @param string $content The content. * @return string */ public function front_end_content( $content ) { if ( ( is_singular( 'tribe_events' ) && ! $this->real_event_content ) || $this->filtering_paused ) { return $content; } // Count the amount of next page elements. $this->next_page_elements_count = substr_count( $content, '[fusion_builder_next_page]' ); $this->next_page_elements_count = ( $this->next_page_elements_count ) ? $this->next_page_elements_count + 1 : 0; // Ajax check to make sure contents retrieved via ajax is regular content. if ( ( $this->editable_posttype() && $this->real_event_content ) || ( ! fusion_doing_ajax() && is_main_query() && ( is_singular() || ( class_exists( 'WooCommerce' ) && is_shop() ) ) && $this->editable_posttype() ) ) { $this->real_event_content = false; if ( false === $this->content_filtered ) { do_shortcode( $content ); } $this->content_filtered = true; $front_end_content = '
'; return apply_filters( 'fusion_builder_front_end_content', $front_end_content ); } return $content; } /** * We are within real content for single event. * * @since 6.0.0 * @return void */ public function set_real_event_content() { $this->real_event_content = true; } /** * Flag to pause filtering of content. * * @since 2.0.3 * @return void */ public function pause_content_filter() { $this->filtering_paused = true; } /** * Flag to resume filtering of content. * * @since 2.0.3 * @return void */ public function resume_content_filter() { $this->filtering_paused = false; } /** * Filter in unsaved conttent. * * @since 6.0.0 * @return void */ public function preview_only_content() { global $post; $post_content = Fusion_App()->get_data( 'post_content' ); if ( $post_content ) { $post_content = apply_filters( 'content_save_pre', $post_content ); // Post content. if ( $post_content ) { $post->post_content = $post_content; } } } /** * Add editor body class. * * @since 6.0.0 * @param array $classes classes being used. * @return string */ public function body_class( $classes ) { global $post; $classes[] = 'fusion-builder-live dont-animate'; if ( 'fusion_element' === get_post_type() ) { $terms = get_the_terms( $post->ID, 'element_category' ); $classes[] = 'fusion-builder-library-edit'; if ( $terms ) { $classes[] = 'fusion-element-post-type-' . $terms[0]->name; } } return $classes; } /** * Load the template files. * * @since 6.0.0 */ public function load_templates() { global $fusion_builder_elements, $fusion_builder_multi_elements; // Make sure map is generated later than customizer change. do_action( 'fusion_builder_before_init' ); // Structure. include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-element.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-parent-element.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-child-element.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-container.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-row.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-column.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-toolbar.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-history.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-blank-page.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-library.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-custom-css.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-shortcuts.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-end-preferences.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/context-menu.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/context-menu-inline.php'; include FUSION_BUILDER_PLUGIN_DIR . '/inc/templates/previews/fusion-default-preview.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/next-page.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/dynamic-selection.php'; // Shared element components. include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/new-slideshow-blog-shortcode.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/featured-image.php'; // Elements. include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-breadcrumbs.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-code-block.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-google-map.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-person.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-sharingbox.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-social-links.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-alert.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-audio.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-button.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-countdown.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-dropcap.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-fontawesome.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-highlight.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-image.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-lightbox.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-lottie.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-menu-anchor.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-menu.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-modal.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-modal-text-link.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-one-page-link.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-popover.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-progress.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-search.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-section-separator.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-separator.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-shortcode.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-soundcloud.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-tagline-box.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-table.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-text.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-title.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-tooltip.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-user-login.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-vimeo.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-video.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-youtube.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-syntax-highlighter.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-image-before-after.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-chart.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-pricing-table.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-blog.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-recent-posts.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-post-slider.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-events.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-widget-area.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-woo-product-slider.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-woo-featured-products-slider.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-gallery.php'; // Widget element. include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-widget.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-widget-content.php'; // Advanced Elements. include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-checklist.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-content-boxes.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-image-carousel.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-counters-box.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-counters-circle.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-flip-boxes.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-media-slider.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-tabs.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-testimonials.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/fusion-toggle.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-element-settings.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/front-element-settings-children.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/element-library.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/element-library-generator.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/element-library-nested-column.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/column-library.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/container-library.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/nested-column.php'; include FUSION_BUILDER_PLUGIN_DIR . '/front-end/templates/nested-row.php'; do_action( 'fusion_builder_load_templates' ); // Filter disabled elements. $fusion_builder_elements = fusion_builder_filter_available_elements(); // Registered third party shortcodes. $vendor_shortcodes = fusion_get_vendor_shortcodes( $fusion_builder_elements ); // Create elements js object. Load element's js and css. if ( ! empty( $fusion_builder_elements ) ) { $fusion_builder_elements = apply_filters( 'fusion_builder_all_elements', $fusion_builder_elements ); echo ''; // Load modules backend js and css. foreach ( $fusion_builder_elements as $module ) { // Front-end preview template. if ( ! empty( $module['front-end'] ) ) { require_once wp_normalize_path( $module['front-end'] ); } // Wireframe preview template. if ( ! empty( $module['preview'] ) ) { require_once wp_normalize_path( $module['preview'] ); } // Custom settings template. if ( ! empty( $module['front_end_custom_settings_template_file'] ) ) { require_once wp_normalize_path( $module['front_end_custom_settings_template_file'] ); } elseif ( ! empty( $module['custom_settings_template_file'] ) ) { require_once wp_normalize_path( $module['custom_settings_template_file'] ); } // Custom settings view. if ( ! empty( $module['front_end_custom_settings_view_js'] ) ) { wp_enqueue_script( $module['shortcode'] . '_custom_settings_view', $module['front_end_custom_settings_view_js'], '', FUSION_BUILDER_VERSION, true ); } elseif ( ! empty( $module['custom_settings_view_js'] ) ) { wp_enqueue_script( $module['shortcode'] . '_custom_settings_view', $module['custom_settings_view_js'], '', FUSION_BUILDER_VERSION, true ); } } } // Multi Element object. if ( ! empty( $fusion_builder_multi_elements ) ) { echo ''; } if ( ! empty( $vendor_shortcodes ) ) { echo ''; } } /** * Enqueue preview frame scripts. * * @since 6.0.0 * @param mixed $hook The hook. */ public function preview_live_scripts( $hook ) { wp_enqueue_code_editor( [] ); wp_enqueue_script( 'jquery' ); wp_enqueue_style( 'fusion-preview-frame-builder-css', FUSION_BUILDER_PLUGIN_URL . 'front-end/css/preview.css', false, FUSION_BUILDER_VERSION ); wp_enqueue_style( 'fusion-preview-frame-builder-no-controls-css', FUSION_BUILDER_PLUGIN_URL . 'front-end/css/preview-no-controls.css', false, FUSION_BUILDER_VERSION, 'none' ); // Elements Wireframe Preview. wp_enqueue_style( 'fusion_element_preview_css', FUSION_BUILDER_PLUGIN_URL . 'assets/admin/css/elements-preview.css', [], FUSION_BUILDER_VERSION ); wp_enqueue_script( 'google-maps-api' ); wp_enqueue_script( 'google-maps-infobox' ); } /** * Enqueue scripts. * * @since 6.0.0 * @param mixed $hook The hook. */ public function live_scripts( $hook ) { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'quicktags' ); global $typenow, $fusion_builder_elements, $fusion_builder_multi_elements, $pagenow, $post, $wp_scripts; // Isotope to avoid data issue cross frame. $js_folder_url = FUSION_LIBRARY_URL . '/assets' . ( ( true === FUSION_LIBRARY_DEV_MODE ) ? '' : '/min' ) . '/js'; wp_enqueue_script( 'isotope', $js_folder_url . '/library/isotope.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'packery', $js_folder_url . '/library/packery.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'images-loaded', $js_folder_url . '/library/imagesLoaded.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_style( 'fusion-builder-frame-builder-css', FUSION_BUILDER_PLUGIN_URL . 'front-end/css/builder.css', false, FUSION_BUILDER_VERSION ); // DiffDOM. wp_enqueue_script( 'diff-dom', FUSION_BUILDER_PLUGIN_URL . 'front-end/diffDOM.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'jquery-ui-overrides', FUSION_BUILDER_PLUGIN_URL . 'front-end/jquery-ui-overrides.js', [ 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-resizable' ], FUSION_BUILDER_VERSION, true ); // If we're not debugging, load the combined script. if ( ( ! defined( 'FUSION_BUILDER_DEV_MODE' ) || ! FUSION_BUILDER_DEV_MODE ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) ) { wp_enqueue_script( 'fusion_builder_frontend_combined', FUSION_BUILDER_PLUGIN_URL . 'front-end/fusion-frontend-combined.min.js', [ 'jquery', 'underscore', 'backbone', 'isotope', 'packery', 'diff-dom' ], FUSION_BUILDER_VERSION, true ); } else { // Generator JS. wp_enqueue_script( 'fusion_builder_shortcode_generator', FUSION_BUILDER_PLUGIN_URL . 'front-end/fusion-shortcode-generator.js', [], FUSION_BUILDER_VERSION, true ); // History. wp_enqueue_script( 'fusion_builder_history', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-history.js', [], FUSION_BUILDER_VERSION, true ); // Globals. wp_enqueue_script( 'fusion_builder_globals', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-globals.js', [], FUSION_BUILDER_VERSION, true ); // Settings helpers. wp_enqueue_script( 'fusion_builder_settings_helpers', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-settings-helpers.js', [], FUSION_BUILDER_VERSION, true ); // Draggable helpers. wp_enqueue_script( 'fusion_builder_draggable_helpers', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-draggable-helpers.js', [], FUSION_BUILDER_VERSION, true ); // Isotope helpers. wp_enqueue_script( 'fusion_builder_isotope_helpers', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-isotope-manager.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_toolbar', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-toolbar.js', [], FUSION_BUILDER_VERSION, true ); // Models. wp_enqueue_script( 'fusion_builder_model_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-element.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_extra_shortcodes', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-extra-shortcodes.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_dynamic_values', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-dynamic-values.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_dynamic_params', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-dynamic-params.js', [], FUSION_BUILDER_VERSION, true ); // Collections. wp_enqueue_script( 'fusion_builder_collection_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/collections/collection-element.js', [], FUSION_BUILDER_VERSION, true ); // Base view. wp_enqueue_script( 'fusion_builder_base', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-base.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_base_row', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-base-row.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_base_column', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-base-column.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_column', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-column.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_container', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-container.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_context_menu', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-context-menu.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_context_menu_inline', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-context-menu-inline.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-element.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_parent_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-parent-element.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_child_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-child-element.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_row', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-row.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_dyamic_selection', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-dynamic-selection.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_dyamic_data', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-dynamic-data.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_settings', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-element-settings.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_settings', FUSION_BUILDER_PLUGIN_URL . 'js/views/view-base-widget-settings.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_settings-children', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-element-settings-parent.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_elements_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-library-elements.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_column_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-library-column.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_column_nested_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-library-nested-column.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_container_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-library-container.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_generator_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-generator-elements.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_column_nested', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-column-nested.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_row_nested', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-row-nested.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_blank_page', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-blank-page.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_front_element_preview', FUSION_BUILDER_PLUGIN_URL . 'js/views/view-element-preview.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_front_next_page', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-next-page.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_keyboard_shortcuts', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-keyboard-shortcuts.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_preferences', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-builder-preferences.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_library', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/view-library.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_template_helpers', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-template-helpers.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_inline_editor_helpers', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-inline-editor-helpers.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_callback_functions', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-callback-functions.js', [], FUSION_BUILDER_VERSION, true ); // Wireframe. wp_enqueue_script( 'fusion_builder_wireframe', FUSION_BUILDER_PLUGIN_URL . 'front-end/models/model-wireframe.js', [], FUSION_BUILDER_VERSION, true ); // App. wp_enqueue_script( 'fusion_builder_live_app', FUSION_BUILDER_PLUGIN_URL . 'front-end/front-end.js', [], FUSION_BUILDER_VERSION, true ); // Element views. wp_enqueue_script( 'fusion_builder_counter_circle_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-child-counter-circle.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_counter_circles_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-child-counter-circles.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_gallery_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-gallery.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_menu_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-menu.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_gallery_item_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-gallery-child.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_separator_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-separator.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_title_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-title.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_testimonials_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-testimonials.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_testimonial_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-testimonial.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_tooltip_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-tooltip.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_sharingbox_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-sharingbox.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_section_separator_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-section-separator.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_modal_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-modal.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_code_block_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-code-block.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_alert_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-alert.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_audio_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-audio.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_map_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-google-map.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_fontawesome_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-font-awesome.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_button_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-button.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_image_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-image.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_layerslider_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-layerslider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_lottie_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-lottie.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_slider_revolution_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-slider-revolution.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_convert_plus_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-convert-plus.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_person_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-person.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_video_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-video.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_vimeo_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-vimeo.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_post_slider_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-post-slider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_user_login_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-user-login.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_user_register_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-user-register.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_user_lost_password_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-user-lost-password.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_woo_featured_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-woo-featured-products-slider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_highlight_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-highlight.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_syntax_highlighter_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-syntax-highlighter.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_tabs_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-tabs.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_tab_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-tab.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_table_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-table.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_progress_bar_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-progress-bar.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_recent_posts_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-recent-posts.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_woo_product_slider_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-woo-product-slider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_slider_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-media-slider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_slide_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-slide.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_image_carousel_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-image-carousel.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_image_carousel_child_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-image-carousel-child.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_one_page_link_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-one-page-link.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_dropcap_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-dropcap.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_flip_boxes_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-flip-boxes.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_flip_box_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-flip-box.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_accordion_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-accordion.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_toggle_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-accordion-toggle.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_chart_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-chart.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_chart_dataset_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-chart-dataset.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_image_before_after_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-image-before-after.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_counters_box_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-counters-box.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_counter_box_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-counter-box.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_area_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-widget-area.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_content_boxes_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-content-boxes.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_content_box_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-content-box.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_social_links_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-social-links.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_modal_text_link_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-modal-text-link.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_popover_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-popover.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_events_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-events.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_countdown_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-countdown.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_view_menu_anchor_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-menu-anchor.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_checklist_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-checklist.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_checklist_item_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-checklist-item.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_youtube_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-youtube.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_soundcloud_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-soundcloud.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_text_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-text.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_tagline_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-tagline-box.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_pricing_table_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-pricing-table.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_pricing_column_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-pricing-column.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_blog_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-blog.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_breadcrumbs_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-breadcrumbs.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_lightbox_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-lightbox.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-widget.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_content', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/widgets/view-widget-content.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_revslider', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/widgets/view-revslider.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_facebook', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/widgets/view-facebook.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_widget_wp_video', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/widgets/view-wp-video.js', [], FUSION_BUILDER_VERSION, true ); wp_enqueue_script( 'fusion_builder_search_element', FUSION_BUILDER_PLUGIN_URL . 'front-end/views/elements/view-search.js', [], FUSION_BUILDER_VERSION, true ); do_action( 'fusion_builder_enqueue_separate_live_scripts' ); } // Localize Scripts. $script_id = ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) ? 'fusion_builder_frontend_combined' : 'fusion_builder_callback_functions'; $localize_handle = ( ( ! defined( 'FUSION_LIBRARY_DEV_MODE' ) || ! FUSION_LIBRARY_DEV_MODE ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) ) ? 'fusion_library_frontend_combined' : 'fusion_app'; wp_localize_script( $script_id, 'fusionBuilderCallbackFunctionsNonce', wp_create_nonce( 'fusion_builder_callback_functions' ) ); wp_localize_script( $localize_handle, 'builderConfig', [ 'fusion_builder_plugin_dir' => FUSION_BUILDER_PLUGIN_URL, 'allowed_post_types' => FusionBuilder()->allowed_post_types(), 'disable_encoding' => get_option( 'avada_disable_encoding' ), ] ); do_action( 'fusion_builder_enqueue_live_scripts' ); } /** * Handle live-preview rendering in the front-end builder. * * @param bool $include_scripts Whether scripts should be included or not. * * @since 6.0 * @return bool */ public function include_rev_scripts( $include_scripts ) { return true; } /** * Handles live-preview rendering in the front-end builder. * * @param bool $privacy_bar Whether privacy bar should be rendered or not. * * @since 6.0 * @return bool */ public function disable_privacy_bar( $privacy_bar ) { return false; } /** * Disables query monitor in front-end builder mode. * * @param array $user_caps Array of user capabilities. * * @since 6.0 * @return array */ public function disable_qm( $user_caps ) { $user_caps['view_query_monitor'] = false; return $user_caps; } /** * Test function to get shortcode output. * * @since 6.0.0 */ public function get_shortcode_render() { check_ajax_referer( 'fusion_load_nonce', 'fusion_load_nonce' ); $return_data = []; FusionBuilder()->set_global_shortcode_parent( wp_unslash( $_POST['cid'] ) );// phpcs:ignore WordPress.Security.ValidatedSanitizedInput if ( isset( $_POST['shortcodes'] ) ) { $return_data['shortcodes'] = []; $post_shortcodes = wp_unslash( $_POST['shortcodes'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput if ( ! empty( $post_shortcodes ) ) { foreach ( $post_shortcodes as $shortcode ) { $shortcode = wp_unslash( $shortcode ); $return_data['shortcodes'][ $shortcode ] = do_shortcode( $shortcode ); } } } $content = ''; if ( isset( $_POST['content'] ) ) { $content = wp_unslash( $_POST['content'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput } $return_data['content'] = do_shortcode( $content ); echo wp_json_encode( $return_data ); wp_die(); } /** * Create a new post. * * @since 6.0.0 */ public function create_post() { check_ajax_referer( 'fusion_load_nonce', 'fusion_load_nonce' ); $post_type = ( isset( $_POST['post_type'] ) ) ? sanitize_text_field( wp_unslash( $_POST['post_type'] ) ) : 'post'; $post_type_object = get_post_type_object( $post_type ); if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) { return; } $sidebar_option_names = ( class_exists( 'Avada' ) ? avada_get_sidebar_post_meta_option_names( $post_type ) : [] ); // Create post object. $my_post = [ 'post_title' => __( 'Draft', 'fusion-builder' ) . ' ' . $post_type_object->labels->singular_name, 'post_content' => '', 'post_status' => 'draft', 'post_type' => $post_type, 'meta_input' => [ $sidebar_option_names[0] => [ 'default_sidebar' ], $sidebar_option_names[1] => [ 'default_sidebar' ], ], ]; // Insert the post into the database. $post_id = wp_insert_post( apply_filters( 'fusion_live_editor_draft', $my_post ) ); $return_data = [ 'post_id' => $post_id, 'permalink' => get_permalink( $post_id ), ]; echo wp_json_encode( $return_data ); die(); } /** * Enqueue additional editor scripts if they are needed. * * @since 2.0.0 */ public function enqueue_wp_editor_scripts() { if ( ! class_exists( '_WP_Editors' ) ) { require wp_normalize_path( ABSPATH . WPINC . '/class-wp-editor.php' ); } $set = _WP_Editors::parse_settings( 'fusion_builder_editor', [] ); if ( ! current_user_can( 'upload_files' ) ) { $set['media_buttons'] = false; } _WP_Editors::editor_settings( 'fusion_builder_editor', $set ); } /** * Save post content. * * @access public * @since 2.0.0 * @param array $post The post args. * @return array */ public function save_builder_content( $post ) { $post_id = Fusion_App()->get_data( 'post_id' ); $post_content = Fusion_App()->get_data( 'post_content' ); if ( false !== $post_content && $this->editable_posttype( $post_id ) ) { $post['post_content'] = $post_content; } return $post; } /** * Adds the FB frontend link in the posts list links. * * @since 2.0 * @access public * @param array $actions Post actions. * @param WP_Post $post Edited post. * @return array Updated post actions. */ public function add_edit_link( $actions, $post ) { // If user can't edit early exit. if ( ! isset( $actions['edit'] ) || ( isset( $_GET['post_status'] ) && 'trash' === $_GET['post_status'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification return $actions; } $live_editor = apply_filters( 'fusion_load_live_editor', true ); // Add link if fusion_builder_status is set to active. if ( 'active' === get_post_meta( $post->ID, 'fusion_builder_status', true ) && $live_editor ) { /* translators: The title. */ $actions['fusion_builder_live'] = '' . esc_html__( 'Avada Live', 'fusion-builder' ) . ''; } return $actions; } /** * Filters tabs for single products. * * @access public * @since 2.0 * @param array $tabs The tabs array. * @return array */ public function product_tabs( $tabs ) { if ( ! isset( $tabs['description'] ) && fusion_is_preview_frame() ) { $tabs['description'] = [ 'title' => esc_html__( 'Description', 'fusion-builder' ), 'priority' => 10, 'callback' => 'woocommerce_product_description_tab', ]; } return $tabs; } } } add_action( 'fusion_load_internal_module', 'load_builder_front_class', 4 ); /** * Instantiate Fusion_Builder_Front class. */ function load_builder_front_class() { Fusion_Builder_Front::get_instance(); } /** * Loop for front-options. * * @since 2.0.0 * @param array $params An array of arguments. */ function fusion_element_front_options_loop( $params ) { ?> <# function fusion_display_option( param ) { var hasDynamic, supportsDynamic, escape_html, hasResponsive, responsiveIcons = { 'large': 'desktop', 'medium': 'tablet', 'small': 'mobile' }; option_value = 'undefined' !== typeof atts.added ? param.value : atts.params[param.param_name]; if ( 'element_content' === param.param_name && 'undefined' !== typeof atts.inlineElement && 'undefined' !== typeof atts.added ) { option_value = atts.params[param.param_name]; } if ( param.type == 'select' || param.type == 'multiple_select' || param.type == 'radio_button_set' || param.type == 'checkbox_button_set' || param.type == 'subgroup' ) { option_value = ( 'undefined' !== typeof atts.added || '' === atts.params[param.param_name] || 'undefined' === typeof atts.params[param.param_name] ) ? param.default : atts.params[param.param_name]; }; if ( ( 'code' === param.type && 1 === Number( FusionApp.settings.disable_code_block_encoding ) ) || 'raw_textarea' === param.type ) { if ( FusionPageBuilderApp.base64Encode( FusionPageBuilderApp.base64Decode( option_value ) ) === option_value ) { option_value = FusionPageBuilderApp.base64Decode( option_value ); } } option_value = _.unescape(option_value); hidden = 'undefined' !== typeof param.hidden ? ' hidden' : ''; // Used to flag that option should be escaped. escape_html = 'undefined' !== typeof param.escape_html && true === param.escape_html ? ' escape_html' : ''; childDependency = 'undefined' !== typeof param.child_dependency ? ' has-child-dependency' : ''; tabGroup = 'undefined' !== typeof param.tab ? ' fusion-subgroup-item ' + param.tab : ''; optionMap = '' !== param.option_map ? param.option_map : ''; // Change radio-buttonset to select when needed. if ( 'radio_button_set' === param.type && 'object' !== typeof param.icons ) { var radioButtonSetLength = 0; if ( Object.keys( param.value ).length > 5 ) { param.type = 'select'; } else { _.each( param.value, function( label ) { radioButtonSetLength += label.length * 10 + 24; } ); if ( 310 <= radioButtonSetLength ) { param.type = 'select'; } } } supportsDynamic = 'undefined' !== typeof param.dynamic_data && true === param.dynamic_data ? true : false; hasDynamic = 'object' === typeof atts.dynamic_params && 'undefined' !== typeof atts.dynamic_params[ param.param_name ] && supportsDynamic; hasResponsive = 'undefined' !== typeof param.responsive ? true : false; responsiveState = 'undefined' !== typeof param.responsive ? 'responsive-state-' + param.responsive.state : ''; #> <# } #>