|  | @@ 699-722 (lines=24) @@ | 
                                                            
                                    | 696 |  | 	 * @param bool $discover_sitemap Make default sitemap discoverable to robots. | 
                                                            
                                    | 697 |  | 	 */ | 
                                                            
                                    | 698 |  | 	$discover_sitemap = apply_filters( 'jetpack_sitemap_generate', true ); | 
                                                            
                                    | 699 |  | 	if ( $discover_sitemap ) { | 
                                                            
                                    | 700 |  | 		add_action( 'do_robotstxt', 'jetpack_sitemap_discovery', 5, 0 ); | 
                                                            
                                    | 701 |  |  | 
                                                            
                                    | 702 |  | 		if ( get_option( 'permalink_structure' ) ) { | 
                                                            
                                    | 703 |  | 			/** This filter is documented in modules/sitemaps/sitemaps.php */ | 
                                                            
                                    | 704 |  | 			$sitemap = apply_filters( 'jetpack_sitemap_location', home_url( '/sitemap.xml' ) ); | 
                                                            
                                    | 705 |  | 			$sitemap = parse_url( $sitemap, PHP_URL_PATH ); | 
                                                            
                                    | 706 |  | 		} else { | 
                                                            
                                    | 707 |  | 			/** This filter is documented in modules/sitemaps/sitemaps.php */ | 
                                                            
                                    | 708 |  | 			$sitemap = apply_filters( 'jetpack_sitemap_location', home_url( '/?jetpack-sitemap=true' ) ); | 
                                                            
                                    | 709 |  | 			$sitemap = preg_replace( '/(=.*?)$/i', '', parse_url( $sitemap, PHP_URL_QUERY ) ); | 
                                                            
                                    | 710 |  | 		} | 
                                                            
                                    | 711 |  |  | 
                                                            
                                    | 712 |  | 		// Sitemap XML | 
                                                            
                                    | 713 |  | 		if ( preg_match( '#(' . $sitemap . ')$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET[ $sitemap ] ) && 'true' == $_GET[ $sitemap ] ) ) { | 
                                                            
                                    | 714 |  | 			// run later so things like custom post types have been registered | 
                                                            
                                    | 715 |  | 			add_action( 'init', 'jetpack_print_sitemap', 999 ); | 
                                                            
                                    | 716 |  | 		} | 
                                                            
                                    | 717 |  |  | 
                                                            
                                    | 718 |  | 		// XSLT for sitemap | 
                                                            
                                    | 719 |  | 		if ( preg_match( '#(/sitemap\.xsl)$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET['jetpack-sitemap-xsl'] ) && 'true' == $_GET['jetpack-sitemap-xsl'] ) ) { | 
                                                            
                                    | 720 |  | 			add_action( 'init', 'jetpack_print_sitemap_xsl' ); | 
                                                            
                                    | 721 |  | 		} | 
                                                            
                                    | 722 |  | 	} | 
                                                            
                                    | 723 |  |  | 
                                                            
                                    | 724 |  | 	/** | 
                                                            
                                    | 725 |  | 	 * Filter whether to make the news sitemap discoverable to robots or not. | 
                                                                                
                                |  | @@ 734-757 (lines=24) @@ | 
                                                            
                                    | 731 |  | 	 * @param bool $discover_news_sitemap Make default news sitemap discoverable to robots. | 
                                                            
                                    | 732 |  | 	 */ | 
                                                            
                                    | 733 |  | 	$discover_news_sitemap = apply_filters( 'jetpack_news_sitemap_generate', true ); | 
                                                            
                                    | 734 |  | 	if ( $discover_news_sitemap ) { | 
                                                            
                                    | 735 |  | 		add_action( 'do_robotstxt', 'jetpack_news_sitemap_discovery', 5, 0 ); | 
                                                            
                                    | 736 |  |  | 
                                                            
                                    | 737 |  | 		if ( get_option( 'permalink_structure' ) ) { | 
                                                            
                                    | 738 |  | 			/** This filter is documented in modules/sitemaps/sitemaps.php */ | 
                                                            
                                    | 739 |  | 			$sitemap = apply_filters( 'jetpack_news_sitemap_location', home_url( '/news-sitemap.xml' ) ); | 
                                                            
                                    | 740 |  | 			$sitemap = parse_url( $sitemap, PHP_URL_PATH ); | 
                                                            
                                    | 741 |  | 		} else { | 
                                                            
                                    | 742 |  | 			/** This filter is documented in modules/sitemaps/sitemaps.php */ | 
                                                            
                                    | 743 |  | 			$sitemap = apply_filters( 'jetpack_news_sitemap_location', home_url( '/?jetpack-news-sitemap=true' ) ); | 
                                                            
                                    | 744 |  | 			$sitemap = preg_replace( '/(=.*?)$/i', '', parse_url( $sitemap, PHP_URL_QUERY ) ); | 
                                                            
                                    | 745 |  | 		} | 
                                                            
                                    | 746 |  |  | 
                                                            
                                    | 747 |  | 		// News Sitemap XML | 
                                                            
                                    | 748 |  | 		if ( preg_match( '#(' . $sitemap . ')$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET[ $sitemap ] ) && 'true' == $_GET[ $sitemap ] ) ) { | 
                                                            
                                    | 749 |  | 			// run later so things like custom post types have been registered | 
                                                            
                                    | 750 |  | 			add_action( 'init', 'jetpack_print_news_sitemap', 999 ); | 
                                                            
                                    | 751 |  | 		} | 
                                                            
                                    | 752 |  |  | 
                                                            
                                    | 753 |  | 		// XSLT for sitemap | 
                                                            
                                    | 754 |  | 		if ( preg_match( '#(/news-sitemap\.xsl)$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET['jetpack-news-sitemap-xsl'] ) && 'true' == $_GET['jetpack-news-sitemap-xsl'] ) ) { | 
                                                            
                                    | 755 |  | 			add_action( 'init', 'jetpack_print_news_sitemap_xsl' ); | 
                                                            
                                    | 756 |  | 		} | 
                                                            
                                    | 757 |  | 	} | 
                                                            
                                    | 758 |  | } | 
                                                            
                                    | 759 |  |  | 
                                                            
                                    | 760 |  | // Initialize sitemaps once themes can filter the initialization. |