enrich
2 years ago
events
2 years ago
formEvents
2 years ago
logger
2 years ago
views
2 years ago
class-custom-event-factory.php
7 years ago
class-custom-event.php
2 years ago
class-event-id-generator.php
5 years ago
class-events-manager-ajax_hook.php
2 years ago
class-events-manager.php
2 years ago
class-fixed-notices.php
2 years ago
class-pixel.php
7 years ago
class-plugin-updater.php
2 years ago
class-plugin.php
7 years ago
class-pys.php
2 years ago
class-settings.php
2 years ago
functions-admin.php
2 years ago
functions-common.php
2 years ago
functions-custom-event.php
2 years ago
functions-edd.php
2 years ago
functions-gdpr.php
2 years ago
functions-license.php
2 years ago
functions-migrate.php
2 years ago
functions-optin.php
2 years ago
functions-promo-notices.php
3 years ago
functions-system-report.php
7 years ago
functions-update-plugin.php
6 years ago
functions-woo.php
2 years ago
options_defaults.json
2 years ago
options_fields.json
2 years ago
functions-gdpr.php
165 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PixelYourSite; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | exit; // Exit if accessed directly. |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * ConsentMagic |
| 11 | */ |
| 12 | function isConsentMagicPluginActivated() { |
| 13 | |
| 14 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 15 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 16 | } |
| 17 | |
| 18 | return (is_plugin_active( 'consent-magic-pro/consent-magic-pro.php' ) || is_plugin_active( 'consent-magic/consent-magic.php' )) ; |
| 19 | } |
| 20 | function isConsentMagicPluginInstalled() { |
| 21 | |
| 22 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 23 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 24 | } |
| 25 | $installed_plugins = get_plugins(); |
| 26 | $plugin_slug = 'consent-magic/consent-magic.php'; |
| 27 | $plugin_slug_pro = "consent-magic-pro/consent-magic-pro.php"; |
| 28 | |
| 29 | return |
| 30 | array_key_exists( $plugin_slug, $installed_plugins ) || |
| 31 | in_array( $plugin_slug, $installed_plugins, true ) || |
| 32 | array_key_exists( $plugin_slug_pro, $installed_plugins ) || |
| 33 | in_array( $plugin_slug_pro, $installed_plugins, true ); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | function isConsentMagicPluginLicenceActivated() { |
| 38 | $id = get_option('cs_product_id'); |
| 39 | if($id && get_option('wc_am_client_'.$id.'_activated') == 'Activated' || is_plugin_active( 'consent-magic/consent-magic.php')) { |
| 40 | return true; |
| 41 | } |
| 42 | return false; |
| 43 | } |
| 44 | /** |
| 45 | * @link https://wordpress.org/plugins/ginger/ |
| 46 | */ |
| 47 | function isGingerPluginActivated() { |
| 48 | |
| 49 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 50 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 51 | } |
| 52 | |
| 53 | return is_plugin_active( 'ginger/ginger-eu-cookie-law.php' ); |
| 54 | |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @link https://wordpress.org/plugins/cookiebot/ |
| 59 | * @link https://www.cookiebot.com/en/developer/ |
| 60 | */ |
| 61 | function isCookiebotPluginActivated() { |
| 62 | |
| 63 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 64 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 65 | } |
| 66 | |
| 67 | return is_plugin_active( 'cookiebot/cookiebot.php' ); |
| 68 | |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @link https://wordpress.org/plugins/cookie-notice/ |
| 73 | */ |
| 74 | function isCookieNoticePluginActivated() { |
| 75 | |
| 76 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 77 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 78 | } |
| 79 | |
| 80 | return is_plugin_active( 'cookie-notice/cookie-notice.php' ); |
| 81 | |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * GDPR Cookie Consent |
| 86 | * |
| 87 | * @link https://wordpress.org/plugins/cookie-law-info/ |
| 88 | */ |
| 89 | function isCookieLawInfoPluginActivated() { |
| 90 | |
| 91 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 92 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 93 | } |
| 94 | |
| 95 | return is_plugin_active( 'cookie-law-info/cookie-law-info.php' ) |
| 96 | || is_plugin_active( 'webtoffee-gdpr-cookie-consent/cookie-law-info.php' ) ; |
| 97 | |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * GDPR Real Cookie Banner |
| 102 | * |
| 103 | * @link https://wordpress.org/plugins/real-cookie-banner/ |
| 104 | */ |
| 105 | function isRealCookieBannerPluginActivated() { |
| 106 | |
| 107 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 108 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 109 | } |
| 110 | |
| 111 | return is_plugin_active( 'real-cookie-banner-pro/index.php' ) |
| 112 | || is_plugin_active( 'real-cookie-banner/index.php' ) ; |
| 113 | |
| 114 | } |
| 115 | |
| 116 | function adminGdprAjaxNotEnabledNotice() { |
| 117 | $user_id = get_current_user_id(); |
| 118 | $url = buildAdminUrl( 'pixelyoursite', 'gdpr', false, array( |
| 119 | '_wpnonce' => wp_create_nonce( 'pys_enable_gdpr_ajax' ), |
| 120 | 'pys' => array( |
| 121 | 'enable_gdpr_ajax' => true, |
| 122 | ), |
| 123 | ) ); |
| 124 | |
| 125 | $meta_key = 'pys_core_gdpr_ajax_notice_dismissed_at'; |
| 126 | $dismissed_at = get_user_meta( $user_id, $meta_key ); |
| 127 | if(!$dismissed_at){ |
| 128 | ?> |
| 129 | |
| 130 | <div class="notice notice-error is-dismissible pys_core_gdpr_ajax_notice"> |
| 131 | <p>You use the <strong>GDPR Cookie Consent</strong> and <strong>PixelYourSite</strong> plugins. You |
| 132 | must turn on "Enable AJAX filter values update" option to avoid problems with cache plugins. |
| 133 | <a href="<?php echo esc_url( $url ); ?>"><strong>CLICK HERE TO |
| 134 | ENABLE</strong></a>.</p> |
| 135 | </div> |
| 136 | |
| 137 | <script type="application/javascript"> |
| 138 | jQuery(document).on('click', '.pys_core_gdpr_ajax_notice .notice-dismiss', function () { |
| 139 | |
| 140 | jQuery.ajax({ |
| 141 | url: ajaxurl, |
| 142 | data: { |
| 143 | action: 'pys_notice_dismiss', |
| 144 | nonce: '<?php esc_attr_e( wp_create_nonce( 'pys_notice_dismiss' ) ); ?>', |
| 145 | user_id: '<?php esc_attr_e( $user_id ); ?>', |
| 146 | addon_slug: 'core', |
| 147 | meta_key: 'gdpr_ajax_notice' |
| 148 | } |
| 149 | }) |
| 150 | |
| 151 | }) |
| 152 | </script> |
| 153 | <?php |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | function adminGdprAjaxEnabledNotice() { |
| 158 | ?> |
| 159 | |
| 160 | <div class="notice notice-success"> |
| 161 | <p>All good :)</p> |
| 162 | </div> |
| 163 | |
| 164 | <?php |
| 165 | } |