PluginProbe
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.7.5
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.7.5
4.7.4 4.7.5 4.7.3 4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 All 95 releases
cookiebot / src / addons / controller / addons / wp_rocket / Wp_Rocket.php

Wp_Rocket.php in Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode 4.7.5, at src/addons/controller/addons/wp_rocket/Wp_Rocket.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace cybot\cookiebot\addons\controller\addons\wp_rocket;
4
5 use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
6
7 class Wp_Rocket extends Base_Cookiebot_Plugin_Addon {
8
9
10 const ADDON_NAME = 'WP Rocket';
11 const OPTION_NAME = 'wp_rocket';
12 const PLUGIN_FILE_PATH = 'wp-rocket/wp-rocket.php';
13 const DEFAULT_COOKIE_TYPES = array( 'statistics' );
14 const ENABLE_ADDON_BY_DEFAULT = true;
15
16 /**
17 * Loads addon configuration
18 *
19 * @since 1.3.0
20 */
21 public function load_addon_configuration() {
22 /**
23 * Exclude Cookiebot files from defer setting
24 */
25 add_filter( 'rocket_exclude_defer_js', array( $this, 'exclude_files' ) );
26 }
27
28 /**
29 * Exclude scripts from WP Rocket’s defer JS option.
30 *
31 * @param array $excluded_files Array of script URLs to be excluded
32 *
33 * @return array Extended array script URLs to be excluded
34 *
35 * @author Caspar Hübinger
36 * @since 3.6.2
37 */
38 public function exclude_files( $excluded_files = array() ) {
39 $excluded_files[] = 'consent.cookiebot.com';
40
41 return $excluded_files;
42 }
43
44 /**
45 * @return array
46 */
47 public function get_extra_information() {
48 return array(
49 __(
50 'Excludes cookiebot javascript files when the WP-Rocket deter option is enabled.',
51 'cookiebot'
52 ),
53 );
54 }
55 }
56