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
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module/helpers
File: BackgroundLayout.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
die( 'Direct access forbidden.' );
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
// Include dependency for ResponsiveOptions.
[6] Fix | Delete
if ( ! function_exists( 'et_pb_responsive_options' ) ) {
[7] Fix | Delete
require_once 'ResponsiveOptions.php';
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
// Include dependency for HoverOptions.
[11] Fix | Delete
if ( ! function_exists( 'et_pb_hover_options' ) ) {
[12] Fix | Delete
require_once 'HoverOptions.php';
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Background layout helper methods.
[17] Fix | Delete
*
[18] Fix | Delete
* @since 4.0.7
[19] Fix | Delete
*
[20] Fix | Delete
* Class ET_Builder_Module_Helper_BackgroundLayout
[21] Fix | Delete
*/
[22] Fix | Delete
class ET_Builder_Module_Helper_BackgroundLayout {
[23] Fix | Delete
[24] Fix | Delete
public static function instance() {
[25] Fix | Delete
static $instance;
[26] Fix | Delete
[27] Fix | Delete
return $instance ? $instance : $instance = new self();
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Get background layout class names.
[32] Fix | Delete
*
[33] Fix | Delete
* @since 4.0.7
[34] Fix | Delete
*
[35] Fix | Delete
* @param array $attrs
[36] Fix | Delete
* @param boolean $is_skip_desktop Not all modules need to print desktop background layout.
[37] Fix | Delete
* @param boolean $is_text_color Not all modules need text color layout class name.
[38] Fix | Delete
*
[39] Fix | Delete
* @return array
[40] Fix | Delete
*/
[41] Fix | Delete
public function get_background_layout_class( $attrs, $is_skip_desktop = false, $is_text_color = false ) {
[42] Fix | Delete
// Background layout values.
[43] Fix | Delete
$background_layouts = et_pb_responsive_options()->get_property_values( $attrs, 'background_layout' );
[44] Fix | Delete
$background_layout = et_()->array_get( $background_layouts, 'desktop', '' );
[45] Fix | Delete
$background_layout_tablet = et_()->array_get( $background_layouts, 'tablet', '' );
[46] Fix | Delete
$background_layout_phone = et_()->array_get( $background_layouts, 'phone', '' );
[47] Fix | Delete
$background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $attrs, 'light' );
[48] Fix | Delete
[49] Fix | Delete
// Background layout class names.
[50] Fix | Delete
$background_layout_class_names = ! $is_skip_desktop ? array( "et_pb_bg_layout_{$background_layout}" ) : array();
[51] Fix | Delete
[52] Fix | Delete
if ( ! empty( $background_layout_tablet ) ) {
[53] Fix | Delete
$background_layout_class_names[] = "et_pb_bg_layout_{$background_layout_tablet}_tablet";
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
if ( ! empty( $background_layout_phone ) ) {
[57] Fix | Delete
$background_layout_class_names[] = "et_pb_bg_layout_{$background_layout_phone}_phone";
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
// Text color class names.
[61] Fix | Delete
if ( $is_text_color ) {
[62] Fix | Delete
if ( 'light' === $background_layout ) {
[63] Fix | Delete
$background_layout_class_names[] = 'et_pb_text_color_dark';
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
if ( 'light' === $background_layout_tablet ) {
[67] Fix | Delete
$background_layout_class_names[] = 'et_pb_text_color_dark_tablet';
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
if ( 'light' === $background_layout_phone ) {
[71] Fix | Delete
$background_layout_class_names[] = 'et_pb_text_color_dark_phone';
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
return $background_layout_class_names;
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
/**
[79] Fix | Delete
* Get background layout data attributes.
[80] Fix | Delete
*
[81] Fix | Delete
* @since 4.0.7
[82] Fix | Delete
*
[83] Fix | Delete
* @param array $attrs
[84] Fix | Delete
*
[85] Fix | Delete
* @return string
[86] Fix | Delete
*/
[87] Fix | Delete
public function get_background_layout_attrs( $attrs ) {
[88] Fix | Delete
// Background layout data attributes is only needed by hover effect.
[89] Fix | Delete
if ( ! et_pb_hover_options()->is_enabled( 'background_layout', $attrs ) ) {
[90] Fix | Delete
return '';
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
// Background layout values.
[94] Fix | Delete
$background_layouts = et_pb_responsive_options()->get_property_values( $attrs, 'background_layout' );
[95] Fix | Delete
$background_layout = et_()->array_get( $background_layouts, 'desktop', '' );
[96] Fix | Delete
$background_layout_tablet = et_()->array_get( $background_layouts, 'tablet', '' );
[97] Fix | Delete
$background_layout_phone = et_()->array_get( $background_layouts, 'phone', '' );
[98] Fix | Delete
$background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $attrs, 'light' );
[99] Fix | Delete
[100] Fix | Delete
$data_background_layout = sprintf(
[101] Fix | Delete
' data-background-layout="%1$s"',
[102] Fix | Delete
esc_attr( $background_layout )
[103] Fix | Delete
);
[104] Fix | Delete
[105] Fix | Delete
$data_background_layout .= sprintf(
[106] Fix | Delete
' data-background-layout-hover="%1$s"',
[107] Fix | Delete
esc_attr( $background_layout_hover )
[108] Fix | Delete
);
[109] Fix | Delete
[110] Fix | Delete
if ( ! empty( $background_layout_tablet ) ) {
[111] Fix | Delete
$data_background_layout .= sprintf(
[112] Fix | Delete
' data-background-layout-tablet="%1$s"',
[113] Fix | Delete
esc_attr( $background_layout_tablet )
[114] Fix | Delete
);
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
if ( ! empty( $background_layout_phone ) ) {
[118] Fix | Delete
$data_background_layout .= sprintf(
[119] Fix | Delete
' data-background-layout-phone="%1$s"',
[120] Fix | Delete
esc_attr( $background_layout_phone )
[121] Fix | Delete
);
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
return $data_background_layout;
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function