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/wp-conte.../plugins/wordpres.../src/generato.../schema
File: organization.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 schema Organization data.
[7] Fix | Delete
*/
[8] Fix | Delete
class Organization extends Abstract_Schema_Piece {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Determines whether an Organization graph piece should be added.
[12] Fix | Delete
*
[13] Fix | Delete
* @return bool
[14] Fix | Delete
*/
[15] Fix | Delete
public function is_needed() {
[16] Fix | Delete
return $this->context->site_represents === 'company';
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Returns the Organization Schema data.
[21] Fix | Delete
*
[22] Fix | Delete
* @return array The Organization schema.
[23] Fix | Delete
*/
[24] Fix | Delete
public function generate() {
[25] Fix | Delete
$logo_schema_id = $this->context->site_url . Schema_IDs::ORGANIZATION_LOGO_HASH;
[26] Fix | Delete
[27] Fix | Delete
if ( $this->context->company_logo_meta ) {
[28] Fix | Delete
$logo = $this->helpers->schema->image->generate_from_attachment_meta( $logo_schema_id, $this->context->company_logo_meta, $this->context->company_name );
[29] Fix | Delete
}
[30] Fix | Delete
else {
[31] Fix | Delete
$logo = $this->helpers->schema->image->generate_from_attachment_id( $logo_schema_id, $this->context->company_logo_id, $this->context->company_name );
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$organization = [
[35] Fix | Delete
'@type' => 'Organization',
[36] Fix | Delete
'@id' => $this->context->site_url . Schema_IDs::ORGANIZATION_HASH,
[37] Fix | Delete
'name' => $this->helpers->schema->html->smart_strip_tags( $this->context->company_name ),
[38] Fix | Delete
];
[39] Fix | Delete
[40] Fix | Delete
if ( ! empty( $this->context->company_alternate_name ) ) {
[41] Fix | Delete
$organization['alternateName'] = $this->context->company_alternate_name;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
$organization['url'] = $this->context->site_url;
[45] Fix | Delete
$organization['logo'] = $logo;
[46] Fix | Delete
$organization['image'] = [ '@id' => $logo['@id'] ];
[47] Fix | Delete
[48] Fix | Delete
$same_as = \array_values( \array_unique( \array_filter( $this->fetch_social_profiles() ) ) );
[49] Fix | Delete
if ( ! empty( $same_as ) ) {
[50] Fix | Delete
$organization['sameAs'] = $same_as;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if ( \is_array( $this->context->schema_page_type ) && \in_array( 'ProfilePage', $this->context->schema_page_type, true ) ) {
[54] Fix | Delete
$organization['mainEntityOfPage'] = [
[55] Fix | Delete
'@id' => $this->context->main_schema_id,
[56] Fix | Delete
];
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
return $organization;
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Retrieve the social profiles to display in the organization schema.
[64] Fix | Delete
*
[65] Fix | Delete
* @return array An array of social profiles.
[66] Fix | Delete
*/
[67] Fix | Delete
private function fetch_social_profiles() {
[68] Fix | Delete
$profiles = $this->helpers->social_profiles->get_organization_social_profiles();
[69] Fix | Delete
[70] Fix | Delete
if ( isset( $profiles['other_social_urls'] ) ) {
[71] Fix | Delete
$other_social_urls = $profiles['other_social_urls'];
[72] Fix | Delete
unset( $profiles['other_social_urls'] );
[73] Fix | Delete
$profiles = \array_merge( $profiles, $other_social_urls );
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* Filter: 'wpseo_schema_organization_social_profiles' - Allows filtering social profiles for the
[78] Fix | Delete
* represented organization.
[79] Fix | Delete
*
[80] Fix | Delete
* @param string[] $profiles
[81] Fix | Delete
*/
[82] Fix | Delete
$profiles = \apply_filters( 'wpseo_schema_organization_social_profiles', $profiles );
[83] Fix | Delete
[84] Fix | Delete
return $profiles;
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function