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
2 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
2 years ago
litespeed_cache
3 years ago
matomo
4 years ago
ninja_forms
4 years ago
official_facebook_pixel
3 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
3 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
2 years ago
wpforms_pro
2 years ago
Base_Cookiebot_Addon.php
3 years ago
Base_Cookiebot_Other_Addon.php
4 years ago
Base_Cookiebot_Plugin_Addon.php
3 years ago
Base_Cookiebot_Theme_Addon.php
3 years ago
Base_Cookiebot_Theme_Addon.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace cybot\cookiebot\addons\controller\addons; |
| 4 | |
| 5 | use cybot\cookiebot\exceptions\addons\InstallationException; |
| 6 | |
| 7 | abstract class Base_Cookiebot_Theme_Addon extends Base_Cookiebot_Addon { |
| 8 | |
| 9 | /** |
| 10 | * @return bool |
| 11 | */ |
| 12 | final public function is_addon_installed() { |
| 13 | return wp_get_theme( static::ADDON_NAME )->exists(); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * @return bool |
| 18 | */ |
| 19 | final public function is_addon_activated() { |
| 20 | $addon = strtolower( static::ADDON_NAME ); |
| 21 | |
| 22 | $addon_theme = wp_get_theme( $addon ); |
| 23 | $addon_theme_name = strtolower( $addon_theme->get( 'Name' ) ); |
| 24 | $active_theme = wp_get_theme(); |
| 25 | if ( $addon_theme_name === strtolower( $active_theme->get( 'Name' ) ) ) { |
| 26 | return true; |
| 27 | } |
| 28 | |
| 29 | $active_theme_parent = $active_theme->parent(); |
| 30 | if ( $active_theme_parent !== false && $addon_theme_name === strtolower( $active_theme_parent->get( 'Name' ) ) ) { |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | return false; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @return string |
| 39 | * @throws InstallationException |
| 40 | */ |
| 41 | final public function get_version() { |
| 42 | $theme = wp_get_theme( static::ADDON_NAME ); |
| 43 | if ( ! $theme->exists() ) { |
| 44 | throw new InstallationException( 'Check if theme is installed before calling get_version()' ); |
| 45 | } |
| 46 | return $theme->get( 'Version' ); |
| 47 | } |
| 48 | } |
| 49 |