Edit File by line
/home/barbar84/www/wp-conte.../plugins/wordpres.../src/integrat...
File: xmlrpc.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Integrations;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\XMLRPC_Conditional;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Noindexes the xmlrpc.php file and all ways to request it.
[7] Fix | Delete
*
[8] Fix | Delete
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- Known false positive with acronyms. Fix expected in YoastCS 3.x.
[9] Fix | Delete
*/
[10] Fix | Delete
class XMLRPC implements Integration_Interface {
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Returns the conditionals based on which this loadable should be active.
[14] Fix | Delete
*
[15] Fix | Delete
* In this case when the current request is an XML-RPC request.
[16] Fix | Delete
*
[17] Fix | Delete
* @return array The conditionals based on which this class should be loaded.
[18] Fix | Delete
*/
[19] Fix | Delete
public static function get_conditionals() {
[20] Fix | Delete
return [ XMLRPC_Conditional::class ];
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* Initializes the integration.
[25] Fix | Delete
*
[26] Fix | Delete
* @return void
[27] Fix | Delete
*/
[28] Fix | Delete
public function register_hooks() {
[29] Fix | Delete
\add_filter( 'xmlrpc_methods', [ $this, 'robots_header' ] );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Sets a noindex, follow x-robots-tag header on all XMLRPC requests.
[34] Fix | Delete
*
[35] Fix | Delete
* @codeCoverageIgnore Basically impossible to test from the command line.
[36] Fix | Delete
*
[37] Fix | Delete
* @param array $methods The methods.
[38] Fix | Delete
*
[39] Fix | Delete
* @return array The methods.
[40] Fix | Delete
*/
[41] Fix | Delete
public function robots_header( $methods ) {
[42] Fix | Delete
if ( \headers_sent() === false ) {
[43] Fix | Delete
\header( 'X-Robots-Tag: noindex, follow', true );
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
return $methods;
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function