function et_pb_maybe_add_advanced_styles() { $style = ET_Builder_Element::get_style(); if ($style) { printf('<style type="text/css" id="et-builder-advanced-style"> %1$s </style>', $style); } }
function _shortcode_passthru_callback($atts, $content = null, $function_name, $parent_address = '', $global_parent = '', $global_parent_type = '') { global $post; $attrs = array(); $fields = $this->process_fields($this->fields_unprocessed); $global_shortcode_content = false; $function_name_processed = et_fb_prepare_tag($function_name); //override module attributes for global module if (!empty($atts['global_module'])) { $global_content = et_pb_load_global_module($atts['global_module']); if ('' !== $global_content) { if (!isset($atts['saved_tabs']) || false !== strpos($atts['saved_tabs'], 'general') || 'all' === $atts['saved_tabs']) { $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name_processed); } // remove the shortcode content to avoid conflicts of parent attributes with similar attrs from child modules if (false !== $global_shortcode_content) { $global_content_processed = str_replace($global_shortcode_content, '', $global_content); } else { $global_content_processed = $global_content; } $global_atts = shortcode_parse_atts($global_content_processed); foreach ($this->shortcode_atts as $single_attr => $value) { if (isset($global_atts[$single_attr])) { $this->shortcode_atts[$single_attr] = $global_atts[$single_attr]; } } } else { // remove global_module attr if it doesn't exist in DB $this->shortcode_atts['global_module'] = ''; $global_parent = ''; } } // TODO, cleanup this loop. foreach ($this->shortcode_atts as $shortcode_attr_key => $shortcode_attr_value) { if (isset($fields[$shortcode_attr_key]['type']) && 'computed' === $fields[$shortcode_attr_key]['type']) { $field = $fields[$shortcode_attr_key]; $depends_on = array(); foreach ($field['computed_depends_on'] as $depends_on_field) { $depends_on[$depends_on_field] = $this->shortcode_atts[$depends_on_field]; } if (!is_callable($field['computed_callback'])) { die($shortcode_attr_key . ' Callback:' . $field['computed_callback'] . ' is not callable.... '); // TODO, fix this make it more graceful... } $value = call_user_func($field['computed_callback'], $depends_on); } else { $value = $shortcode_attr_value; } $attrs[$shortcode_attr_key] = is_string($value) ? html_entity_decode($value) : $value; } // Format FB component path // TODO, move this to class method and property, and allow both to be overridden $component_path = str_replace('et_pb_', '', $function_name_processed); $component_path = str_replace('_', '-', $component_path); $component_path = $component_path; // Prepare modules. $modules = 'child' === $this->type ? self::$child_modules : self::$parent_modules; if (isset($post->post_type, $modules[$post->post_type][$function_name_processed])) { $modules = $modules[$post->post_type][$function_name_processed]; } else { $modules = array(); } // Build custom CSS. $custom_css = array(); if (isset($modules->custom_css_options)) { foreach ($modules->custom_css_options as $custom_css_key => $custom_css_option) { $custom_css_option['key'] = "custom_css_{$custom_css_key}"; $custom_css[] = $custom_css_option; } } // Build advanced options and defaults. $advanced_options = array(); $advanced_defaults = array(); if (!empty($modules->advanced_options)) { $advanced_options = $modules->advanced_options; } if (isset($modules->fields_unprocessed)) { foreach ($modules->fields_unprocessed as $fields_unprocessed_key => $field_unprocessed) { if (isset($field_unprocessed['default'], $field_unprocessed['tab_slug']) && 'advanced' === $field_unprocessed['tab_slug']) { $advanced_defaults[$fields_unprocessed_key] = $field_unprocessed['default']; } } } $_i = isset($atts['_i']) ? $atts['_i'] : 0; $address = isset($atts['_address']) ? $atts['_address'] : '0'; // set the global parent if exists if ((!isset($attrs['global_module']) || '' === $attrs['global_module']) && '' !== $global_parent) { $attrs['global_parent'] = $global_parent; } if (isset($this->is_structure_element) && $this->is_structure_element) { $this->fb_support = true; } if (!$this->fb_support) { global $et_fb_processing_shortcode_object; $et_fb_processing_shortcode_object = false; $raw_child_content = $content; $content = $this->_shortcode_callback($atts, $content, $function_name_processed); $executed_shortcode = do_shortcode($content); $processed_content = false !== $global_shortcode_content ? $global_shortcode_content : $this->shortcode_content; $attrs['content_new'] = array_key_exists('content_new', $this->whitelisted_fields) ? $processed_content : et_fb_process_shortcode($processed_content, $address, $global_parent, $global_parent_type); $et_fb_processing_shortcode_object = true; } else { $processed_content = false !== $global_shortcode_content ? $global_shortcode_content : $this->shortcode_content; $content = array_key_exists('content_new', $this->whitelisted_fields) || 'et_pb_code' === $function_name_processed || 'et_pb_fullwidth_code' === $function_name_processed ? $processed_content : et_fb_process_shortcode($processed_content, $address, $global_parent, $global_parent_type); } if (is_array($content)) { $prepared_content = $content; } else { if ($this->fb_support && count(preg_split('/\\r\\n*\\n/', trim($content), -1, PREG_SPLIT_NO_EMPTY)) > 1) { $prepared_content = wpautop($content); } else { $prepared_content = html_entity_decode($content); } } // Build object. $object = array('_i' => $_i, '_order' => $_i, 'address' => $address, 'child_slug' => $this->child_slug, 'fb_support' => $this->fb_support, 'parent_address' => $parent_address, 'shortcode_index' => $this->_shortcode_callback_num, 'type' => $function_name, 'component_path' => $component_path, 'attrs' => $attrs, 'advanced_options' => $advanced_options, 'advanced_defaults' => $advanced_defaults, 'defaults' => isset($this->defaults) ? $this->defaults : '', 'fields_defaults' => isset($this->fields_defaults) ? $this->fields_defaults : '', 'custom_css' => $custom_css, 'content' => $prepared_content, 'is_module_child' => 'child' === $this->type, 'prepared_styles' => !$this->fb_support ? ET_Builder_Element::get_style() : ''); if (!$this->fb_support) { if (!empty($this->child_slug)) { $object['raw_child_content'] = $raw_child_content; } } return $object; }
function et_pb_maybe_add_advanced_styles() { $styles['et-builder-advanced-style'] = ET_Builder_Element::get_style(); $styles['et-builder-page-custom-style'] = et_pb_get_page_custom_css(); foreach ($styles as $id => $style_data) { if (!$style_data) { continue; } printf('<style type="text/css" id="%2$s"> %1$s </style>', $style_data, esc_attr($id)); } }
function et_pb_maybe_add_advanced_styles() { $styles = array(); // do not output advanced css if Frontend Builder is active if (!et_fb_is_enabled()) { $styles['et-builder-advanced-style'] = ET_Builder_Element::get_style(); $styles['et-builder-page-custom-style'] = et_pb_get_page_custom_css(); } foreach ($styles as $id => $style_data) { if (!$style_data) { continue; } printf('<style type="text/css" id="%2$s"> %1$s </style>', $style_data, esc_attr($id)); } }