using_index_permalinks() ) { return $home_path . '/index.php' . $location . '/'; } elseif ( $wp_rewrite->using_permalinks() ) { return $home_path . $location . '/'; } else { return $home_path . $location . '/?jetpack-sitemap='; } } /** * Examine a path+query URI fragment looking for a sitemap request. * * @access public * @since 4.8.0 * * @param string $raw_uri A URI (path+query only) to test for sitemap-ness. * * @return array @args { * @type string $sitemap_name The recognized sitemap name (or null). * } */ public function recognize_sitemap_uri( $raw_uri ) { // The path+query where sitemaps are served. $sitemap_path = $this->the_jetpack_sitemap_path_and_query_prefix(); // A regex which detects $sitemap_path at the beginning of a string. $path_regex = '/^' . preg_quote( $sitemap_path, '/' ) . '/'; // Check that the request URI begins with the sitemap path. if ( preg_match( $path_regex, $raw_uri ) ) { // Strip off the $sitemap_path and any trailing slash. $stripped_uri = preg_replace( $path_regex, '', rtrim( $raw_uri, '/' ) ); } else { $stripped_uri = ''; } // Check that the stripped uri begins with one of the sitemap prefixes. if ( preg_match( '/^sitemap|^image-s|^news-s|^video-s/', $stripped_uri ) ) { $filename = $stripped_uri; } else { $filename = null; } return array( 'sitemap_name' => $filename, ); } }