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/services/importin.../aioseo
File: aioseo-robots-transformer-service.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Given it's a very specific case.
[2] Fix | Delete
namespace Yoast\WP\SEO\Services\Importing\Aioseo;
[3] Fix | Delete
[4] Fix | Delete
/**
[5] Fix | Delete
* Transforms AISOEO search appearance robot settings.
[6] Fix | Delete
*/
[7] Fix | Delete
class Aioseo_Robots_Transformer_Service {
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* The robots transfomer service.
[11] Fix | Delete
*
[12] Fix | Delete
* @var Aioseo_Robots_Provider_Service
[13] Fix | Delete
*/
[14] Fix | Delete
protected $robots_provider;
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Class constructor.
[18] Fix | Delete
*
[19] Fix | Delete
* @param Aioseo_Robots_Provider_Service $robots_provider The robots provider service.
[20] Fix | Delete
*/
[21] Fix | Delete
public function __construct(
[22] Fix | Delete
Aioseo_Robots_Provider_Service $robots_provider
[23] Fix | Delete
) {
[24] Fix | Delete
$this->robots_provider = $robots_provider;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Transforms the robot setting, taking into consideration whether they defer to global defaults.
[29] Fix | Delete
*
[30] Fix | Delete
* @param string $setting_name The name of the robot setting, eg. noindex.
[31] Fix | Delete
* @param bool $setting_value The value of the robot setting.
[32] Fix | Delete
* @param array $mapping The mapping of the setting we're working with.
[33] Fix | Delete
*
[34] Fix | Delete
* @return bool The transformed robot setting.
[35] Fix | Delete
*/
[36] Fix | Delete
public function transform_robot_setting( $setting_name, $setting_value, $mapping ) {
[37] Fix | Delete
$aioseo_settings = \json_decode( \get_option( $mapping['option_name'], '' ), true );
[38] Fix | Delete
[39] Fix | Delete
// Let's check first if it defers to global robot settings.
[40] Fix | Delete
if ( empty( $aioseo_settings ) || ! isset( $aioseo_settings['searchAppearance'][ $mapping['type'] ][ $mapping['subtype'] ]['advanced']['robotsMeta']['default'] ) ) {
[41] Fix | Delete
return $setting_value;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
$defers_to_defaults = $aioseo_settings['searchAppearance'][ $mapping['type'] ][ $mapping['subtype'] ]['advanced']['robotsMeta']['default'];
[45] Fix | Delete
[46] Fix | Delete
if ( $defers_to_defaults ) {
[47] Fix | Delete
return $this->robots_provider->get_global_robot_settings( $setting_name );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
return $setting_value;
[51] Fix | Delete
}
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function