PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.2.2
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.2.2
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 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / src / addons / controller / addons / Base_Cookiebot_Plugin_Addon.php
cookiebot / src / addons / controller / addons Last commit date
add_to_any 3 years ago addthis 4 years ago caos_host_analyticsjs_local 3 years ago custom_facebook_feed 4 years ago custom_facebook_feed_pro 3 years ago embed_autocorrect 3 years ago enfold 4 years ago enhanced_ecommerce_for_woocommerce_store 4 years ago facebook_for_woocommerce 3 years ago ga_google_analytics 3 years ago gadwp 4 years ago google_analyticator 4 years ago google_analytics 4 years ago google_analytics_plus 4 years ago google_site_kit 4 years ago hubspot_leadin 4 years ago hubspot_tracking_code 4 years ago instagram_feed 4 years ago jetpack 3 years ago litespeed_cache 3 years ago matomo 4 years ago ninja_forms 4 years ago official_facebook_pixel 4 years ago optinmonster 4 years ago pixel_caffeine 4 years ago simple_share_buttons_adder 4 years ago wd_google_analytics 4 years ago woocommerce_google_analytics_pro 4 years ago wp_analytify 4 years ago wp_google_analytics_events 3 years ago wp_mautic 3 years ago wp_piwik 4 years ago wp_rocket 3 years ago wp_seopress 4 years ago wpforms 3 years ago Base_Cookiebot_Addon.php 3 years ago Base_Cookiebot_Other_Addon.php 4 years ago Base_Cookiebot_Plugin_Addon.php 4 years ago Base_Cookiebot_Theme_Addon.php 4 years ago
Base_Cookiebot_Plugin_Addon.php
74 lines
1 <?php
2
3 namespace cybot\cookiebot\addons\controller\addons;
4
5 use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
6 use cybot\cookiebot\lib\Cookie_Consent_Interface;
7 use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag_Interface;
8 use cybot\cookiebot\lib\Settings_Service_Interface;
9 use Exception;
10
11 abstract class Base_Cookiebot_Plugin_Addon extends Base_Cookiebot_Addon {
12
13 const PLUGIN_FILE_PATH = '';
14
15 /**
16 * @param $settings Settings_Service_Interface
17 * @param $script_loader_tag Script_Loader_Tag_Interface
18 * @param $cookie_consent Cookie_Consent_Interface
19 * @param $buffer_output Buffer_Output_Interface
20 *
21 * @throws Exception
22 * @since 1.3.0
23 */
24 protected function __construct(
25 Settings_Service_Interface $settings,
26 Script_Loader_Tag_Interface $script_loader_tag,
27 Cookie_Consent_Interface $cookie_consent,
28 Buffer_Output_Interface $buffer_output
29 ) {
30 parent::__construct( $settings, $script_loader_tag, $cookie_consent, $buffer_output );
31 $this->validate_required_string_class_constant( 'PLUGIN_FILE_PATH' );
32 }
33
34 /**
35 * @return bool
36 */
37 final public function is_addon_installed() {
38 $path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . static::PLUGIN_FILE_PATH;
39 return ( file_exists( $path ) && ! is_wp_error( validate_plugin( static::PLUGIN_FILE_PATH ) ) );
40 }
41
42 /**
43 * Checks if addon plugin is activated
44 *
45 * @since 1.3.0
46 */
47 final public function is_addon_activated() {
48 return $this->is_addon_installed() && is_plugin_active( static::PLUGIN_FILE_PATH );
49 }
50
51 /**
52 * @return string
53 * @throws Exception
54 */
55 final public function get_version() {
56 $plugin_data = $this->get_plugin_data();
57 if ( ! isset( $plugin_data['Version'] ) ) {
58 throw new Exception( 'Check if plugin is installed before calling get_version()' );
59 }
60 return $plugin_data['Version'];
61 }
62
63 /**
64 * @return string[]
65 */
66 private function get_plugin_data() {
67 return get_file_data(
68 WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . static::PLUGIN_FILE_PATH,
69 array( 'Version' => 'version' ),
70 false
71 );
72 }
73 }
74