✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.191
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/wordpress/network/user-interface//site-schema-response-header-integration.php
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Schema_Aggregator\User_Interface;

use WP_REST_Request;
use WP_REST_Response;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Aggregator_Conditional;
use Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Map\Schema_Map_Header_Adapter;

/**
 * Integration to set proper response headers for Site Schema endpoints.
 */
class Site_Schema_Response_Header_Integration implements Integration_Interface {

	/**
	 * The schema map header adapter.
	 *
	 * @var Schema_Map_Header_Adapter
	 */
	private $schema_map_header_adapter;

	/**
	 * Returns the conditional for this route.
	 *
	 * @return array<string> The conditionals that must be met to load this.
	 */
	public static function get_conditionals() {
		return [ Schema_Aggregator_Conditional::class ];
	}

	/**
	 * Constructor.
	 *
	 * @param Schema_Map_Header_Adapter $schema_map_header_adapter The schema map header adapter.
	 */
	public function __construct( Schema_Map_Header_Adapter $schema_map_header_adapter ) {
		$this->schema_map_header_adapter = $schema_map_header_adapter;
	}

	/**
	 * Registers the hooks for the integration.
	 *
	 * @return void
	 */
	public function register_hooks() {
		\add_filter( 'rest_pre_serve_request', [ $this, 'serve_custom_response' ], 10, 4 );
	}

	/**
	 * Serve custom responses (XML or JSON) for schemamap endpoints
	 *
	 * Intercepts schemamap index endpoints to serve either XML or JSON with
	 * proper content types and formatting. For XML responses (from /schema),
	 * outputs raw XML. For JSON responses (from /schema.json or post-type endpoints),
	 * outputs JSON with unescaped slashes for cleaner URLs.
	 *
	 * Only affects /yoast/v1/schema-aggregator endpoints. Other endpoints are unaffected.
	 *
	 * @param bool             $served  Whether the request has already been served.
	 * @param WP_REST_Response $result  Result to send to the client.
	 * @param WP_REST_Request  $request Request object.
	 *
	 * @return bool True if we served the request, false otherwise.
	 * @codeCoverageIgnore ignore this since its needs to rely on headers being sent. Which does not work in integration tests.
	 */
	public function serve_custom_response( $served, $result, $request ): bool {
		if ( ! $request instanceof WP_REST_Request || \strpos( $request->get_route(), '/yoast/v1/schema-aggregator' ) !== 0 ) {
			return (bool) $served;
		}

		if ( ! $result instanceof WP_REST_Response || $result->is_error() ) {
			return (bool) $served;
		}

		$this->schema_map_header_adapter->set_header_for_request( $result );

		return true;
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
27 Sep 2026 9.22 AM
docteuh / users
0755
cache
--
9 Sep 2026 11.23 PM
docteuh / users
0755
about.php
0.239 KB
6 Feb 2020 7.33 AM
docteuh / users
0644
icon-redirect-manager-20260827192224.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
plugin-install.php
0.368 KB
24 May 2020 11.17 AM
docteuh / users
0644
site-schema-aggregator-cache-cli-command.php
2.658 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
site-schema-aggregator-cli-command.php
3.328 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
site-schema-aggregator-route.php
6.133 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
site-schema-aggregator-xml-route.php
4.229 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
site-schema-response-header-integration.php
2.652 KB
23 Jun 2026 6.19 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF