Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: class-et-builder-element.php
$render_method = $et_fb_processing_shortcode_object ? 'render_as_builder_data' : 'render';
[2500] Fix | Delete
$output = $this->{$render_method}( $attrs, $content, $render_slug, $parent_address, $global_parent, $global_parent_type, $parent_type );
[2501] Fix | Delete
$this->is_rendering = false;
[2502] Fix | Delete
[2503] Fix | Delete
// Wrap 3rd party module rendered output with proper module wrapper
[2504] Fix | Delete
// @TODO implement module wrapper on official module
[2505] Fix | Delete
if ( 'on' === $this->vb_support && 'render' === $render_method && ! $this->_is_official_module ) {
[2506] Fix | Delete
$output = $this->_render_module_wrapper( $output, $render_slug );
[2507] Fix | Delete
}
[2508] Fix | Delete
[2509] Fix | Delete
/**
[2510] Fix | Delete
* Filters every builder modules shortcode output.
[2511] Fix | Delete
*
[2512] Fix | Delete
* @since 3.1
[2513] Fix | Delete
*
[2514] Fix | Delete
* @param string $output
[2515] Fix | Delete
* @param string $module_slug
[2516] Fix | Delete
* @param object $this
[2517] Fix | Delete
*/
[2518] Fix | Delete
$output = apply_filters( 'et_module_shortcode_output', $output, $render_slug, $this );
[2519] Fix | Delete
[2520] Fix | Delete
/**
[2521] Fix | Delete
* Filters builder module shortcode output. The dynamic portion of the filter name, `$render_slug`,
[2522] Fix | Delete
* refers to the slug of the module for which the shortcode output was generated.
[2523] Fix | Delete
*
[2524] Fix | Delete
* @since 3.0.87
[2525] Fix | Delete
*
[2526] Fix | Delete
* @param string $output
[2527] Fix | Delete
* @param string $module_slug
[2528] Fix | Delete
*/
[2529] Fix | Delete
$output = apply_filters( "{$render_slug}_shortcode_output", $output, $render_slug );
[2530] Fix | Delete
[2531] Fix | Delete
$this->_bump_render_count();
[2532] Fix | Delete
[2533] Fix | Delete
if ( ! $post_interference ) {
[2534] Fix | Delete
ET_Post_Stack::restore();
[2535] Fix | Delete
}
[2536] Fix | Delete
[2537] Fix | Delete
if ( $hide_subject_module ) {
[2538] Fix | Delete
return '';
[2539] Fix | Delete
}
[2540] Fix | Delete
[2541] Fix | Delete
if ( $hide_subject_module_cached ) {
[2542] Fix | Delete
$previous_subjects_cache = get_post_meta( $post_id, 'et_pb_subjects_cache', true );
[2543] Fix | Delete
[2544] Fix | Delete
if ( empty( $previous_subjects_cache ) ) {
[2545] Fix | Delete
$previous_subjects_cache = array();
[2546] Fix | Delete
}
[2547] Fix | Delete
[2548] Fix | Delete
if ( empty( $this->template_name ) ) {
[2549] Fix | Delete
$previous_subjects_cache[ $this->props['ab_subject_id'] ] = $output;
[2550] Fix | Delete
} else {
[2551] Fix | Delete
$previous_subjects_cache[ $this->props['ab_subject_id'] ] = $this->output();
[2552] Fix | Delete
}
[2553] Fix | Delete
[2554] Fix | Delete
// update the subjects cache in post meta to use it later
[2555] Fix | Delete
update_post_meta( $post_id, 'et_pb_subjects_cache', $previous_subjects_cache );
[2556] Fix | Delete
[2557] Fix | Delete
// generate the placeholder to output on front-end instead of actual content
[2558] Fix | Delete
$subject_placeholder = sprintf(
[2559] Fix | Delete
'<div class="et_pb_subject_placeholder et_pb_subject_placeholder_id_%1$s_%2$s" style="display: none;"></div>',
[2560] Fix | Delete
esc_attr( $post_id ),
[2561] Fix | Delete
esc_attr( $this->props['ab_subject_id'] )
[2562] Fix | Delete
);
[2563] Fix | Delete
[2564] Fix | Delete
return $subject_placeholder;
[2565] Fix | Delete
}
[2566] Fix | Delete
[2567] Fix | Delete
// Do not use `template_name` while processing object for VB
[2568] Fix | Delete
if ( $et_fb_processing_shortcode_object || empty( $this->template_name ) ) {
[2569] Fix | Delete
return $output;
[2570] Fix | Delete
}
[2571] Fix | Delete
[2572] Fix | Delete
return $this->output();
[2573] Fix | Delete
}
[2574] Fix | Delete
[2575] Fix | Delete
/**
[2576] Fix | Delete
* Add "et_animated" class using filter. Obsolete method and only applied to old 3rd party modules without `modules_classname()` method
[2577] Fix | Delete
*
[2578] Fix | Delete
* @param string $output
[2579] Fix | Delete
* @param string $module_slug
[2580] Fix | Delete
*
[2581] Fix | Delete
* @return string
[2582] Fix | Delete
*/
[2583] Fix | Delete
function add_et_animated_class( $output, $module_slug ) {
[2584] Fix | Delete
if ( ! is_string( $output ) || in_array( $module_slug, ET_Builder_Element::$uses_module_classname ) ) {
[2585] Fix | Delete
return $output;
[2586] Fix | Delete
}
[2587] Fix | Delete
[2588] Fix | Delete
remove_filter( "{$module_slug}_shortcode_output", array( $this, 'add_et_animated_class' ), 10 );
[2589] Fix | Delete
[2590] Fix | Delete
return preg_replace( "/class=\"(.*?{$module_slug}_\d+.*?)\"/", 'class="$1 et_animated"', $output, 1 );
[2591] Fix | Delete
}
[2592] Fix | Delete
[2593] Fix | Delete
/**
[2594] Fix | Delete
* Delete attribute values that are equal to the global default value (if one exists).
[2595] Fix | Delete
*
[2596] Fix | Delete
* @return void
[2597] Fix | Delete
*/
[2598] Fix | Delete
protected function _maybe_remove_global_default_values_from_props() {
[2599] Fix | Delete
$fields = $this->fields_unprocessed;
[2600] Fix | Delete
$must_print_fields = array( 'text_orientation' );
[2601] Fix | Delete
[2602] Fix | Delete
/**
[2603] Fix | Delete
* Filters Must Print attributes array.
[2604] Fix | Delete
* Must Print attributes - attributes which defaults should always be printed on Front End
[2605] Fix | Delete
*
[2606] Fix | Delete
* @deprecated
[2607] Fix | Delete
*
[2608] Fix | Delete
* @param array $must_print_fields Array of attribute names.
[2609] Fix | Delete
*/
[2610] Fix | Delete
$must_print_fields = apply_filters( $this->slug . '_must_print_attributes', $must_print_fields );
[2611] Fix | Delete
$slug = isset( $this->global_settings_slug ) ? $this->global_settings_slug : $this->slug;
[2612] Fix | Delete
[2613] Fix | Delete
$module_slug = self::$global_presets_manager->maybe_convert_module_type( $this->slug, $this->props );
[2614] Fix | Delete
$module_preset_settings = self::$global_presets_manager->get_module_presets_settings( $module_slug, $this->props );
[2615] Fix | Delete
[2616] Fix | Delete
foreach ( $fields as $field_key => $field_settings ) {
[2617] Fix | Delete
$global_setting_name = "$slug-$field_key";
[2618] Fix | Delete
$global_setting_value = ET_Global_Settings::get_value( $global_setting_name );
[2619] Fix | Delete
[2620] Fix | Delete
if ( ! $global_setting_value || in_array( $field_key, $must_print_fields ) ) {
[2621] Fix | Delete
continue;
[2622] Fix | Delete
}
[2623] Fix | Delete
[2624] Fix | Delete
$attr_value = self::$_->array_get( $this->props, $field_key, '' );
[2625] Fix | Delete
[2626] Fix | Delete
if ( $attr_value && $attr_value === $global_setting_value && ! array_key_exists( $field_key, $module_preset_settings ) ) {
[2627] Fix | Delete
$this->props[ $field_key ] = '';
[2628] Fix | Delete
}
[2629] Fix | Delete
}
[2630] Fix | Delete
}
[2631] Fix | Delete
[2632] Fix | Delete
// intended to be overridden as needed
[2633] Fix | Delete
function maybe_inherit_values() {}
[2634] Fix | Delete
[2635] Fix | Delete
/**
[2636] Fix | Delete
* Like {@see self::render()}, but sources the output from a template file. The template name
[2637] Fix | Delete
* should be set in {@see self::$template_name}.
[2638] Fix | Delete
*
[2639] Fix | Delete
* Note: this functionality is not currently supported by the Visual Builder. Pages containing
[2640] Fix | Delete
* modules that use this method to render their output cannot be edited using the Visual Builder
[2641] Fix | Delete
* at this time. However, full support will be added in the coming months.
[2642] Fix | Delete
*
[2643] Fix | Delete
* @since 3.1 Renamed from `shortcode_output()` to `output()`
[2644] Fix | Delete
* @since 2.4.6
[2645] Fix | Delete
*
[2646] Fix | Delete
* @return string
[2647] Fix | Delete
*/
[2648] Fix | Delete
function output() {
[2649] Fix | Delete
if ( empty( $this->template_name ) ) {
[2650] Fix | Delete
return '';
[2651] Fix | Delete
}
[2652] Fix | Delete
[2653] Fix | Delete
if ( method_exists( $this, 'shortcode_output' ) ) {
[2654] Fix | Delete
// Backwards compatibility
[2655] Fix | Delete
return $this->__call( 'shortcode_output', array() );
[2656] Fix | Delete
}
[2657] Fix | Delete
[2658] Fix | Delete
$this->props['content'] = $this->content;
[2659] Fix | Delete
extract( $this->props );
[2660] Fix | Delete
ob_start();
[2661] Fix | Delete
require( locate_template( $this->template_name . '.php' ) );
[2662] Fix | Delete
return ob_get_clean();
[2663] Fix | Delete
}
[2664] Fix | Delete
[2665] Fix | Delete
/**
[2666] Fix | Delete
* Generates HTML data attributes from an array of props.
[2667] Fix | Delete
*
[2668] Fix | Delete
* @since 3.1 Rename from `shortcode_atts_to_data_atts()` to `props_to_html_data_attrs()`
[2669] Fix | Delete
* @since 1.0
[2670] Fix | Delete
*
[2671] Fix | Delete
* @param array $props
[2672] Fix | Delete
*
[2673] Fix | Delete
* @return string
[2674] Fix | Delete
*/
[2675] Fix | Delete
public function props_to_html_data_attrs( $props = array() ) {
[2676] Fix | Delete
if ( empty( $props ) ) {
[2677] Fix | Delete
return '';
[2678] Fix | Delete
}
[2679] Fix | Delete
[2680] Fix | Delete
$output = array();
[2681] Fix | Delete
[2682] Fix | Delete
foreach ( $props as $attr ) {
[2683] Fix | Delete
$output[] = 'data-' . esc_attr( $attr ) . '="' . esc_attr( $this->props[ $attr ] ) . '"';
[2684] Fix | Delete
}
[2685] Fix | Delete
[2686] Fix | Delete
return implode( ' ', $output );
[2687] Fix | Delete
}
[2688] Fix | Delete
[2689] Fix | Delete
/**
[2690] Fix | Delete
* This method is called before {@self::_render()} for rows, columns, and modules. It can
[2691] Fix | Delete
* be overridden by elements that need to perform any tasks before rendering begins.
[2692] Fix | Delete
*
[2693] Fix | Delete
* @since 3.1 Renamed from `pre_shortcode_content()` to `before_render()`.
[2694] Fix | Delete
* @since 1.0
[2695] Fix | Delete
*/
[2696] Fix | Delete
public function before_render() {
[2697] Fix | Delete
if ( method_exists( $this, 'pre_shortcode_content' ) ) {
[2698] Fix | Delete
// Backwards compatibility
[2699] Fix | Delete
$this->__call( 'pre_shortcode_content', array() );
[2700] Fix | Delete
}
[2701] Fix | Delete
}
[2702] Fix | Delete
[2703] Fix | Delete
/**
[2704] Fix | Delete
* Generates the module's HTML output based on {@see self::$props}. This method should be
[2705] Fix | Delete
* overridden in module classes.
[2706] Fix | Delete
*
[2707] Fix | Delete
* @since 3.1 Renamed from `shortcode_callback()` to `render()`.
[2708] Fix | Delete
* @since 1.0
[2709] Fix | Delete
*
[2710] Fix | Delete
* @param array $attrs List of unprocessed attributes
[2711] Fix | Delete
* @param string $content Content being processed
[2712] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output
[2713] Fix | Delete
*
[2714] Fix | Delete
* @return string The module's HTML output.
[2715] Fix | Delete
*/
[2716] Fix | Delete
public function render( $attrs, $content = null, $render_slug ) {
[2717] Fix | Delete
if ( method_exists( $this, 'shortcode_callback' ) ) {
[2718] Fix | Delete
// Backwards compatibility
[2719] Fix | Delete
return $this->__call( 'shortcode_callback', array( $attrs, $content, $render_slug ) );
[2720] Fix | Delete
}
[2721] Fix | Delete
[2722] Fix | Delete
return '';
[2723] Fix | Delete
}
[2724] Fix | Delete
[2725] Fix | Delete
/**
[2726] Fix | Delete
* Replace the et_pb_row with et_pb_row_inner and et_pb_column with et_pb_column_inner.
[2727] Fix | Delete
* Used as a callback function in {@self::et_pb_maybe_fix_specialty_columns} when fixing content of Specialty Sections
[2728] Fix | Delete
*
[2729] Fix | Delete
* @since 3.19.16
[2730] Fix | Delete
*
[2731] Fix | Delete
* @return string Shortcode string.
[2732] Fix | Delete
*/
[2733] Fix | Delete
public function et_pb_fix_specialty_columns( $rows ) {
[2734] Fix | Delete
$sanitized_shortcode = str_replace( array( 'et_pb_row ', 'et_pb_row]' ), array( 'et_pb_row_inner ', 'et_pb_row_inner]' ), $rows[0] );
[2735] Fix | Delete
$sanitized_shortcode = str_replace( array( 'et_pb_column ', 'et_pb_column]' ), array( 'et_pb_column_inner ', 'et_pb_column_inner]' ), $rows[0] );
[2736] Fix | Delete
[2737] Fix | Delete
return $sanitized_shortcode;
[2738] Fix | Delete
}
[2739] Fix | Delete
[2740] Fix | Delete
/**
[2741] Fix | Delete
* Run regex against the Specialty Section content to find and fix invalid inner shortcodes
[2742] Fix | Delete
*
[2743] Fix | Delete
* @since 3.19.16
[2744] Fix | Delete
*
[2745] Fix | Delete
* @return string Shortcode string.
[2746] Fix | Delete
*/
[2747] Fix | Delete
public function et_pb_maybe_fix_specialty_columns( $section_content ) {
[2748] Fix | Delete
return preg_replace_callback('/(\[et_pb_(row |row_inner) .*?\].*\[\/et_pb_(row |row_inner)\])/mis', array( $this, 'et_pb_fix_specialty_columns' ), $section_content );
[2749] Fix | Delete
}
[2750] Fix | Delete
[2751] Fix | Delete
/**
[2752] Fix | Delete
* Generates data used to render the module in the builder.
[2753] Fix | Delete
* See {@see self::render()} for parameter info.
[2754] Fix | Delete
*
[2755] Fix | Delete
* @since 3.1 Renamed from `_shortcode_passthru_callback()` to `render_as_builder_data()`
[2756] Fix | Delete
* @since 3.0.0
[2757] Fix | Delete
*
[2758] Fix | Delete
* @return array|string An array when called during AJAX request, an empty string otherwise.
[2759] Fix | Delete
*/
[2760] Fix | Delete
public function render_as_builder_data( $atts, $content = null, $render_slug, $parent_address = '', $global_parent = '', $global_parent_type = '', $parent_type = '' ) {
[2761] Fix | Delete
global $post;
[2762] Fix | Delete
[2763] Fix | Delete
// this is called during pageload, but we want to ignore that round, as this data will be built and returned on separate ajax request instead
[2764] Fix | Delete
[2765] Fix | Delete
et_core_nonce_verified_previously();
[2766] Fix | Delete
[2767] Fix | Delete
if ( ! ( isset( $_POST['action'] ) || apply_filters( 'et_builder_module_force_render', false ) ) ) {
[2768] Fix | Delete
return '';
[2769] Fix | Delete
}
[2770] Fix | Delete
[2771] Fix | Delete
$attrs = array();
[2772] Fix | Delete
$fields = $this->process_fields( $this->fields_unprocessed );
[2773] Fix | Delete
$global_content = false;
[2774] Fix | Delete
$function_name_processed = et_fb_prepare_tag( $render_slug );
[2775] Fix | Delete
$unsynced_global_attributes = array();
[2776] Fix | Delete
$use_updated_global_sync_method = false;
[2777] Fix | Delete
$global_module_id = isset( $atts['global_module'] ) ? $atts['global_module'] : false;
[2778] Fix | Delete
$is_specialty_placeholder = isset( $atts['template_type'] ) && 'section' === $atts['template_type'] && isset( $atts['specialty'] ) && 'on' === $atts['specialty'] && ( ! $content || '' === trim( $content ) );
[2779] Fix | Delete
$is_global_template = false;
[2780] Fix | Delete
$real_parent_type = $parent_type;
[2781] Fix | Delete
[2782] Fix | Delete
if ( $render_slug && $render_slug !== $this->slug ) {
[2783] Fix | Delete
if ( $rendering_module = self::get_module( $render_slug, $this->get_post_type() ) ) {
[2784] Fix | Delete
$fields = array_merge( $fields, $this->process_fields( $rendering_module->fields_unprocessed ) );
[2785] Fix | Delete
}
[2786] Fix | Delete
}
[2787] Fix | Delete
[2788] Fix | Delete
$output_render_slug = $render_slug;
[2789] Fix | Delete
[2790] Fix | Delete
// When rendering specialty columns we should make sure correct tags are used for inner content
[2791] Fix | Delete
// Global Rows inside may break it in some cases, so handle it.
[2792] Fix | Delete
if ( 'et_pb_specialty_column' === $parent_type && 'et_pb_row' === $render_slug ) {
[2793] Fix | Delete
$output_render_slug = 'et_pb_row_inner';
[2794] Fix | Delete
$function_name_processed = 'et_pb_row_inner';
[2795] Fix | Delete
}
[2796] Fix | Delete
[2797] Fix | Delete
if ( 'et_pb_row_inner' === $parent_type && 'et_pb_column' === $render_slug ) {
[2798] Fix | Delete
$output_render_slug = 'et_pb_column_inner';
[2799] Fix | Delete
$function_name_processed = 'et_pb_column_inner';
[2800] Fix | Delete
}
[2801] Fix | Delete
[2802] Fix | Delete
$post_id = isset( $post->ID ) ? $post->ID : intval( self::$_->array_get( $_POST, 'et_post_id' ) );
[2803] Fix | Delete
$post_type = isset( $post->post_type ) ? $post->post_type : sanitize_text_field( self::$_->array_get( $_POST, 'et_post_type' ) );
[2804] Fix | Delete
$layout_type = isset( $post_type, $post_id ) && 'et_pb_layout' === $post_type ? et_fb_get_layout_type( $post_id ) : '';
[2805] Fix | Delete
[2806] Fix | Delete
if ( 'module' === $layout_type ) {
[2807] Fix | Delete
// Add support of new selective sync feature for library modules in VB
[2808] Fix | Delete
$template_scope = wp_get_object_terms( $post_id, 'scope' );
[2809] Fix | Delete
$is_global_template = ! empty( $template_scope[0] ) && 'global' === $template_scope[0]->slug;
[2810] Fix | Delete
[2811] Fix | Delete
if ( $is_global_template ) {
[2812] Fix | Delete
$global_module_id = $post_id;
[2813] Fix | Delete
}
[2814] Fix | Delete
}
[2815] Fix | Delete
[2816] Fix | Delete
//override module attributes for global module
[2817] Fix | Delete
if ( ! empty( $global_module_id ) ) {
[2818] Fix | Delete
if ( ! in_array( $render_slug, array( 'et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column', 'et_pb_column_inner' ) ) ) {
[2819] Fix | Delete
$processing_global_module = $global_module_id;
[2820] Fix | Delete
$unsynced_global_attributes = get_post_meta( $processing_global_module, '_et_pb_excluded_global_options' );
[2821] Fix | Delete
$use_updated_global_sync_method = ! empty( $unsynced_global_attributes );
[2822] Fix | Delete
}
[2823] Fix | Delete
[2824] Fix | Delete
$global_module_data = et_pb_load_global_module( $global_module_id, $function_name_processed );
[2825] Fix | Delete
[2826] Fix | Delete
if ( '' !== $global_module_data ) {
[2827] Fix | Delete
$unsynced_options = ! empty( $unsynced_global_attributes[0] ) ? json_decode( $unsynced_global_attributes[0], true ) : array() ;
[2828] Fix | Delete
$content_synced = $use_updated_global_sync_method && ! in_array( 'et_pb_content_field', $unsynced_options );
[2829] Fix | Delete
$is_module_fully_global = $use_updated_global_sync_method && empty( $unsynced_options );
[2830] Fix | Delete
$unsynced_legacy_options = array();
[2831] Fix | Delete
[2832] Fix | Delete
// support legacy selective sync system
[2833] Fix | Delete
if ( ! $use_updated_global_sync_method ) {
[2834] Fix | Delete
$content_synced = ! isset( $atts['saved_tabs'] ) || false !== strpos( $atts['saved_tabs'], 'general' ) || 'all' === $atts['saved_tabs'];
[2835] Fix | Delete
$is_module_fully_global = ! isset( $atts['saved_tabs'] ) || 'all' === $atts['saved_tabs'];
[2836] Fix | Delete
}
[2837] Fix | Delete
[2838] Fix | Delete
if ( $content_synced && ! $is_global_template ) {
[2839] Fix | Delete
$global_content = et_pb_get_global_module_content( $global_module_data, $function_name_processed );
[2840] Fix | Delete
[2841] Fix | Delete
// When saving global rows from specialty sections, they get saved as et_pb_row instead of et_pb_row_inner.
[2842] Fix | Delete
// Handle this special case when parsing to avoid empty global row content.
[2843] Fix | Delete
if ( empty( $global_content ) && 'et_pb_row_inner' === $function_name_processed ) {
[2844] Fix | Delete
$global_content = et_pb_get_global_module_content( $global_module_data, 'et_pb_row', true );
[2845] Fix | Delete
}
[2846] Fix | Delete
}
[2847] Fix | Delete
[2848] Fix | Delete
// remove the shortcode content to avoid conflicts of parent attributes with similar attrs from child modules
[2849] Fix | Delete
if ( false !== $global_content ) {
[2850] Fix | Delete
$global_content_processed = str_replace( $global_content, '', $global_module_data );
[2851] Fix | Delete
} else {
[2852] Fix | Delete
$global_content_processed = $global_module_data;
[2853] Fix | Delete
}
[2854] Fix | Delete
[2855] Fix | Delete
// Ensuring that all possible attributes exist to avoid remaining child attributes being used by global parents' attributes
[2856] Fix | Delete
// Do that only in case the module is fully global
[2857] Fix | Delete
if ( $is_module_fully_global ) {
[2858] Fix | Delete
$global_atts = shortcode_parse_atts( et_pb_remove_shortcode_content( $global_content_processed, $this->slug ) );
[2859] Fix | Delete
} else {
[2860] Fix | Delete
$global_atts = shortcode_parse_atts( $global_content_processed );
[2861] Fix | Delete
}
[2862] Fix | Delete
[2863] Fix | Delete
// Run et_pb_module_shortcode_attributes filter to apply migration system on attributes of global module
[2864] Fix | Delete
$global_atts = apply_filters( 'et_pb_module_shortcode_attributes', $global_atts, $atts, $this->slug, $this->generate_element_address( $render_slug ), $content );
[2865] Fix | Delete
[2866] Fix | Delete
// Parse dynamic content in global attributes.
[2867] Fix | Delete
$enabled_dynamic_attributes = $this->_get_enabled_dynamic_attributes( $global_atts );
[2868] Fix | Delete
$global_atts = $this->_encode_legacy_dynamic_content( $global_atts, $enabled_dynamic_attributes );
[2869] Fix | Delete
$global_atts = $this->process_dynamic_attrs( $global_atts );
[2870] Fix | Delete
[2871] Fix | Delete
// Parse dynamic content in global content.
[2872] Fix | Delete
if ( false !== $global_content ) {
[2873] Fix | Delete
$global_content = $this->_encode_legacy_dynamic_content_value(
[2874] Fix | Delete
'content',
[2875] Fix | Delete
$global_content,
[2876] Fix | Delete
$enabled_dynamic_attributes
[2877] Fix | Delete
);
[2878] Fix | Delete
$global_content = $this->_resolve_value(
[2879] Fix | Delete
$this->get_the_ID(),
[2880] Fix | Delete
'content',
[2881] Fix | Delete
$global_content,
[2882] Fix | Delete
$this->_get_enabled_dynamic_attributes( $global_atts ),
[2883] Fix | Delete
true
[2884] Fix | Delete
);
[2885] Fix | Delete
}
[2886] Fix | Delete
[2887] Fix | Delete
foreach( $this->props as $single_attr => $value ) {
[2888] Fix | Delete
if ( isset( $global_atts[$single_attr] ) && ! in_array( $single_attr, $unsynced_options ) ) {
[2889] Fix | Delete
// replace %22 with double quotes in options to make sure it's rendered correctly
[2890] Fix | Delete
if ( ! $is_global_template ) {
[2891] Fix | Delete
$this->props[ $single_attr ] = is_string( $global_atts[ $single_attr ] ) && ! array_intersect( array( "et_pb_{$single_attr}", $single_attr ), $this->dbl_quote_exception_options ) ? str_replace( '%22', '"', $global_atts[ $single_attr ] ) : $global_atts[ $single_attr ];
[2892] Fix | Delete
}
[2893] Fix | Delete
} else if ( ! $use_updated_global_sync_method ) {
[2894] Fix | Delete
// prepare array of unsynced options to migrate the legacy modules to new system
[2895] Fix | Delete
$unsynced_legacy_options[] = $single_attr;
[2896] Fix | Delete
} else {
[2897] Fix | Delete
$unsynced_global_attributes[0] = $unsynced_options;
[2898] Fix | Delete
}
[2899] Fix | Delete
}
[2900] Fix | Delete
[2901] Fix | Delete
// migrate unsynced options to the new selective sync method
[2902] Fix | Delete
if ( ! $use_updated_global_sync_method ) {
[2903] Fix | Delete
$unsynced_global_attributes[0] = $unsynced_legacy_options;
[2904] Fix | Delete
[2905] Fix | Delete
// check the content and add it into list if needed.
[2906] Fix | Delete
if ( ! $content_synced ) {
[2907] Fix | Delete
$unsynced_global_attributes[0][] = 'et_pb_content_field';
[2908] Fix | Delete
}
[2909] Fix | Delete
} else {
[2910] Fix | Delete
$unsynced_global_attributes[0] = $unsynced_options;
[2911] Fix | Delete
}
[2912] Fix | Delete
} else {
[2913] Fix | Delete
// remove global_module attr if it doesn't exist in DB
[2914] Fix | Delete
$this->props['global_module'] = '';
[2915] Fix | Delete
$global_parent = '';
[2916] Fix | Delete
}
[2917] Fix | Delete
}
[2918] Fix | Delete
[2919] Fix | Delete
$module_slug = self::$global_presets_manager->maybe_convert_module_type( $this->slug, $this->props );
[2920] Fix | Delete
$module_preset_settings = self::$global_presets_manager->get_module_presets_settings( $module_slug, $this->props );
[2921] Fix | Delete
[2922] Fix | Delete
foreach( $this->props as $shortcode_attr_key => $shortcode_attr_value ) {
[2923] Fix | Delete
$value = $shortcode_attr_value;
[2924] Fix | Delete
[2925] Fix | Delete
// don't set the default, unless, lol, the value is literally 'default'
[2926] Fix | Delete
if ( 'default' !== $value ) {
[2927] Fix | Delete
$has_preset_value = isset( $module_preset_settings[ $shortcode_attr_key ] );
[2928] Fix | Delete
[2929] Fix | Delete
if ( $has_preset_value && isset( $atts[ $shortcode_attr_key ] ) ) {
[2930] Fix | Delete
$is_equal_to_preset_value = $atts[ $shortcode_attr_key ] === $module_preset_settings[ $shortcode_attr_key ];
[2931] Fix | Delete
$value = $is_equal_to_preset_value ? '' : $atts[ $shortcode_attr_key ];
[2932] Fix | Delete
} else {
[2933] Fix | Delete
// handle 'preset' type of attributes
[2934] Fix | Delete
if ( isset( $fields[ $shortcode_attr_key ]['default'] ) && is_array( $fields[ $shortcode_attr_key ]['default'] ) ) {
[2935] Fix | Delete
$field = $fields[ $shortcode_attr_key ];
[2936] Fix | Delete
$preset_attribute_name = $field['default'][0];
[2937] Fix | Delete
if ( 'filter' === $preset_attribute_name ) {
[2938] Fix | Delete
// Functional default.
[2939] Fix | Delete
if ( apply_filters( $field['default'][1], $shortcode_attr_key ) === $value ) {
[2940] Fix | Delete
$value = '';
[2941] Fix | Delete
}
[2942] Fix | Delete
} else {
[2943] Fix | Delete
$preset_default_value = et_()->array_get( $fields[ $preset_attribute_name ], 'default', 'none' );
[2944] Fix | Delete
$preset_attribute_value = et_()->array_get( $this->props, $preset_attribute_name, $preset_default_value );
[2945] Fix | Delete
if ( ! empty( $preset_attribute_value ) ) {
[2946] Fix | Delete
$value_from_preset = et_()->array_get( $fields[ $shortcode_attr_key ]['default'][1], $preset_attribute_value, '' );
[2947] Fix | Delete
if ( $value == $value_from_preset ) {
[2948] Fix | Delete
$value = '';
[2949] Fix | Delete
}
[2950] Fix | Delete
}
[2951] Fix | Delete
}
[2952] Fix | Delete
} else {
[2953] Fix | Delete
$is_equal_to_default = isset( $fields[ $shortcode_attr_key ]['default'] ) && $value === $fields[ $shortcode_attr_key ]['default'];
[2954] Fix | Delete
$is_equal_to_default_on_front = isset( $fields[ $shortcode_attr_key ]['default_on_front'] ) && $value === $fields[ $shortcode_attr_key ]['default_on_front'];
[2955] Fix | Delete
[2956] Fix | Delete
if ( $is_equal_to_default || $is_equal_to_default_on_front ) {
[2957] Fix | Delete
$value = '';
[2958] Fix | Delete
}
[2959] Fix | Delete
}
[2960] Fix | Delete
}
[2961] Fix | Delete
} else {
[2962] Fix | Delete
if ( $shortcode_attr_key !== '_module_preset' ) {
[2963] Fix | Delete
$value = '';
[2964] Fix | Delete
}
[2965] Fix | Delete
}
[2966] Fix | Delete
[2967] Fix | Delete
// generic override, disabled=off is an unspoken default
[2968] Fix | Delete
if ( $shortcode_attr_key === 'disabled' && $shortcode_attr_value === 'off' ) {
[2969] Fix | Delete
$value = '';
[2970] Fix | Delete
}
[2971] Fix | Delete
[2972] Fix | Delete
// this override is necessary becuase et_pb_column and et_pb_column_inner type default is 4_4 and will get stomped
[2973] Fix | Delete
// above since its default, but we need it explicitly set anyways, so we force set it
[2974] Fix | Delete
if ( in_array( $render_slug, array( 'et_pb_column', 'et_pb_column_inner' ) ) && $shortcode_attr_key === 'type' ) {
[2975] Fix | Delete
$value = $shortcode_attr_value;
[2976] Fix | Delete
}
[2977] Fix | Delete
[2978] Fix | Delete
$is_include_attr = false;
[2979] Fix | Delete
[2980] Fix | Delete
if ( '' === $value
[2981] Fix | Delete
&& $shortcode_attr_key !== et_pb_hover_options()->get_field_base_name( $shortcode_attr_key )
[2982] Fix | Delete
&& et_pb_hover_options()->is_enabled( et_pb_hover_options()->get_field_base_name( $shortcode_attr_key ), $atts ) ) {
[2983] Fix | Delete
$is_include_attr = true;
[2984] Fix | Delete
}
[2985] Fix | Delete
[2986] Fix | Delete
if ( '' === $value
[2987] Fix | Delete
&& $shortcode_attr_key !== et_pb_responsive_options()->get_field_base_name( $shortcode_attr_key )
[2988] Fix | Delete
&& et_pb_responsive_options()->is_enabled( et_pb_responsive_options()->get_field_base_name( $shortcode_attr_key ), $atts ) ) {
[2989] Fix | Delete
$is_include_attr = true;
[2990] Fix | Delete
}
[2991] Fix | Delete
[2992] Fix | Delete
if ( '' !== $value ) {
[2993] Fix | Delete
$is_include_attr = true;
[2994] Fix | Delete
}
[2995] Fix | Delete
[2996] Fix | Delete
if ( $is_include_attr ) {
[2997] Fix | Delete
$attrs[$shortcode_attr_key] = is_string($value) ? html_entity_decode($value) : $value;
[2998] Fix | Delete
}
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function