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.../plugins/wordpres.../src/generato.../schema
File: main-image.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Generators\Schema;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Config\Schema_IDs;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Returns ImageObject schema data.
[7] Fix | Delete
*/
[8] Fix | Delete
class Main_Image extends Abstract_Schema_Piece {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Determines whether or not a piece should be added to the graph.
[12] Fix | Delete
*
[13] Fix | Delete
* @return bool
[14] Fix | Delete
*/
[15] Fix | Delete
public function is_needed() {
[16] Fix | Delete
return true;
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Adds a main image for the current URL to the schema if there is one.
[21] Fix | Delete
*
[22] Fix | Delete
* This can be either the featured image or the first image in the content of the page.
[23] Fix | Delete
*
[24] Fix | Delete
* @return false|array Image Schema.
[25] Fix | Delete
*/
[26] Fix | Delete
public function generate() {
[27] Fix | Delete
$image_id = $this->context->canonical . Schema_IDs::PRIMARY_IMAGE_HASH;
[28] Fix | Delete
[29] Fix | Delete
// The featured image.
[30] Fix | Delete
if ( $this->context->main_image_id ) {
[31] Fix | Delete
$generated_schema = $this->helpers->schema->image->generate_from_attachment_id( $image_id, $this->context->main_image_id );
[32] Fix | Delete
$this->context->main_image_url = $generated_schema['url'];
[33] Fix | Delete
[34] Fix | Delete
return $generated_schema;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
// The first image in the content.
[38] Fix | Delete
if ( $this->context->main_image_url ) {
[39] Fix | Delete
return $this->helpers->schema->image->generate_from_url( $image_id, $this->context->main_image_url );
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
return false;
[43] Fix | Delete
}
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function