File "the-seo-framework.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/wp-rocket/inc/3rd-party/plugins/seo/the-seo-framework.php
File size: 2.16 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

defined('ABSPATH') || exit;
if (!function_exists('the_seo_framework')) {
    return;
}
rocket_add_tsf_compat();
function rocket_add_tsf_compat()
{
    $tsf = the_seo_framework();
    if (empty($tsf->loaded)) {
        return;
    }
    if ($tsf->can_run_sitemap()) {
        rocket_add_tsf_sitemap_compat();
    }
}
function rocket_add_tsf_sitemap_compat()
{
    add_filter('rocket_first_install_options', 'rocket_add_tsf_seo_sitemap_option');
    add_filter('rocket_inputs_sanitize', 'rocket_tsf_seo_sitemap_option_sanitize');
    add_filter('rocket_sitemap_preload_list', 'rocket_add_tsf_sitemap_to_preload');
    add_filter('rocket_sitemap_preload_options', 'rocket_sitemap_add_tsf_sitemap_to_preload_option');
}
function rocket_add_tsf_seo_sitemap_option($options)
{
    $options['tsf_xml_sitemap'] = 0;
    return $options;
}
function rocket_tsf_seo_sitemap_option_sanitize($inputs)
{
    $inputs['tsf_xml_sitemap'] = !empty($inputs['tsf_xml_sitemap']) ? 1 : 0;
    return $inputs;
}
function rocket_add_tsf_sitemap_to_preload($sitemaps)
{
    if (get_rocket_option('tsf_xml_sitemap', false)) {
        if (version_compare(THE_SEO_FRAMEWORK_VERSION, '4.0', '>=')) {
            $sitemap_bridge = The_SEO_Framework\Bridges\Sitemap::get_instance();
            foreach ($sitemap_bridge->get_sitemap_endpoint_list() as $id => $data) {
                if (!empty($data['robots'])) {
                    $sitemaps[] = $sitemap_bridge->get_expected_sitemap_endpoint_url($id);
                }
            }
        } else {
            $sitemaps[] = the_seo_framework()->get_sitemap_xml_url();
        }
    }
    return $sitemaps;
}
function rocket_sitemap_add_tsf_sitemap_to_preload_option($options)
{
    $options['tsf_xml_sitemap'] = ['type' => 'checkbox', 'container_class' => ['wpr-field--children'], 'label' => __('The SEO Framework XML sitemap', 'rocket'), 'description' => sprintf(__('We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket'), 'The SEO Framework'), 'parent' => 'sitemap_preload', 'section' => 'preload_section', 'page' => 'preload', 'default' => 0, 'sanitize_callback' => 'sanitize_checkbox'];
    return $options;
}