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-inclu.../blocks
File: cover.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/cover` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/cover` block on server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.0.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes The block attributes.
[12] Fix | Delete
* @param string $content The block rendered content.
[13] Fix | Delete
*
[14] Fix | Delete
* @return string Returns the cover block markup, if useFeaturedImage is true.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_cover( $attributes, $content ) {
[17] Fix | Delete
if ( 'image' !== $attributes['backgroundType'] || false === $attributes['useFeaturedImage'] ) {
[18] Fix | Delete
return $content;
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) {
[22] Fix | Delete
$attr = array(
[23] Fix | Delete
'class' => 'wp-block-cover__image-background',
[24] Fix | Delete
'data-object-fit' => 'cover',
[25] Fix | Delete
);
[26] Fix | Delete
[27] Fix | Delete
if ( isset( $attributes['focalPoint'] ) ) {
[28] Fix | Delete
$object_position = round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
[29] Fix | Delete
$attr['data-object-position'] = $object_position;
[30] Fix | Delete
$attr['style'] = 'object-position: ' . $object_position;
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
$image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
[34] Fix | Delete
[35] Fix | Delete
/*
[36] Fix | Delete
* Inserts the featured image between the (1st) cover 'background' `span` and 'inner_container' `div`,
[37] Fix | Delete
* and removes eventual whitespace characters between the two (typically introduced at template level)
[38] Fix | Delete
*/
[39] Fix | Delete
$inner_container_start = '/<div\b[^>]+wp-block-cover__inner-container[\s|"][^>]*>/U';
[40] Fix | Delete
if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) {
[41] Fix | Delete
$offset = $matches[0][1];
[42] Fix | Delete
$content = substr( $content, 0, $offset ) . $image . substr( $content, $offset );
[43] Fix | Delete
}
[44] Fix | Delete
} else {
[45] Fix | Delete
if ( in_the_loop() ) {
[46] Fix | Delete
update_post_thumbnail_cache();
[47] Fix | Delete
}
[48] Fix | Delete
$current_featured_image = get_the_post_thumbnail_url();
[49] Fix | Delete
if ( ! $current_featured_image ) {
[50] Fix | Delete
return $content;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$processor = new WP_HTML_Tag_Processor( $content );
[54] Fix | Delete
$processor->next_tag();
[55] Fix | Delete
[56] Fix | Delete
$styles = $processor->get_attribute( 'style' );
[57] Fix | Delete
$merged_styles = ! empty( $styles ) ? $styles . ';' : '';
[58] Fix | Delete
$merged_styles .= 'background-image:url(' . esc_url( $current_featured_image ) . ');';
[59] Fix | Delete
[60] Fix | Delete
$processor->set_attribute( 'style', $merged_styles );
[61] Fix | Delete
$content = $processor->get_updated_html();
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
return $content;
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Registers the `core/cover` block renderer on server.
[69] Fix | Delete
*
[70] Fix | Delete
* @since 6.0.0
[71] Fix | Delete
*/
[72] Fix | Delete
function register_block_core_cover() {
[73] Fix | Delete
register_block_type_from_metadata(
[74] Fix | Delete
__DIR__ . '/cover',
[75] Fix | Delete
array(
[76] Fix | Delete
'render_callback' => 'render_block_core_cover',
[77] Fix | Delete
)
[78] Fix | Delete
);
[79] Fix | Delete
}
[80] Fix | Delete
add_action( 'init', 'register_block_core_cover' );
[81] Fix | Delete
[82] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function