Code Duplication    Length = 14-14 lines in 2 locations

modules/sitemaps/sitemaps.php 2 locations

@@ 709-722 (lines=14) @@
706
	 * @param bool $discover_sitemap Make default sitemap discoverable to robots.
707
	 */
708
	$discover_sitemap = apply_filters( 'jetpack_sitemap_generate', true );
709
	if ( $discover_sitemap ) {
710
		add_action( 'do_robotstxt', 'jetpack_sitemap_discovery', 5, 0 );
711
712
		// Sitemap XML
713
		if ( preg_match( '#(/sitemap\.xml)$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET['jetpack-sitemap'] ) && 'true' == $_GET['jetpack-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-747 (lines=14) @@
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
		// News Sitemap XML
738
		if ( preg_match( '#(/news-sitemap\.xml)$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET['jetpack-news-sitemap'] ) && 'true' == $_GET['jetpack-news-sitemap'] ) ) {
739
			// run later so things like custom post types have been registered
740
			add_action( 'init', 'jetpack_print_news_sitemap', 999 );
741
		}
742
743
		// XSLT for sitemap
744
		if ( preg_match( '#(/news-sitemap\.xsl)$#i', $_SERVER['REQUEST_URI'] ) || ( isset( $_GET['jetpack-news-sitemap-xsl'] ) && 'true' == $_GET['jetpack-news-sitemap-xsl'] ) ) {
745
			add_action( 'init', 'jetpack_print_news_sitemap_xsl' );
746
		}
747
	}
748
}
749
750
// Initialize sitemaps once themes can filter the initialization.