Commit inicial, se subio el proyecto
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with Cookie Notice by dFactory.
|
||||
*
|
||||
* @since 2.11.6
|
||||
* @author Arun Basil Lal
|
||||
* @link https://wordpress.org/plugins/cookie-notice/
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'Cookie_Notice' ) ) {
|
||||
// Don't add the WP Rocket rewrite rules to avoid issues.
|
||||
if ( ! class_exists( 'CC4R_options' ) || ! CC4R_options::rewrite_enabled() ) {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 56 );
|
||||
}
|
||||
// Create cache version based on value set in cookie_notice_accepted cookie.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_notice_cookie' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cookie name set by Cookie Notice plugin.
|
||||
*
|
||||
* @since 2.11.6
|
||||
* @author Arun Basil Lal
|
||||
*
|
||||
* @param array $cookies List of dynamic cookies.
|
||||
* @return array List of dynamic cookies with the Cookie Notice cookie appended.
|
||||
*/
|
||||
function rocket_get_cookie_notice_cookie( $cookies ) {
|
||||
$cookies[] = 'cookie_notice_accepted';
|
||||
return $cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add dynamic cookie and mandatory cookie when Cookie Notice plugin is activated.
|
||||
*
|
||||
* @since 2.11.6
|
||||
* @author Arun Basil Lal
|
||||
*/
|
||||
function rocket_add_cookie_notice_dynamic_cookie() {
|
||||
// Don't add the WP Rocket rewrite rules to avoid issues.
|
||||
if ( ! class_exists( 'CC4R_options' ) || ! CC4R_options::rewrite_enabled() ) {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 56 );
|
||||
}
|
||||
// Create cache version based on value set in cookie_notice_accepted cookie.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_notice_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'activate_cookie-notice/cookie-notice.php', 'rocket_add_cookie_notice_dynamic_cookie', 11 );
|
||||
|
||||
/**
|
||||
* Remove dynamic cookie when Cookie Notice plugin is deactivated.
|
||||
*
|
||||
* @since 2.11.6
|
||||
* @author Arun Basil Lal
|
||||
*/
|
||||
function rocket_remove_cookie_notice_dynamic_cookie() {
|
||||
if ( ! class_exists( 'CC4R_options' ) || ! CC4R_options::rewrite_enabled() ) {
|
||||
remove_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 56 );
|
||||
}
|
||||
remove_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_notice_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'deactivate_cookie-notice/cookie-notice.php', 'rocket_remove_cookie_notice_dynamic_cookie', 11 );
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Compatibility with EU Cookie Law
|
||||
* https://wordpress.org/plugins/eu-cookie-law/
|
||||
*
|
||||
* @since 2.7
|
||||
*/
|
||||
if ( function_exists( 'eucookie_start' ) ) :
|
||||
add_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_eu_cookie_law_mandatory_cookie' );
|
||||
|
||||
/**
|
||||
* Update .htaccess & config files when the "Activate" and "Autoblock" options are turned on
|
||||
*
|
||||
* @since 2.7
|
||||
*
|
||||
* @param Array $old_value Array of previous values.
|
||||
* @param Array $value Array of submitted values.
|
||||
*/
|
||||
function rocket_after_update_eu_cookie_law_options( $old_value, $value ) {
|
||||
if ( ( isset( $old_value['enabled'], $value['enabled'] ) && ( $old_value['enabled'] === $value['enabled'] ) ) && isset( $old_value['autoblock'], $value['autoblock'] ) && $old_value['autoblock'] === $value['autoblock'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Update the config file.
|
||||
rocket_generate_config_file();
|
||||
}
|
||||
add_action( 'update_option_peadig_eucookie', 'rocket_after_update_eu_cookie_law_options', 10, 2 );
|
||||
|
||||
// Don't add the WP Rocket rewrite rules to avoid issues.
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 58 );
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Add mandatory cookie when we activate the plugin
|
||||
*
|
||||
* @since 2.7
|
||||
*/
|
||||
function rocket_activate_eu_cookie_law() {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 58 );
|
||||
add_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_eu_cookie_law_mandatory_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
}
|
||||
add_action( 'activate_eu-cookie-law/eu-cookie-law.php', 'rocket_activate_eu_cookie_law', 11 );
|
||||
|
||||
/**
|
||||
* Remove mandatory cookie when we deactivate the plugin
|
||||
*
|
||||
* @since 2.7
|
||||
*/
|
||||
function rocket_deactivate_eu_cookie_law() {
|
||||
remove_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 58 );
|
||||
remove_filter( 'rocket_cache_mandatory_cookies', 'rocket_add_eu_cookie_law_mandatory_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
}
|
||||
add_action( 'deactivate_eu-cookie-law/eu-cookie-law.php', 'rocket_deactivate_eu_cookie_law', 11 );
|
||||
|
||||
/**
|
||||
* Add the EU Cookie Law to the list of mandatory cookies before generating caching files.
|
||||
*
|
||||
* @since 2.7
|
||||
*
|
||||
* @param Array $cookies Array of mandatory cookies.
|
||||
* @return Array Updated array of mandatory cookies
|
||||
*/
|
||||
function rocket_add_eu_cookie_law_mandatory_cookie( $cookies ) {
|
||||
$options = get_option( 'peadig_eucookie' );
|
||||
|
||||
if ( ! empty( $options['enabled'] ) && ! empty( $options['autoblock'] ) ) {
|
||||
$cookies['eu-cookie-law'] = 'euCookie';
|
||||
}
|
||||
|
||||
return $cookies;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with GDPR by Trew Knowledge
|
||||
*
|
||||
* @link https://github.com/trewknowledge/GDPR/
|
||||
* @link https://wordpress.org/plugins/gdpr/
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'GDPR' ) ) {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 60 );
|
||||
// Create cache version based on value set in gdpr[] cookies.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_gdpr_dynamic_cookies' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cookie names set by GDPR plugin
|
||||
*
|
||||
* @since 3.1.4
|
||||
* @author jorditarrida
|
||||
*
|
||||
* @param array $cookies array List of dynamic cookies.
|
||||
* @return array List of dynamic cookies with the GDPR cookie appended
|
||||
*/
|
||||
function rocket_get_gdpr_mandatory_cookies( $cookies ) {
|
||||
$cookies[] = 'allowed_cookies';
|
||||
$cookies[] = 'consent_types';
|
||||
return $cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cookie names set by GDPR plugin
|
||||
*
|
||||
* @since 3.1.4
|
||||
* @author jorditarrida
|
||||
*
|
||||
* @param array $cookies array List of dynamic cookies.
|
||||
* @return array List of dynamic cookies with the GDPR cookie appended
|
||||
*/
|
||||
function rocket_get_gdpr_dynamic_cookies( $cookies ) {
|
||||
$cookies['gdpr'] = [
|
||||
'allowed_cookies',
|
||||
'consent_types',
|
||||
];
|
||||
return $cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add dynamic cookie when GDPR plugin is activated
|
||||
*
|
||||
* @since 3.1.4
|
||||
* @author jorditarrida
|
||||
*/
|
||||
function rocket_add_gdpr_mandatory_cookies() {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 60 );
|
||||
|
||||
// Create cache version based on value set in GDPR cookies.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_gdpr_dynamic_cookies' );
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'activate_gdpr/gdpr.php', 'rocket_add_gdpr_mandatory_cookies', 11 );
|
||||
|
||||
/**
|
||||
* Remove dynamic cookie when GDPR plugin is deactivated.
|
||||
*
|
||||
* @since 3.1.4
|
||||
* @author jorditarrida
|
||||
*/
|
||||
function rocket_remove_gdpr_mandatory_cookies() {
|
||||
remove_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 60 );
|
||||
|
||||
// Delete the dynamic cookie filter.
|
||||
remove_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_gdpr_dynamic_cookies' );
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'deactivate_gdpr/gdpr.php', 'rocket_remove_gdpr_mandatory_cookies', 11 );
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with UK Cookie Consent.
|
||||
*
|
||||
* @since 3.2
|
||||
* @author TheZoker
|
||||
* @link https://wordpress.org/plugins/uk-cookie-consent/
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( class_exists( 'CTCC_Public' ) ) {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 62 );
|
||||
// Create cache version based on value set in cookie_consent_accepted cookie.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_uk_consent_cookie' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cookie name set by UK Cookie Consent plugin.
|
||||
*
|
||||
* @since 3.2
|
||||
* @author TheZoker
|
||||
*
|
||||
* @param array $cookies List of dynamic cookies.
|
||||
* @return array List of dynamic cookies with the UK Cookie Consent cookie appended.
|
||||
*/
|
||||
function rocket_get_cookie_uk_consent_cookie( $cookies ) {
|
||||
$cookies[] = 'catAccCookies';
|
||||
return $cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add dynamic cookie and mandatory cookie when UK Cookie Consent plugin is activated.
|
||||
*
|
||||
* @since 3.2
|
||||
* @author TheZoker
|
||||
*/
|
||||
function rocket_add_uk_cookie_consent_dynamic_cookie() {
|
||||
add_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 62 );
|
||||
// Create cache version based on value set in cookie_consent_accepted cookie.
|
||||
add_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_uk_consent_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'activate_uk-cookie-consent/uk-cookie-consent.php', 'rocket_add_uk_cookie_consent_dynamic_cookie', 11 );
|
||||
|
||||
/**
|
||||
* Remove dynamic cookie when Cookie Consent plugin is deactivated.
|
||||
*
|
||||
* @since 3.2
|
||||
* @author TheZoker
|
||||
*/
|
||||
function rocket_remove_uk_cookie_consent_dynamic_cookie() {
|
||||
remove_filter( 'rocket_htaccess_mod_rewrite', '__return_false', 62 );
|
||||
remove_filter( 'rocket_cache_dynamic_cookies', 'rocket_get_cookie_uk_consent_cookie' );
|
||||
|
||||
// Update the WP Rocket rules on the .htaccess file.
|
||||
flush_rocket_htaccess();
|
||||
|
||||
// Regenerate the config file.
|
||||
rocket_generate_config_file();
|
||||
|
||||
// Clear WP Rocket cache.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'deactivate_uk-cookie-consent/uk-cookie-consent.php', 'rocket_remove_uk_cookie_consent_dynamic_cookie', 11 );
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Compatibility with WeePie Cookie Allow
|
||||
*
|
||||
* @since 2.9
|
||||
*/
|
||||
if ( class_exists( 'WpieCookieAllow' ) ) :
|
||||
add_action( 'update_option_wpca_settings_general', 'rocket_after_update_wp_cookie_allow_options', 10, 2 );
|
||||
add_action( 'update_option_wpca_settings_style', 'rocket_after_update_wp_cookie_allow_options', 10, 2 );
|
||||
add_action( 'update_option_wpca_settings_content', 'rocket_after_update_wp_cookie_allow_options', 10, 2 );
|
||||
add_action( 'update_option_wpca_settings_consent_log', 'rocket_after_update_wp_cookie_allow_options', 10, 2 );
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Update .htaccess & config files when the "Enabled" and "Autoblock" options are turned on.
|
||||
*
|
||||
* @since 2.9
|
||||
* @author Remy Perona
|
||||
*
|
||||
* @param array $old_value Previous values for the plugin options.
|
||||
* @param array $value New values for the plugin options.
|
||||
*/
|
||||
function rocket_after_update_wp_cookie_allow_options( $old_value, $value ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
||||
// clear the cache because WeePie Cookie Allow plugin settings might have been changed.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cookies when we activate the plugin.
|
||||
*
|
||||
* @since 2.9
|
||||
* @author Remy Perona
|
||||
*/
|
||||
function rocket_activate_wp_cookie_allow() {
|
||||
// clear the cache because plugin might be enabled already before.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'activate_wp-cookie-allow/wp-cookie-allow.php', 'rocket_activate_wp_cookie_allow', 11 );
|
||||
|
||||
/**
|
||||
* Remove cookies when we deactivate the plugin
|
||||
*
|
||||
* @since 2.9
|
||||
* @author Remy Perona
|
||||
*/
|
||||
function rocket_deactivate_wp_cookie_allow() {
|
||||
// clear the cache because the bar/box and other WeePie Cookie Allow plugin frontend HTML is not needed anymore.
|
||||
rocket_clean_domain();
|
||||
}
|
||||
add_action( 'deactivate_wp-cookie-allow/wp-cookie-allow.php', 'rocket_deactivate_wp_cookie_allow', 11 );
|
||||
Reference in New Issue
Block a user