IP : 18.226.4.246Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
servlmvm/
public_html/
wp-includes/
widgets/
../
sitemaps/
class-wp-sitemaps.php/
/
<?php /** * Sitemaps: WP_Sitemaps class * * This is the main class integrating all other classes. * * @package WordPress * @subpackage Sitemaps * @since 5.5.0 */
/** * Class WP_Sitemaps. * * @since 5.5.0 */ #[AllowDynamicProperties] class WP_Sitemaps { /** * The main index of supported sitemaps. * * @since 5.5.0 * * @var WP_Sitemaps_Index */ public $index;
/** * The main registry of supported sitemaps. * * @since 5.5.0 * * @var WP_Sitemaps_Registry */ public $registry;
/** * An instance of the renderer class. * * @since 5.5.0 * * @var WP_Sitemaps_Renderer */ public $renderer;
/** * WP_Sitemaps constructor. * * @since 5.5.0 */ public function __construct() { $this->registry = new WP_Sitemaps_Registry(); $this->renderer = new WP_Sitemaps_Renderer(); $this->index = new WP_Sitemaps_Index( $this->registry ); }
/** * Initiates all sitemap functionality. * * If sitemaps are disabled, only the rewrite rules will be registered * by this method, in order to properly send 404s. * * @since 5.5.0 */ public function init() { // These will all fire on the init hook. $this->register_rewrites();
/** * Determines whether sitemaps are enabled or not. * * @since 5.5.0 * * @return bool Whether sitemaps are enabled. */ public function sitemaps_enabled() { $is_enabled = (bool) get_option( 'blog_public' );
/** * Filters whether XML Sitemaps are enabled or not. * * When XML Sitemaps are disabled via this filter, rewrite rules are still * in place to ensure a 404 is returned. * * @see WP_Sitemaps::register_rewrites() * * @since 5.5.0 * * @param bool $is_enabled Whether XML Sitemaps are enabled or not. * Defaults to true for public sites. */ return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled ); }
/** * Registers and sets up the functionality for all supported sitemaps. * * @since 5.5.0 */ public function register_sitemaps() { $providers = array( 'posts' => new WP_Sitemaps_Posts(), 'taxonomies' => new WP_Sitemaps_Taxonomies(), 'users' => new WP_Sitemaps_Users(), );
/** * Redirects a URL to the wp-sitemap.xml * * @since 5.5.0 * @deprecated 6.7.0 Deprecated in favor of {@see WP_Rewrite::rewrite_rules()} * * @param bool $bypass Pass-through of the pre_handle_404 filter value. * @param WP_Query $query The WP_Query object. * @return bool Bypass value. */ public function redirect_sitemapxml( $bypass, $query ) { _deprecated_function( __FUNCTION__, '6.7.0' );
// If a plugin has already utilized the pre_handle_404 function, return without action to avoid conflicts. if ( $bypass ) { return $bypass; }
// 'pagename' is for most permalink types, name is for when the %postname% is used as a top-level field. if ( 'sitemap-xml' === $query->get( 'pagename' ) || 'sitemap-xml' === $query->get( 'name' ) ) { wp_safe_redirect( $this->index->get_index_url() ); exit(); }
return $bypass; }
/** * Adds the sitemap index to robots.txt. * * @since 5.5.0 * * @param string $output robots.txt output. * @param bool $is_public Whether the site is public. * @return string The robots.txt output. */ public function add_robots( $output, $is_public ) { if ( $is_public ) { $output .= "\nSitemap: " . esc_url( $this->index->get_index_url() ) . "\n"; }