- WP Super Cache enabled (PHP mode, gzip, Nginx compatible) - Autoptimize: CSS/HTML minification + deferred JS + Google Fonts optimization - Cookie Notice: GDPR/LOPD banner styled with brand colors (navy/burgundy/gold) - Legal pages: Aviso Legal, Política de Privacidad, Política de Cookies (ES) - MU-plugin: custom footer with legal links + Cloud Host credit - Footer: copyright, legal nav, Hosted & Maintained by Cloud Host (cloudhost.es) - Security: X-Frame-Options, X-Content-Type, Referrer-Policy headers - Security: XML-RPC disabled, REST user enumeration blocked - Performance: emoji scripts removed, post revisions limited to 3
72 lines
1.8 KiB
PHP
72 lines
1.8 KiB
PHP
<?php
|
|
// exit if accessed directly
|
|
if ( ! defined( 'ABSPATH' ) )
|
|
exit;
|
|
|
|
/**
|
|
* Cookie Notice Modules Autoptimize class.
|
|
*
|
|
* Compatibility since: 2.4.0
|
|
*
|
|
* @class Cookie_Notice_Modules_Autoptimize
|
|
*/
|
|
class Cookie_Notice_Modules_Autoptimize {
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct() {
|
|
// actions
|
|
add_action( 'plugins_loaded', [ $this, 'load_module' ], 11 );
|
|
}
|
|
|
|
/**
|
|
* Add compatibility to Autoptimize plugin.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function load_module() {
|
|
add_filter( 'autoptimize_filter_js_exclude', [ $this, 'exclude' ] );
|
|
}
|
|
|
|
/**
|
|
* Exclude JavaScript files or inline code.
|
|
*
|
|
* @param string $excludes
|
|
* @return string
|
|
*/
|
|
function exclude( $excludes ) {
|
|
if ( empty( $excludes ) )
|
|
$new_excludes = [];
|
|
else {
|
|
$new_excludes = explode( ',', $excludes );
|
|
$new_excludes = array_filter( $new_excludes );
|
|
$new_excludes = array_map( 'trim', $new_excludes );
|
|
}
|
|
|
|
// not found huOptions?
|
|
if ( strpos( $excludes, 'huOptions' ) === false )
|
|
$new_excludes[] = 'huOptions';
|
|
|
|
// get widget url
|
|
$widget_url = basename( Cookie_Notice()->get_url( 'widget' ) );
|
|
|
|
// not found widget url?
|
|
if ( strpos( $excludes, $widget_url ) === false )
|
|
$new_excludes[] = $widget_url;
|
|
|
|
// React admin asset exclusions — see Cookie_Notice::REACT_ADMIN_*.
|
|
// Keeps Autoptimize off our IIFE bundle if its "optimize admin" toggle is on.
|
|
if ( strpos( $excludes, Cookie_Notice::REACT_ADMIN_BUNDLE_BASENAME ) === false )
|
|
$new_excludes[] = Cookie_Notice::REACT_ADMIN_BUNDLE_BASENAME;
|
|
|
|
if ( strpos( $excludes, Cookie_Notice::REACT_ADMIN_INLINE_KEYWORD ) === false )
|
|
$new_excludes[] = Cookie_Notice::REACT_ADMIN_INLINE_KEYWORD;
|
|
|
|
return implode( ', ', $new_excludes );
|
|
}
|
|
}
|
|
|
|
new Cookie_Notice_Modules_Autoptimize(); |