File "jetpack.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/wp-rocket/inc/3rd-party/plugins/jetpack.php
File
size: 3.33 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
defined('ABSPATH') || exit;
if (class_exists('Jetpack')) {
if (Jetpack::is_module_active('sitemaps') && function_exists('jetpack_sitemap_uri')) {
function rocket_add_jetpack_sitemap_option($options)
{
$options['jetpack_xml_sitemap'] = 0;
return $options;
}
add_filter('rocket_first_install_options', 'rocket_add_jetpack_sitemap_option');
function rocket_jetpack_sitemap_option_sanitize($inputs)
{
$inputs['jetpack_xml_sitemap'] = !empty($inputs['jetpack_xml_sitemap']) ? 1 : 0;
return $inputs;
}
add_filter('rocket_inputs_sanitize', 'rocket_jetpack_sitemap_option_sanitize');
function rocket_add_jetpack_sitemap($sitemaps)
{
if (get_rocket_option('jetpack_xml_sitemap', false)) {
$sitemaps['jetpack'] = jetpack_sitemap_uri();
}
return $sitemaps;
}
add_filter('rocket_sitemap_preload_list', 'rocket_add_jetpack_sitemap');
function rocket_sitemap_preload_jetpack_option($options)
{
$options[] = ['parent' => 'sitemap_preload', 'type' => 'checkbox', 'label' => __('Jetpack XML Sitemaps', 'rocket'), 'label_for' => 'jetpack_xml_sitemap', 'label_screen' => sprintf(__('Preload the sitemap from the Jetpack plugin', 'rocket'), 'Jetpack'), 'default' => 0];
$options[] = ['parent' => 'sitemap_preload', 'type' => 'helper_description', 'name' => 'jetpack_xml_sitemap_desc', 'description' => sprintf(__('We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket'), 'Jetpack')];
return $options;
}
add_filter('rocket_sitemap_preload_options', 'rocket_sitemap_preload_jetpack_option');
}
if (Jetpack::is_module_active('widgets')) {
function rocket_add_jetpack_cookie_law_mandatory_cookie($cookies)
{
$cookies['jetpack-eu-cookie-law'] = 'eucookielaw';
return $cookies;
}
add_filter('rocket_cache_mandatory_cookies', 'rocket_add_jetpack_cookie_law_mandatory_cookie');
add_filter('rocket_htaccess_mod_rewrite', '__return_false', 76);
function rocket_activate_jetpack_cookie_law()
{
$rocket_jp_eu_cookie_widget = get_option('rocket_jetpack_eu_cookie_widget');
if (is_active_widget(false, false, 'eu_cookie_law_widget') && empty($rocket_jp_eu_cookie_widget)) {
add_filter('rocket_htaccess_mod_rewrite', '__return_false', 76);
add_filter('rocket_cache_mandatory_cookies', 'rocket_add_jetpack_cookie_law_mandatory_cookie');
flush_rocket_htaccess();
rocket_generate_config_file();
update_option('rocket_jetpack_eu_cookie_widget', 1, true);
}
}
add_action('admin_init', 'rocket_activate_jetpack_cookie_law');
}
}
function rocket_remove_jetpack_cookie_law_mandatory_cookie()
{
remove_filter('rocket_htaccess_mod_rewrite', '__return_false', 76);
remove_filter('rocket_cache_mandatory_cookies', '_rocket_add_eu_cookie_law_mandatory_cookie');
flush_rocket_htaccess();
rocket_generate_config_file();
delete_option('rocket_jetpack_eu_cookie_widget');
}
add_action('deactivate_jetpack/jetpack.php', 'rocket_remove_jetpack_cookie_law_mandatory_cookie', 11);