function __construct() { $this->init(); $this->process_whitelisted_fields(); $this->set_fields(); $this->_additional_fields_options = array(); $this->_add_additional_fields(); $this->_add_custom_css_fields(); $this->_maybe_add_defaults(); if (!isset($this->main_css_element)) { $this->main_css_element = '%%order_class%%'; } $this->_shortcode_callback_num = 0; $this->type = isset($this->type) ? $this->type : ''; $this->decode_entities = isset($this->decode_entities) ? (bool) $this->decode_entities : false; $this->_style_priority = (int) self::DEFAULT_PRIORITY; if (isset($this->type) && 'child' === $this->type) { $this->_style_priority = $this->_style_priority + 1; } $this->main_tabs = $this->get_main_tabs(); $this->custom_css_tab = isset($this->custom_css_tab) ? $this->custom_css_tab : true; $post_types = !empty($this->post_types) ? $this->post_types : et_builder_get_builder_post_types(); // all modules should be assigned for et_pb_layout post type to work in the library if (!in_array('et_pb_layout', $post_types)) { $post_types[] = 'et_pb_layout'; } $this->post_types = apply_filters('et_builder_module_post_types', $post_types, $this->slug, $this->post_types); foreach ($this->post_types as $post_type) { if (!in_array($post_type, $this->post_types)) { $this->register_post_type($post_type); } if ('child' == $this->type) { self::$child_modules[$post_type][$this->slug] = $this; } else { self::$parent_modules[$post_type][$this->slug] = $this; } } if (!isset($this->no_shortcode_callback)) { $shortcode_slugs = array($this->slug); if (!empty($this->additional_shortcode_slugs)) { $shortcode_slugs = array_merge($shortcode_slugs, $this->additional_shortcode_slugs); } foreach ($shortcode_slugs as $shortcode_slug) { add_shortcode($shortcode_slug, array($this, '_shortcode_callback')); } if (isset($this->additional_shortcode)) { add_shortcode($this->additional_shortcode, array($this, 'additional_shortcode_callback')); } } }
function __construct() { $this->init(); $this->process_whitelisted_fields(); $this->set_fields(); $this->_additional_fields_options = array(); $this->_add_additional_fields(); $this->_add_custom_css_fields(); $this->_maybe_add_defaults(); if (!isset($this->main_css_element)) { $this->main_css_element = '%%order_class%%'; } $this->_shortcode_callback_num = 0; $this->type = isset($this->type) ? $this->type : ''; $this->_style_priority = (int) self::DEFAULT_PRIORITY; if (isset($this->type) && 'child' === $this->type) { $this->_style_priority = $this->_style_priority + 1; } $this->main_tabs = $this->get_main_tabs(); $this->post_types = et_builder_get_builder_post_types(); foreach ($this->post_types as $post_type) { if (!in_array($post_type, $this->post_types)) { $this->register_post_type($post_type); } if ('child' == $this->type) { self::$child_modules[$post_type][$this->slug] = $this; } else { self::$parent_modules[$post_type][$this->slug] = $this; } } if (!isset($this->no_shortcode_callback)) { $shortcode_slugs = array($this->slug); if (!empty($this->additional_shortcode_slugs)) { $shortcode_slugs = array_merge($shortcode_slugs, $this->additional_shortcode_slugs); } foreach ($shortcode_slugs as $shortcode_slug) { add_shortcode($shortcode_slug, array($this, '_shortcode_callback')); } if (isset($this->additional_shortcode)) { add_shortcode($this->additional_shortcode, array($this, 'additional_shortcode_callback')); } } }
function et_pb_add_custom_box() { $post_types = et_builder_get_builder_post_types(); foreach ($post_types as $post_type) { add_meta_box(ET_BUILDER_LAYOUT_POST_TYPE, __('The Divi Builder', 'et_builder'), 'et_pb_pagebuilder_meta_box', $post_type, 'normal', 'high'); } }
function __construct() { self::$current_module_index++; if (self::$loading_backbone_templates || et_admin_backbone_templates_being_loaded()) { if (!self::$loading_backbone_templates) { self::$loading_backbone_templates = true; } $start_from = (int) sanitize_text_field($_POST['et_templates_start_from']); $post_type = sanitize_text_field($_POST['et_post_type']); if ('layout' === $post_type) { // need - 2 to include the et_pb_section and et_pb_row modules $start_from = ET_Builder_Element::get_modules_count('page') - 2; } $current_module_index = self::$current_module_index - 1; if (!($current_module_index >= $start_from && $current_module_index < ET_BUILDER_AJAX_TEMPLATES_AMOUNT + $start_from)) { return; } } $this->init(); $this->process_whitelisted_fields(); $this->set_fields(); $this->_additional_fields_options = array(); $this->_add_additional_fields(); $this->_add_custom_css_fields(); $this->_maybe_add_defaults(); if (!isset($this->main_css_element)) { $this->main_css_element = '%%order_class%%'; } $this->_shortcode_callback_num = 0; $this->type = isset($this->type) ? $this->type : ''; $this->decode_entities = isset($this->decode_entities) ? (bool) $this->decode_entities : false; $this->_style_priority = (int) self::DEFAULT_PRIORITY; if (isset($this->type) && 'child' === $this->type) { $this->_style_priority = $this->_style_priority + 1; } $this->main_tabs = $this->get_main_tabs(); $this->custom_css_tab = isset($this->custom_css_tab) ? $this->custom_css_tab : true; $post_types = !empty($this->post_types) ? $this->post_types : et_builder_get_builder_post_types(); // all modules should be assigned for et_pb_layout post type to work in the library if (!in_array('et_pb_layout', $post_types)) { $post_types[] = 'et_pb_layout'; } $this->post_types = apply_filters('et_builder_module_post_types', $post_types, $this->slug, $this->post_types); foreach ($this->post_types as $post_type) { if (!in_array($post_type, $this->post_types)) { $this->register_post_type($post_type); } if ('child' == $this->type) { self::$child_modules[$post_type][$this->slug] = $this; } else { self::$parent_modules[$post_type][$this->slug] = $this; } } if (!isset($this->no_shortcode_callback)) { $shortcode_slugs = array($this->slug); if (!empty($this->additional_shortcode_slugs)) { $shortcode_slugs = array_merge($shortcode_slugs, $this->additional_shortcode_slugs); } foreach ($shortcode_slugs as $shortcode_slug) { add_shortcode($shortcode_slug, array($this, '_shortcode_callback')); } if (isset($this->additional_shortcode)) { add_shortcode($this->additional_shortcode, array($this, 'additional_shortcode_callback')); } } }
/** * Add "Use Visual Builder" link to WP-Admin bar * * @return void */ function et_fb_add_admin_bar_link() { if (!is_singular(et_builder_get_builder_post_types()) || !et_pb_is_allowed('use_visual_builder')) { return; } global $wp_admin_bar, $wp_the_query; $page_url = get_permalink(get_the_ID()); // Don't add the link, if Frontend Builder has been loaded already if (et_fb_is_enabled()) { $wp_admin_bar->add_menu(array('id' => 'et-disable-visual-builder', 'title' => esc_html__('Exit Visual Builder', 'et_builder'), 'href' => esc_url($page_url))); return; } $current_object = $wp_the_query->get_queried_object(); if (!current_user_can('edit_post', $current_object->ID)) { return; } $use_visual_builder_url = et_pb_is_pagebuilder_used(get_the_ID()) ? add_query_arg('et_fb', '1', et_fb_prepare_ssl_link($page_url)) : add_query_arg(array('et_fb_activation_nonce' => wp_create_nonce('et_fb_activation_nonce_' . get_the_ID())), $page_url); $wp_admin_bar->add_menu(array('id' => 'et-use-visual-builder', 'title' => esc_html__('Enable Visual Builder', 'et_builder'), 'href' => esc_url($use_visual_builder_url))); }