/home/arranoyd/magicraft/wp-content/plugins/wp-rocket/inc/3rd-party/yoast-seo.php
<?php
if ( defined( 'WPSEO_VERSION' ) && class_exists( 'WPSEO_Sitemaps_Router' ) ) :
$yoast_seo_xml = get_option( 'wpseo_xml' );
/**
* Improvement with Yoast SEO: auto-detect the XML sitemaps for the preload option
*
* @since 2.8
* @author Remy Perona
*/
if ( true === $yoast_seo_xml['enablexmlsitemap'] ) {
add_filter( 'rocket_first_install_options', '__rocket_add_yoast_seo_sitemap_option' );
function __rocket_add_yoast_seo_sitemap_option( $options ) {
$options['yoast_xml_sitemap'] = 0;
return $options;
}
add_filter( 'rocket_inputs_sanitize', '__rocket_yoast_seo_sitemap_option_sanitize' );
function __rocket_yoast_seo_sitemap_option_sanitize( $inputs ) {
$inputs['yoast_xml_sitemap'] = ! empty( $inputs['yoast_xml_sitemap'] ) ? 1 : 0;
return $inputs;
}
add_filter( 'rocket_sitemap_preload_list', '__rocket_add_yoast_seo_sitemap' );
function __rocket_add_yoast_seo_sitemap( $sitemaps ) {
if ( get_rocket_option( 'yoast_xml_sitemap', false ) ) {
$sitemaps[] = WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' );
}
return $sitemaps;
}
add_filter( 'rocket_sitemap_preload_options', '__rocket_sitemap_preload_yoast_seo_option' );
function __rocket_sitemap_preload_yoast_seo_option( $options ) {
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'checkbox',
'label' => __('Yoast SEO XML sitemap', 'rocket' ),
'label_for' => 'yoast_xml_sitemap',
'label_screen' => sprintf( __( 'Preload the sitemap from the %s plugin', 'rocket' ), 'Yoast SEO' ),
'default' => 0,
);
$options[] = array(
'parent' => 'sitemap_preload',
'type' => 'helper_description',
'name' => 'yoast_xml_sitemap_desc',
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'Yoast SEO' )
);
return $options;
}
}
endif;