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/integrat.../front-en...
File: indexing-controls.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations\Front_End;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Robots_Helper;
[5] Fix | Delete
use Yoast\WP\SEO\Integrations\Integration_Interface;
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Class Indexing_Controls.
[9] Fix | Delete
*/
[10] Fix | Delete
class Indexing_Controls implements Integration_Interface {
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* The robots helper.
[14] Fix | Delete
*
[15] Fix | Delete
* @var Robots_Helper
[16] Fix | Delete
*/
[17] Fix | Delete
protected $robots;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Returns the conditionals based in which this loadable should be active.
[21] Fix | Delete
*
[22] Fix | Delete
* @return array
[23] Fix | Delete
*/
[24] Fix | Delete
public static function get_conditionals() {
[25] Fix | Delete
return [ Front_End_Conditional::class ];
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* The constructor.
[30] Fix | Delete
*
[31] Fix | Delete
* @codeCoverageIgnore Sets the dependencies.
[32] Fix | Delete
*
[33] Fix | Delete
* @param Robots_Helper $robots The robots helper.
[34] Fix | Delete
*/
[35] Fix | Delete
public function __construct( Robots_Helper $robots ) {
[36] Fix | Delete
$this->robots = $robots;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Initializes the integration.
[41] Fix | Delete
*
[42] Fix | Delete
* This is the place to register hooks and filters.
[43] Fix | Delete
*
[44] Fix | Delete
* @codeCoverageIgnore
[45] Fix | Delete
*
[46] Fix | Delete
* @return void
[47] Fix | Delete
*/
[48] Fix | Delete
public function register_hooks() {
[49] Fix | Delete
// The option `blog_public` is set in Settings > Reading > Search Engine Visibility.
[50] Fix | Delete
if ( (string) \get_option( 'blog_public' ) === '0' ) {
[51] Fix | Delete
\add_filter( 'wpseo_robots_array', [ $this->robots, 'set_robots_no_index' ] );
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
\add_action( 'template_redirect', [ $this, 'noindex_robots' ] );
[55] Fix | Delete
\add_filter( 'loginout', [ $this, 'nofollow_link' ] );
[56] Fix | Delete
\add_filter( 'register', [ $this, 'nofollow_link' ] );
[57] Fix | Delete
[58] Fix | Delete
// Remove actions that we will handle through our wpseo_head call, and probably change the output of.
[59] Fix | Delete
\remove_action( 'wp_head', 'rel_canonical' );
[60] Fix | Delete
\remove_action( 'wp_head', 'index_rel_link' );
[61] Fix | Delete
\remove_action( 'wp_head', 'start_post_rel_link' );
[62] Fix | Delete
\remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
[63] Fix | Delete
\remove_action( 'wp_head', 'noindex', 1 );
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Sends a Robots HTTP header preventing URL from being indexed in the search results while allowing search engines
[68] Fix | Delete
* to follow the links in the object at the URL.
[69] Fix | Delete
*
[70] Fix | Delete
* @return bool Boolean indicating whether the noindex header was sent.
[71] Fix | Delete
*/
[72] Fix | Delete
public function noindex_robots() {
[73] Fix | Delete
if ( ! \is_robots() ) {
[74] Fix | Delete
return false;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
return $this->set_robots_header();
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Adds rel="nofollow" to a link, only used for login / registration links.
[82] Fix | Delete
*
[83] Fix | Delete
* @param string $input The link element as a string.
[84] Fix | Delete
*
[85] Fix | Delete
* @return string
[86] Fix | Delete
*/
[87] Fix | Delete
public function nofollow_link( $input ) {
[88] Fix | Delete
return \str_replace( '<a ', '<a rel="nofollow" ', $input );
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
/**
[92] Fix | Delete
* Sets the x-robots-tag to noindex follow.
[93] Fix | Delete
*
[94] Fix | Delete
* @codeCoverageIgnore Too difficult to test.
[95] Fix | Delete
*
[96] Fix | Delete
* @return bool
[97] Fix | Delete
*/
[98] Fix | Delete
protected function set_robots_header() {
[99] Fix | Delete
if ( \headers_sent() === false ) {
[100] Fix | Delete
\header( 'X-Robots-Tag: noindex, follow', true );
[101] Fix | Delete
[102] Fix | Delete
return true;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
return false;
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function