: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( is_null( $size ) ) {
$size = et_get_attachment_size_by_url( $image_src );
if ( 'full' === $size && isset( $image_meta['width'] ) && isset( $image_meta['height'] ) ) {
absint( $image_meta['width'] ),
absint( $image_meta['height'] ),
} else if ( is_string( $size ) && ! empty( $image_meta['sizes'][ $size ] ) ) {
absint( $image_meta['sizes'][ $size ]['width'] ),
absint( $image_meta['sizes'][ $size ]['height'] ),
if ( ! $size || ! is_array( $size ) ) {
foreach ( $image_meta['sizes'] as $size_key => $size_data ) {
if ( strpos( $size_key, 'et-pb-image--responsive--' ) !== 0 ) {
if ( is_array( $size ) && $size[0] < $size_data['width'] ) {
$responsive_sizes[ $size_data['width'] ] = false;
$responsive_sizes[ $size_data['width'] ] = $size_data;
if ( $responsive_sizes ) {
ksort( $responsive_sizes );
// Cache the responsive sizes data.
if ( et_core_is_uploads_dir_url( $normalized_url ) ) {
$cache[ $normalized_url ] = $responsive_sizes;
ET_Core_Cache_File::set( 'image_responsive_metadata', $cache );
return $responsive_sizes;
* Filters an image's 'srcset' sources.
* @param array $sources {
* One or more arrays of source data to include in the 'srcset'.
* @type string $url The URL of an image source.
* @type string $descriptor The descriptor type used in the image candidate string,
* @type int $value The source width if paired with a 'w' descriptor, or a
* pixel density value if paired with an 'x' descriptor.
* @param array $size_array Array of width and height values in pixels (in that order).
* @param string $image_src The 'src' of the image.
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
if ( ! function_exists( 'et_filter_wp_calculate_image_srcset' ) ):
function et_filter_wp_calculate_image_srcset( $sources, $size_array, $image_src, $image_meta ) {
// Do not filter when in wp-admin area.
$responsive_sources = array();
if ( ! et_is_responsive_images_enabled() ) {
return $responsive_sources;
if ( is_string( $size_array ) ) {
$size_array = et_get_attachment_size_by_url( $image_src );
if ( is_string( $size_array ) && $image_meta ) {
if ( $size_array === 'full' ) {
absint( $image_meta['width'] ),
absint( $image_meta['height'] ),
} else if ( ! empty( $image_meta['sizes'][ $size_array ] ) ) {
absint( $image_meta['sizes'][ $size_array ]['width'] ),
absint( $image_meta['sizes'][ $size_array ]['height'] ),
if ( ! is_array( $size_array ) ) {
return $responsive_sources;
$responsive_metadata = et_builder_responsive_image_metadata( $image_src, $image_meta, $size_array );
if ( $responsive_metadata ) {
foreach ( $responsive_metadata as $max_width => $size_data ) {
$responsive_sources[ $max_width ] = array(
'url' => str_replace( basename( $image_src ), $size_data['file'], $image_src ),
if ( $responsive_sources && $size_array[0] > $max_width ) {
$responsive_sources[ $size_array[0] ] = array(
'value' => $size_array[0],
if ( $responsive_sources ) {
krsort( $responsive_sources );
$responsive_sources = $sources;
return $responsive_sources;
add_filter( 'wp_calculate_image_srcset', 'et_filter_wp_calculate_image_srcset', 10, 4 );
* Filters the output of 'wp_calculate_image_sizes()'.
* @param string $sizes A source size value for use in a 'sizes' attribute.
* @param array|string $size Requested size. Image size or array of width and height values
* in pixels (in that order).
* @param string|null $image_src The URL to the image file or null.
* @param array|null $image_meta The image meta data as returned by wp_get_attachment_metadata() or null.
* @return string|bool A valid source size value for use in a 'sizes' attribute or false.
if ( ! function_exists( 'et_filter_wp_calculate_image_sizes' ) ):
function et_filter_wp_calculate_image_sizes( $sizes, $size, $image_src, $image_meta ) {
// Do not filter when in wp-admin area.
if ( ! et_is_responsive_images_enabled() ) {
return $responsive_sizes;
if ( is_string( $size ) ) {
$size = et_get_attachment_size_by_url( $image_src );
if ( is_string( $size ) && $image_meta ) {
if ( $size === 'full' ) {
absint( $image_meta['width'] ),
absint( $image_meta['height'] ),
} else if ( ! empty( $image_meta['sizes'][ $size ] ) ) {
absint( $image_meta['sizes'][ $size ]['width'] ),
absint( $image_meta['sizes'][ $size ]['height'] ),
if ( ! is_array( $size ) ) {
return $responsive_sizes;
$responsive_metadata = et_builder_responsive_image_metadata( $image_src, $image_meta, $size );
if ( $responsive_metadata ) {
foreach ( $responsive_metadata as $max_width => $size_data ) {
$sizes_temp[$max_width] = sprintf( '(min-width: %2$dpx) and (max-width: %1$dpx) %1$dpx', $max_width, ( $prev_width + 1 ) );
$sizes_temp[$max_width] = sprintf( '(min-width: %2$dpx) and (max-width: %1$dpx) %1$dpx', $max_width, $prev_width );
$prev_width = $max_width;
if ( $sizes_temp && $size[0] > $prev_width ) {
$sizes_temp[$size[0]] = sprintf( '(min-width: %2$dpx) %1$dpx', $size[0], ( $prev_width + 1 ) );
$responsive_sizes = implode( ', ', $sizes_temp );
$responsive_sizes = $sizes;
return $responsive_sizes;
add_filter( 'wp_calculate_image_sizes', 'et_filter_wp_calculate_image_sizes', 10, 4 );
* Register and localize assets early enough to avoid conflicts
* with third party plugins that use the same assets.
function et_builder_register_assets() {
$wp_major_version = substr( $wp_version, 0, 3 );
wp_register_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
wp_register_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false, 1 );
$wp_color_picker_l10n = array(
'clear' => esc_html__( 'Clear', 'et_builder' ),
'defaultString' => et_builder_i18n( 'Default' ),
'pick' => esc_html__( 'Select Color', 'et_builder' ),
if ( version_compare( $wp_major_version, '4.9', '>=' ) ) {
wp_register_script( 'wp-color-picker-alpha', "{$root}/scripts/ext/wp-color-picker-alpha.min.js", array( 'jquery', 'wp-color-picker' ), ET_BUILDER_VERSION, true );
wp_register_script( 'wp-color-picker-alpha', "{$root}/scripts/ext/wp-color-picker-alpha-48.min.js", array( 'jquery', 'wp-color-picker' ), ET_BUILDER_VERSION, true );
$wp_color_picker_l10n['current'] = esc_html__( 'Current Color', 'et_builder' );
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $wp_color_picker_l10n );
add_action( 'init', 'et_builder_register_assets', 11 );
* Set border radius to parallax background wrapper.
* @param string $order_class
if ( ! function_exists( 'et_set_parallax_bg_wrap_border_radius' ) ):
function et_set_parallax_bg_wrap_border_radius( $props, $module, $order_class ) {
$border_radius_values = et_pb_responsive_options()->get_property_values( $props, 'border_radii' );
$border_radius_hover_enabled = et_builder_module_prop( 'border_radii__hover_enabled', $props, '' );
$border_radius_hover_values = et_builder_module_prop( 'border_radii__hover', $props, '' );
foreach ( et_pb_responsive_options()->get_modes() as $device ) {
if ( $border_radius_values[$device] === 'on||||' ) {
$border_radius_values[$device] = '';
$border_radius_values[$device] = et_format_parallax_bg_wrap_radius_values( $border_radius_values[$device] );
et_pb_responsive_options()->generate_responsive_css(
$order_class . ' .et_parallax_bg_wrap',
if ( $border_radius_hover_enabled === 'on|hover' ) {
$radius_hover_values = et_format_parallax_bg_wrap_radius_values( $border_radius_hover_values );
$radius_hover_values = $border_radius_values['desktop'];
if ( $radius_hover_values ) {
ET_Builder_Element::set_style( $module, array(
'selector' => $order_class . ':hover .et_parallax_bg_wrap',
'declaration' => esc_html( sprintf(
* Get formatted border radius of parallax background wrapper
* @param string $border_radius_values
if ( ! function_exists( 'et_format_parallax_bg_wrap_radius_values' ) ):
function et_format_parallax_bg_wrap_radius_values( $border_radius_values ) {
$radius_values = array();
$radius_array = explode( '|', $border_radius_values );
for ( $i = 1; $i < count( $radius_array ); $i++ ) {
$radius_values[] = $radius_array[$i] ? $radius_array[$i] : 0;
return trim( implode( ' ', $radius_values ) );