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
/**
[11000] Fix | Delete
* Remove suffix of a string
[11001] Fix | Delete
*/
[11002] Fix | Delete
function remove_suffix( $string, $separator = '_' ) {
[11003] Fix | Delete
$stringAsArray = explode( $separator, $string );
[11004] Fix | Delete
[11005] Fix | Delete
array_pop( $stringAsArray );
[11006] Fix | Delete
[11007] Fix | Delete
return implode( $separator, $stringAsArray );
[11008] Fix | Delete
}
[11009] Fix | Delete
[11010] Fix | Delete
protected function _is_field_applicable( $field ) {
[11011] Fix | Delete
$result = true;
[11012] Fix | Delete
[11013] Fix | Delete
// Field can be undefined/empty in some 3rd party modules without VB support. Handle this situation
[11014] Fix | Delete
if ( ! $field ) {
[11015] Fix | Delete
return $result;
[11016] Fix | Delete
}
[11017] Fix | Delete
[11018] Fix | Delete
$depends_on = self::$_->array_get( $field, 'depends_on', false );
[11019] Fix | Delete
$depends_show_if = self::$_->array_get( $field, 'depends_show_if', false );
[11020] Fix | Delete
[11021] Fix | Delete
if ( $depends_on && $depends_show_if ) {
[11022] Fix | Delete
foreach ( $depends_on as $attr_name ) {
[11023] Fix | Delete
if ( $result && self::$_->array_get( $this->props, $attr_name ) !== $depends_show_if ) {
[11024] Fix | Delete
$result = false;
[11025] Fix | Delete
break;
[11026] Fix | Delete
}
[11027] Fix | Delete
}
[11028] Fix | Delete
}
[11029] Fix | Delete
[11030] Fix | Delete
return $result;
[11031] Fix | Delete
}
[11032] Fix | Delete
[11033] Fix | Delete
/**
[11034] Fix | Delete
* process the fields.
[11035] Fix | Delete
*
[11036] Fix | Delete
* @since 3.23 Add function to process advanced form field options set.
[11037] Fix | Delete
*
[11038] Fix | Delete
* @param string $function_name String of the function_name
[11039] Fix | Delete
* @return void
[11040] Fix | Delete
*/
[11041] Fix | Delete
function process_additional_options( $function_name ) {
[11042] Fix | Delete
$module = $this;
[11043] Fix | Delete
[11044] Fix | Delete
if ( $function_name && $function_name !== $this->slug ) {
[11045] Fix | Delete
if ( ! $module = self::get_module( $function_name, $this->get_post_type() ) ) {
[11046] Fix | Delete
$module = $this;
[11047] Fix | Delete
} else {
[11048] Fix | Delete
$module->props = $this->props;
[11049] Fix | Delete
$module->classname = $this->classname;
[11050] Fix | Delete
}
[11051] Fix | Delete
}
[11052] Fix | Delete
[11053] Fix | Delete
if ( ! isset( $module->advanced_fields ) || false === $module->advanced_fields ) {
[11054] Fix | Delete
return;
[11055] Fix | Delete
}
[11056] Fix | Delete
[11057] Fix | Delete
$module->process_advanced_fonts_options( $function_name );
[11058] Fix | Delete
[11059] Fix | Delete
// Process Text Shadow CSS
[11060] Fix | Delete
$module->text_shadow->process_advanced_css( $module, $function_name );
[11061] Fix | Delete
[11062] Fix | Delete
$module->process_advanced_background_options( $function_name );
[11063] Fix | Delete
[11064] Fix | Delete
$module->process_advanced_text_options( $function_name );
[11065] Fix | Delete
[11066] Fix | Delete
$module->process_advanced_borders_options( $function_name );
[11067] Fix | Delete
[11068] Fix | Delete
$module->process_advanced_filter_options( $function_name );
[11069] Fix | Delete
[11070] Fix | Delete
$module->process_height_options( $function_name );
[11071] Fix | Delete
[11072] Fix | Delete
$module->process_overflow_options( $function_name );
[11073] Fix | Delete
[11074] Fix | Delete
$module->process_advanced_custom_margin_options( $function_name );
[11075] Fix | Delete
[11076] Fix | Delete
$module->process_max_width_options( $function_name );
[11077] Fix | Delete
[11078] Fix | Delete
$module->process_advanced_button_options( $function_name );
[11079] Fix | Delete
[11080] Fix | Delete
// Process Form Field CSS.
[11081] Fix | Delete
$module->process_advanced_form_field_options( $function_name );
[11082] Fix | Delete
[11083] Fix | Delete
$this->process_box_shadow( $function_name );
[11084] Fix | Delete
[11085] Fix | Delete
$this->process_position( $function_name );
[11086] Fix | Delete
[11087] Fix | Delete
$this->process_transform( $function_name );
[11088] Fix | Delete
[11089] Fix | Delete
// Process Margin & Padding CSS.
[11090] Fix | Delete
$module->margin_padding->process_advanced_css( $module, $function_name );
[11091] Fix | Delete
[11092] Fix | Delete
$this->setup_hover_transitions( $function_name );
[11093] Fix | Delete
}
[11094] Fix | Delete
[11095] Fix | Delete
function process_inline_fonts_option( $fonts_list ) {
[11096] Fix | Delete
if ( '' === $fonts_list ) {
[11097] Fix | Delete
return;
[11098] Fix | Delete
}
[11099] Fix | Delete
[11100] Fix | Delete
$fonts_list_array = explode( ',', $fonts_list );
[11101] Fix | Delete
[11102] Fix | Delete
foreach( $fonts_list_array as $font_name ) {
[11103] Fix | Delete
et_builder_enqueue_font( $font_name );
[11104] Fix | Delete
}
[11105] Fix | Delete
}
[11106] Fix | Delete
[11107] Fix | Delete
/**
[11108] Fix | Delete
* Process advanced font styles.
[11109] Fix | Delete
*
[11110] Fix | Delete
* @since 3.23 Add support to generate responsive styles of font, text color, and text align.
[11111] Fix | Delete
* And also process styles of block elements sub options group.
[11112] Fix | Delete
*
[11113] Fix | Delete
* @param string $function_name Module slug.
[11114] Fix | Delete
*/
[11115] Fix | Delete
function process_advanced_fonts_options( $function_name ) {
[11116] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[11117] Fix | Delete
if ( ! $this->has_vb_support() && ! $this->has_advanced_fields ) {
[11118] Fix | Delete
return;
[11119] Fix | Delete
}
[11120] Fix | Delete
[11121] Fix | Delete
if ( ! self::$_->array_get( $this->advanced_fields, 'fonts', false ) ) {
[11122] Fix | Delete
return;
[11123] Fix | Delete
}
[11124] Fix | Delete
[11125] Fix | Delete
$font_options = array();
[11126] Fix | Delete
$slugs = array(
[11127] Fix | Delete
'font',
[11128] Fix | Delete
'font_size',
[11129] Fix | Delete
'text_color',
[11130] Fix | Delete
'letter_spacing',
[11131] Fix | Delete
'line_height',
[11132] Fix | Delete
'text_align',
[11133] Fix | Delete
);
[11134] Fix | Delete
$mobile_options_slugs = array(
[11135] Fix | Delete
'font_tablet',
[11136] Fix | Delete
'font_phone',
[11137] Fix | Delete
'font_size_tablet',
[11138] Fix | Delete
'font_size_phone',
[11139] Fix | Delete
'text_color_tablet',
[11140] Fix | Delete
'text_color_phone',
[11141] Fix | Delete
'line_height_tablet',
[11142] Fix | Delete
'line_height_phone',
[11143] Fix | Delete
'letter_spacing_tablet',
[11144] Fix | Delete
'letter_spacing_phone',
[11145] Fix | Delete
'text_align_tablet',
[11146] Fix | Delete
'text_align_phone',
[11147] Fix | Delete
);
[11148] Fix | Delete
[11149] Fix | Delete
$slugs = array_merge( $slugs, $mobile_options_slugs ); // merge all slugs into single array to define them in one place
[11150] Fix | Delete
[11151] Fix | Delete
// Separetely defined and merged *_last_edited slugs. It needs to be merged as reference but shouldn't be looped for calling mobile attributes
[11152] Fix | Delete
$mobile_options_last_edited_slugs = array(
[11153] Fix | Delete
'font_last_edited',
[11154] Fix | Delete
'text_color_last_edited',
[11155] Fix | Delete
'font_size_last_edited',
[11156] Fix | Delete
'line_height_last_edited',
[11157] Fix | Delete
'letter_spacing_last_edited',
[11158] Fix | Delete
'text_align_last_edited',
[11159] Fix | Delete
);
[11160] Fix | Delete
[11161] Fix | Delete
$slugs = array_merge( $slugs, $mobile_options_last_edited_slugs );
[11162] Fix | Delete
[11163] Fix | Delete
foreach ( $this->advanced_fields['fonts'] as $option_name => $option_settings ) {
[11164] Fix | Delete
$style = '';
[11165] Fix | Delete
$hover_style = '';
[11166] Fix | Delete
$important_options = array();
[11167] Fix | Delete
$is_important_set = isset( $option_settings['css']['important'] );
[11168] Fix | Delete
$is_placeholder = isset( $option_settings['css']['placeholder'] );
[11169] Fix | Delete
[11170] Fix | Delete
$use_global_important = $is_important_set && 'all' === $option_settings['css']['important'];
[11171] Fix | Delete
[11172] Fix | Delete
if ( ! $use_global_important && $is_important_set && 'plugin_only' === $option_settings['css']['important'] && et_builder_has_limitation('force_use_global_important') ) {
[11173] Fix | Delete
$use_global_important = true;
[11174] Fix | Delete
}
[11175] Fix | Delete
[11176] Fix | Delete
if ( $is_important_set && is_array( $option_settings['css']['important'] ) ) {
[11177] Fix | Delete
$important_options = $option_settings['css']['important'];
[11178] Fix | Delete
[11179] Fix | Delete
if ( et_builder_has_limitation('force_use_global_important') && in_array( 'plugin_all', $option_settings['css']['important'] ) ) {
[11180] Fix | Delete
$use_global_important = true;
[11181] Fix | Delete
}
[11182] Fix | Delete
}
[11183] Fix | Delete
[11184] Fix | Delete
foreach ( $slugs as $font_option_slug ) {
[11185] Fix | Delete
if ( isset( $this->props["{$option_name}_{$font_option_slug}"] ) ) {
[11186] Fix | Delete
$font_options["{$option_name}_{$font_option_slug}"] = $this->props["{$option_name}_{$font_option_slug}"];
[11187] Fix | Delete
}
[11188] Fix | Delete
}
[11189] Fix | Delete
[11190] Fix | Delete
$field_key = "{$option_name}_{$slugs[0]}";
[11191] Fix | Delete
$global_setting_name = $this->get_global_setting_name( $field_key );
[11192] Fix | Delete
$global_setting_value = ET_Global_Settings::get_value( $global_setting_name );
[11193] Fix | Delete
// Add default parameter to override global setting value, just in case we need to
[11194] Fix | Delete
// use another default.
[11195] Fix | Delete
$field_option_default = isset( $this->fields_unprocessed[ $field_key ]['default'] ) ? $this->fields_unprocessed[ $field_key ]['default'] : $global_setting_value;
[11196] Fix | Delete
$field_option_value = isset( $font_options[ $field_key ] ) ? $font_options[ $field_key ] : '';
[11197] Fix | Delete
[11198] Fix | Delete
if ( '' !== $field_option_value || ! $global_setting_value ) {
[11199] Fix | Delete
$important = in_array( 'font', $important_options ) || $use_global_important ? ' !important' : '';
[11200] Fix | Delete
$font_styles = et_builder_set_element_font( $field_option_value, ( '' !== $important ), $field_option_default );
[11201] Fix | Delete
[11202] Fix | Delete
// Get font custom breakpoint if needed on desktop.
[11203] Fix | Delete
$font_custom_desktop_breakpoint = et_pb_font_options()->get_breakpoint_by_font_value( $font_options, $field_key );
[11204] Fix | Delete
[11205] Fix | Delete
if ( isset( $option_settings['css']['font'] ) || ! empty( $font_custom_desktop_breakpoint ) ) {
[11206] Fix | Delete
// Prepare font styles args.
[11207] Fix | Delete
$font_styles_args = array(
[11208] Fix | Delete
'selector' => et_pb_font_options()->get_font_selector( $option_settings, $this->main_css_element ),
[11209] Fix | Delete
'declaration' => rtrim( $font_styles ),
[11210] Fix | Delete
'priority' => $this->_style_priority,
[11211] Fix | Delete
);
[11212] Fix | Delete
[11213] Fix | Delete
// Set custom media query if needed.
[11214] Fix | Delete
if ( ! empty( $font_custom_desktop_breakpoint ) ) {
[11215] Fix | Delete
$font_styles_args['media_query'] = ET_Builder_Element::get_media_query( $font_custom_desktop_breakpoint );
[11216] Fix | Delete
}
[11217] Fix | Delete
[11218] Fix | Delete
self::set_style( $function_name, $font_styles_args );
[11219] Fix | Delete
} else {
[11220] Fix | Delete
$style .= $font_styles;
[11221] Fix | Delete
}
[11222] Fix | Delete
}
[11223] Fix | Delete
[11224] Fix | Delete
$size_option_name = "{$option_name}_{$slugs[1]}";
[11225] Fix | Delete
$default_size = isset( $this->fields_unprocessed[ $size_option_name ]['default'] ) ? $this->fields_unprocessed[ $size_option_name ]['default'] : '';
[11226] Fix | Delete
$size_option_value = '';
[11227] Fix | Delete
[11228] Fix | Delete
if ( isset( $font_options[ $size_option_name ] ) && ! in_array( trim( $font_options[ $size_option_name ] ), array( '', 'px', $default_size ) ) ) {
[11229] Fix | Delete
$important = in_array( 'size', $important_options ) || $use_global_important ? ' !important' : '';
[11230] Fix | Delete
[11231] Fix | Delete
$size_option_value = et_builder_process_range_value( $font_options[ $size_option_name ] );
[11232] Fix | Delete
[11233] Fix | Delete
$style .= sprintf(
[11234] Fix | Delete
'font-size: %1$s%2$s; ',
[11235] Fix | Delete
esc_html( $size_option_value ),
[11236] Fix | Delete
esc_html( $important )
[11237] Fix | Delete
);
[11238] Fix | Delete
}
[11239] Fix | Delete
[11240] Fix | Delete
// Hover font size
[11241] Fix | Delete
$size_hover = trim( et_pb_hover_options()->get_value( $size_option_name, $this->props, '' ) );
[11242] Fix | Delete
[11243] Fix | Delete
if ( ! in_array( $size_hover, array( '', 'px', $size_option_value ) ) ) {
[11244] Fix | Delete
$important = in_array( 'size', $important_options ) || $use_global_important ? ' !important' : '';
[11245] Fix | Delete
[11246] Fix | Delete
$hover_style .= sprintf(
[11247] Fix | Delete
'font-size: %1$s%2$s; ',
[11248] Fix | Delete
esc_html( et_builder_process_range_value( $size_hover ) ),
[11249] Fix | Delete
esc_html( $important )
[11250] Fix | Delete
);
[11251] Fix | Delete
}
[11252] Fix | Delete
[11253] Fix | Delete
$text_color_option_name = "{$option_name}_{$slugs[2]}";
[11254] Fix | Delete
[11255] Fix | Delete
// Ensure if text color option is not disabled on current font options.
[11256] Fix | Delete
$hide_text_color = isset( $option_settings['hide_text_color'] ) && true === $option_settings['hide_text_color'];
[11257] Fix | Delete
[11258] Fix | Delete
// handle the value from old option
[11259] Fix | Delete
$old_option_ref = isset( $option_settings['text_color'] ) && isset( $option_settings['text_color']['old_option_ref'] ) ? $option_settings['text_color']['old_option_ref'] : '';
[11260] Fix | Delete
$old_option_val = '' !== $old_option_ref && isset( $this->props[ $old_option_ref ] ) ? $this->props[ $old_option_ref ] : '';
[11261] Fix | Delete
$default_value = '' !== $old_option_val && isset( $option_settings['text_color'] ) && isset( $option_settings['text_color']['default'] ) ? $option_settings['text_color']['default'] : '';
[11262] Fix | Delete
[11263] Fix | Delete
if ( isset( $font_options[ $text_color_option_name ] ) && '' !== $font_options[ $text_color_option_name ] && ! $hide_text_color ) {
[11264] Fix | Delete
$important = ' !important';
[11265] Fix | Delete
[11266] Fix | Delete
if ( $default_value !== $font_options[ $text_color_option_name ] ) {
[11267] Fix | Delete
if ( isset( $option_settings['css']['color'] ) ) {
[11268] Fix | Delete
self::set_style( $function_name, array(
[11269] Fix | Delete
'selector' => $option_settings['css']['color'],
[11270] Fix | Delete
'declaration' => sprintf(
[11271] Fix | Delete
'color: %1$s%2$s;',
[11272] Fix | Delete
esc_html( $font_options[ $text_color_option_name ] ),
[11273] Fix | Delete
esc_html( $important )
[11274] Fix | Delete
),
[11275] Fix | Delete
'priority' => $this->_style_priority,
[11276] Fix | Delete
) );
[11277] Fix | Delete
} else {
[11278] Fix | Delete
$style .= sprintf(
[11279] Fix | Delete
'color: %1$s%2$s; ',
[11280] Fix | Delete
esc_html( $font_options[ $text_color_option_name ] ),
[11281] Fix | Delete
esc_html( $important )
[11282] Fix | Delete
);
[11283] Fix | Delete
}
[11284] Fix | Delete
}
[11285] Fix | Delete
}
[11286] Fix | Delete
[11287] Fix | Delete
$text_color_hover = et_pb_hover_options()->get_value( $text_color_option_name, $this->props );
[11288] Fix | Delete
[11289] Fix | Delete
if ( $default_value !== $text_color_hover && ! empty( $text_color_hover ) && ! $hide_text_color ) {
[11290] Fix | Delete
$important = ' !important';
[11291] Fix | Delete
[11292] Fix | Delete
if ( isset( $option_settings['css']['color'] ) ) {
[11293] Fix | Delete
$sel = et_pb_hover_options()->add_hover_to_selectors( $option_settings['css']['color'] );
[11294] Fix | Delete
[11295] Fix | Delete
self::set_style( $function_name, array(
[11296] Fix | Delete
'selector' => self::$_->array_get( $option_settings, 'css.color_hover', $sel ),
[11297] Fix | Delete
'declaration' => sprintf(
[11298] Fix | Delete
'color: %1$s%2$s;',
[11299] Fix | Delete
esc_html( $text_color_hover ),
[11300] Fix | Delete
esc_html( $important )
[11301] Fix | Delete
),
[11302] Fix | Delete
'priority' => $this->_style_priority,
[11303] Fix | Delete
) );
[11304] Fix | Delete
} else {
[11305] Fix | Delete
$hover_style .= sprintf(
[11306] Fix | Delete
'color: %1$s%2$s; ',
[11307] Fix | Delete
esc_html( $text_color_hover ),
[11308] Fix | Delete
esc_html( $important )
[11309] Fix | Delete
);
[11310] Fix | Delete
}
[11311] Fix | Delete
}
[11312] Fix | Delete
[11313] Fix | Delete
$letter_spacing_option_name = "{$option_name}_{$slugs[3]}";
[11314] Fix | Delete
$default_letter_spacing = isset( $this->fields_unprocessed[ $letter_spacing_option_name ]['default'] ) ? $this->fields_unprocessed[ $letter_spacing_option_name ]['default'] : '';
[11315] Fix | Delete
$letter_spacing_value = '';
[11316] Fix | Delete
[11317] Fix | Delete
if ( isset( $font_options[ $letter_spacing_option_name ] ) && ! in_array( trim( $font_options[ $letter_spacing_option_name ] ), array( '', 'px', $default_letter_spacing ) ) ) {
[11318] Fix | Delete
$important = in_array( 'letter-spacing', $important_options ) || $use_global_important ? ' !important' : '';
[11319] Fix | Delete
[11320] Fix | Delete
$letter_spacing_value = et_builder_process_range_value( $font_options[ $letter_spacing_option_name ], 'letter_spacing' );
[11321] Fix | Delete
[11322] Fix | Delete
$style .= sprintf(
[11323] Fix | Delete
'letter-spacing: %1$s%2$s; ',
[11324] Fix | Delete
esc_html( $letter_spacing_value ),
[11325] Fix | Delete
esc_html( $important )
[11326] Fix | Delete
);
[11327] Fix | Delete
[11328] Fix | Delete
if ( isset( $option_settings['css']['letter_spacing'] ) ) {
[11329] Fix | Delete
self::set_style( $function_name, array(
[11330] Fix | Delete
'selector' => $option_settings['css']['letter_spacing'],
[11331] Fix | Delete
'declaration' => sprintf(
[11332] Fix | Delete
'letter-spacing: %1$s%2$s;',
[11333] Fix | Delete
esc_html( $letter_spacing_value ),
[11334] Fix | Delete
esc_html( $important )
[11335] Fix | Delete
),
[11336] Fix | Delete
'priority' => $this->_style_priority,
[11337] Fix | Delete
) );
[11338] Fix | Delete
}
[11339] Fix | Delete
}
[11340] Fix | Delete
[11341] Fix | Delete
// Hover letter spacing
[11342] Fix | Delete
$letter_spacing_hover = trim( et_pb_hover_options()->get_value( $letter_spacing_option_name, $this->props, '' ) );
[11343] Fix | Delete
[11344] Fix | Delete
if ( ! in_array( $letter_spacing_hover, array( '', 'px', $letter_spacing_value ) ) ) {
[11345] Fix | Delete
$important = in_array( 'letter-spacing', $important_options ) || $use_global_important ? ' !important' : '';
[11346] Fix | Delete
[11347] Fix | Delete
if ( et_builder_is_hover_enabled( $letter_spacing_option_name, $this->props ) ) {
[11348] Fix | Delete
if ( isset( $option_settings['css']['letter_spacing_hover'] ) ) {
[11349] Fix | Delete
self::set_style( $function_name, array(
[11350] Fix | Delete
'selector' => $option_settings['css']['letter_spacing_hover'],
[11351] Fix | Delete
'declaration' => sprintf(
[11352] Fix | Delete
'letter-spacing: %1$s%2$s;',
[11353] Fix | Delete
esc_html( et_builder_process_range_value( $letter_spacing_hover ) ),
[11354] Fix | Delete
esc_html( $important )
[11355] Fix | Delete
),
[11356] Fix | Delete
'priority' => $this->_style_priority,
[11357] Fix | Delete
) );
[11358] Fix | Delete
} else {
[11359] Fix | Delete
$hover_style .= sprintf(
[11360] Fix | Delete
'letter-spacing: %1$s%2$s; ',
[11361] Fix | Delete
esc_html( et_builder_process_range_value( $letter_spacing_hover ) ),
[11362] Fix | Delete
esc_html( $important )
[11363] Fix | Delete
);
[11364] Fix | Delete
}
[11365] Fix | Delete
}
[11366] Fix | Delete
[11367] Fix | Delete
if ( isset( $option_settings['css']['letter_spacing'] ) ) {
[11368] Fix | Delete
if ( et_builder_is_hover_enabled( $letter_spacing_option_name, $this->props ) ) {
[11369] Fix | Delete
if ( $default_letter_spacing !== $letter_spacing_hover ) {
[11370] Fix | Delete
if ( isset( $option_settings['css']['color'] ) ) {
[11371] Fix | Delete
$sel = et_pb_hover_options()->add_hover_to_selectors( $option_settings['css']['letter_spacing'] );
[11372] Fix | Delete
self::set_style( $function_name, array(
[11373] Fix | Delete
'selector' => self::$_->array_get( $option_settings, 'css.letter_spacing_hover', $sel ),
[11374] Fix | Delete
'declaration' => sprintf(
[11375] Fix | Delete
'color: %1$s%2$s;',
[11376] Fix | Delete
esc_html( $letter_spacing_hover ),
[11377] Fix | Delete
esc_html( $important )
[11378] Fix | Delete
),
[11379] Fix | Delete
'priority' => $this->_style_priority,
[11380] Fix | Delete
) );
[11381] Fix | Delete
}
[11382] Fix | Delete
}
[11383] Fix | Delete
}
[11384] Fix | Delete
}
[11385] Fix | Delete
}
[11386] Fix | Delete
[11387] Fix | Delete
$line_height_option_name = "{$option_name}_{$slugs[4]}";
[11388] Fix | Delete
$line_height_value = '';
[11389] Fix | Delete
[11390] Fix | Delete
if ( isset( $font_options[ $line_height_option_name ] ) ) {
[11391] Fix | Delete
$default_line_height = isset( $this->fields_unprocessed[ $line_height_option_name ]['default'] ) ? $this->fields_unprocessed[ $line_height_option_name ]['default'] : '';
[11392] Fix | Delete
[11393] Fix | Delete
if ( ! in_array( trim( $font_options[ $line_height_option_name ] ), array( '', 'px', $default_line_height ) ) ) {
[11394] Fix | Delete
$important = in_array( 'line-height', $important_options ) || $use_global_important ? ' !important' : '';
[11395] Fix | Delete
[11396] Fix | Delete
$line_height_value = et_builder_process_range_value( $font_options[ $line_height_option_name ], 'line_height' );
[11397] Fix | Delete
[11398] Fix | Delete
$style .= sprintf(
[11399] Fix | Delete
'line-height: %1$s%2$s; ',
[11400] Fix | Delete
esc_html( $line_height_value ),
[11401] Fix | Delete
esc_html( $important )
[11402] Fix | Delete
);
[11403] Fix | Delete
[11404] Fix | Delete
if ( isset( $option_settings['css']['line_height'] ) ) {
[11405] Fix | Delete
self::set_style( $function_name, array(
[11406] Fix | Delete
'selector' => $option_settings['css']['line_height'],
[11407] Fix | Delete
'declaration' => sprintf(
[11408] Fix | Delete
'line-height: %1$s%2$s;',
[11409] Fix | Delete
esc_html( $line_height_value ),
[11410] Fix | Delete
esc_html( $important )
[11411] Fix | Delete
),
[11412] Fix | Delete
'priority' => $this->_style_priority,
[11413] Fix | Delete
) );
[11414] Fix | Delete
}
[11415] Fix | Delete
}
[11416] Fix | Delete
}
[11417] Fix | Delete
[11418] Fix | Delete
// Hover line height
[11419] Fix | Delete
$line_height_hover = trim( et_pb_hover_options()->get_value( $line_height_option_name, $this->props, '' ) );
[11420] Fix | Delete
[11421] Fix | Delete
if ( ! in_array( $line_height_hover, array( '', 'px', $line_height_value ) ) ) {
[11422] Fix | Delete
$important = in_array( 'line-height', $important_options ) || $use_global_important ? ' !important' : '';
[11423] Fix | Delete
[11424] Fix | Delete
if ( et_builder_is_hover_enabled( $line_height_option_name, $this->props ) ) {
[11425] Fix | Delete
$hover_style .= sprintf(
[11426] Fix | Delete
'line-height: %1$s%2$s; ',
[11427] Fix | Delete
esc_html( et_builder_process_range_value( $line_height_hover, 'line_height' ) ),
[11428] Fix | Delete
esc_html( $important )
[11429] Fix | Delete
);
[11430] Fix | Delete
}
[11431] Fix | Delete
[11432] Fix | Delete
if ( isset( $option_settings['css']['line_height'] ) ) {
[11433] Fix | Delete
if ( et_builder_is_hover_enabled( $line_height_option_name, $this->props ) ) {
[11434] Fix | Delete
if ( isset( $option_settings['css']['color'] ) ) {
[11435] Fix | Delete
$sel = et_pb_hover_options()->add_hover_to_selectors( $option_settings['css']['line_height'] );
[11436] Fix | Delete
self::set_style( $function_name, array(
[11437] Fix | Delete
'selector' => self::$_->array_get( $option_settings, 'css.line_height_hover', $sel ),
[11438] Fix | Delete
'declaration' => sprintf(
[11439] Fix | Delete
'line-height: %1$s%2$s;',
[11440] Fix | Delete
esc_html( $line_height_hover ),
[11441] Fix | Delete
esc_html( $important )
[11442] Fix | Delete
),
[11443] Fix | Delete
'priority' => $this->_style_priority,
[11444] Fix | Delete
) );
[11445] Fix | Delete
}
[11446] Fix | Delete
}
[11447] Fix | Delete
}
[11448] Fix | Delete
}
[11449] Fix | Delete
[11450] Fix | Delete
$text_align_option_name = "{$option_name}_{$slugs[5]}";
[11451] Fix | Delete
[11452] Fix | Delete
// Ensure to not print text alignment if current font hide text alignment option.
[11453] Fix | Delete
$hide_text_align = self::$_->array_get( $option_settings, 'hide_text_align', false );
[11454] Fix | Delete
[11455] Fix | Delete
if ( isset( $font_options[ $text_align_option_name ] ) && '' !== $font_options[ $text_align_option_name ] && ! $hide_text_align ) {
[11456] Fix | Delete
[11457] Fix | Delete
$important = in_array( 'text-align', $important_options ) || $use_global_important ? ' !important' : '';
[11458] Fix | Delete
$text_align = et_pb_get_alignment( $font_options[ $text_align_option_name ] );
[11459] Fix | Delete
[11460] Fix | Delete
if ( isset( $option_settings['css']['text_align'] ) ) {
[11461] Fix | Delete
self::set_style( $function_name, array(
[11462] Fix | Delete
'selector' => $option_settings['css']['text_align'],
[11463] Fix | Delete
'declaration' => sprintf(
[11464] Fix | Delete
'text-align: %1$s%2$s;',
[11465] Fix | Delete
esc_html( $text_align ),
[11466] Fix | Delete
esc_html( $important )
[11467] Fix | Delete
),
[11468] Fix | Delete
'priority' => $this->_style_priority,
[11469] Fix | Delete
) );
[11470] Fix | Delete
} else {
[11471] Fix | Delete
$style .= sprintf(
[11472] Fix | Delete
'text-align: %1$s%2$s; ',
[11473] Fix | Delete
esc_html( $text_align ),
[11474] Fix | Delete
esc_html( $important )
[11475] Fix | Delete
);
[11476] Fix | Delete
}
[11477] Fix | Delete
}
[11478] Fix | Delete
[11479] Fix | Delete
if ( isset( $option_settings['use_all_caps'] ) && $option_settings['use_all_caps'] && 'on' === $this->props["{$option_name}_all_caps"] ) {
[11480] Fix | Delete
$important = in_array( 'all_caps', $important_options ) || $use_global_important ? ' !important' : '';
[11481] Fix | Delete
[11482] Fix | Delete
$style .= sprintf( 'text-transform: uppercase%1$s; ', esc_html( $important ) );
[11483] Fix | Delete
}
[11484] Fix | Delete
[11485] Fix | Delete
// apply both default and hover styles
[11486] Fix | Delete
$style_states = array( 'default', 'hover' );
[11487] Fix | Delete
[11488] Fix | Delete
foreach ( $style_states as $style_state ) {
[11489] Fix | Delete
$is_hover = 'hover' === $style_state;
[11490] Fix | Delete
$style = $is_hover ? $hover_style : $style;
[11491] Fix | Delete
[11492] Fix | Delete
if ( '' !== $style ) {
[11493] Fix | Delete
$css_element = ! empty( $option_settings['css']['main'] ) ? $option_settings['css']['main'] : $this->main_css_element;
[11494] Fix | Delete
[11495] Fix | Delete
// use different selector for plugin if defined
[11496] Fix | Delete
if ( et_builder_has_limitation('use_limited_main') && ! empty( $option_settings['css']['limited_main'] ) ) {
[11497] Fix | Delete
$css_element = $option_settings['css']['limited_main'];
[11498] Fix | Delete
}
[11499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function