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/helpers
File: robots-helper.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Helpers;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Models\Indexable;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* A helper object for the robots meta tag.
[7] Fix | Delete
*/
[8] Fix | Delete
class Robots_Helper {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Holds the Post_Type_Helper.
[12] Fix | Delete
*
[13] Fix | Delete
* @var Post_Type_Helper
[14] Fix | Delete
*/
[15] Fix | Delete
protected $post_type_helper;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Holds the Taxonomy_Helper.
[19] Fix | Delete
*
[20] Fix | Delete
* @var Taxonomy_Helper
[21] Fix | Delete
*/
[22] Fix | Delete
protected $taxonomy_helper;
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* Constructs a Score_Helper.
[26] Fix | Delete
*
[27] Fix | Delete
* @param Post_Type_Helper $post_type_helper The Post_Type_Helper.
[28] Fix | Delete
* @param Taxonomy_Helper $taxonomy_helper The Taxonomy_Helper.
[29] Fix | Delete
*/
[30] Fix | Delete
public function __construct(
[31] Fix | Delete
Post_Type_Helper $post_type_helper,
[32] Fix | Delete
Taxonomy_Helper $taxonomy_helper
[33] Fix | Delete
) {
[34] Fix | Delete
$this->post_type_helper = $post_type_helper;
[35] Fix | Delete
$this->taxonomy_helper = $taxonomy_helper;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Retrieves whether the Indexable is indexable.
[40] Fix | Delete
*
[41] Fix | Delete
* @param Indexable $indexable The Indexable.
[42] Fix | Delete
*
[43] Fix | Delete
* @return bool Whether the Indexable is indexable.
[44] Fix | Delete
*/
[45] Fix | Delete
public function is_indexable( Indexable $indexable ) {
[46] Fix | Delete
if ( $indexable->is_robots_noindex === null ) {
[47] Fix | Delete
// No individual value set, check the global setting.
[48] Fix | Delete
switch ( $indexable->object_type ) {
[49] Fix | Delete
case 'post':
[50] Fix | Delete
return $this->post_type_helper->is_indexable( $indexable->object_sub_type );
[51] Fix | Delete
case 'term':
[52] Fix | Delete
return $this->taxonomy_helper->is_indexable( $indexable->object_sub_type );
[53] Fix | Delete
}
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
return $indexable->is_robots_noindex === false;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Sets the robots index to noindex.
[61] Fix | Delete
*
[62] Fix | Delete
* @param array $robots The current robots value.
[63] Fix | Delete
*
[64] Fix | Delete
* @return array The altered robots string.
[65] Fix | Delete
*/
[66] Fix | Delete
public function set_robots_no_index( $robots ) {
[67] Fix | Delete
if ( ! \is_array( $robots ) ) {
[68] Fix | Delete
\_deprecated_argument( __METHOD__, '14.1', '$robots has to be a key-value paired array.' );
[69] Fix | Delete
return $robots;
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
$robots['index'] = 'noindex';
[73] Fix | Delete
[74] Fix | Delete
return $robots;
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function