documents
1 year ago
class-config.php
1 year ago
countries.php
1 year ago
index.php
1 year ago
purpose.php
1 year ago
warnings.php
1 year ago
class-config.php
382 lines
| 1 | <?php |
| 2 | defined( 'ABSPATH' ) or die( "you do not have access to this page!" ); |
| 3 | |
| 4 | if ( ! class_exists( "cmplz_config" ) ) { |
| 5 | class cmplz_config { |
| 6 | private static $_this; |
| 7 | public $fields = array(); |
| 8 | public $formal_languages = array(); |
| 9 | public $generic_documents_list; |
| 10 | public $supported_states; |
| 11 | public $cookie_consent_converter; |
| 12 | public $language_codes; |
| 13 | public $supported_regions; |
| 14 | public $thirdparty_services |
| 15 | = array( |
| 16 | 'activecampaign' => 'Active Campaign', |
| 17 | "adobe-fonts" => 'Adobe Fonts', |
| 18 | 'google-fonts' => 'Google Fonts', |
| 19 | 'google-recaptcha' => 'Google reCAPTCHA', |
| 20 | "google-maps" => 'Google Maps', |
| 21 | "openstreetmaps" => 'OpenStreetMaps', |
| 22 | "vimeo" => 'Vimeo', |
| 23 | "youtube" => 'YouTube', |
| 24 | "videopress" => 'VideoPress', |
| 25 | "dailymotion" => 'Dailymotion', |
| 26 | "soundcloud" => 'SoundCloud', |
| 27 | "twitch" => 'Twitch', |
| 28 | "paypal" => 'PayPal', |
| 29 | "spotify" => 'Spotify', |
| 30 | "hotjar" => 'Hotjar', |
| 31 | "addthis" => 'AddThis', |
| 32 | "addtoany" => 'AddToAny', |
| 33 | "sharethis" => 'ShareThis', |
| 34 | "livechat" => 'LiveChat', |
| 35 | "hubspot" => 'HubSpot', |
| 36 | "calendly" => 'Calendly', |
| 37 | "microsoftads" => 'Microsoft Ads' |
| 38 | ); |
| 39 | |
| 40 | public $thirdparty_socialmedia |
| 41 | = array( |
| 42 | 'facebook' => 'Facebook', |
| 43 | 'twitter' => 'Twitter', |
| 44 | 'linkedin' => 'LinkedIn', |
| 45 | 'whatsapp' => 'WhatsApp', |
| 46 | 'instagram' => 'Instagram', |
| 47 | 'tiktok' => 'TikTok', |
| 48 | 'disqus' => 'Disqus', |
| 49 | 'pinterest' => 'Pinterest', |
| 50 | ); |
| 51 | |
| 52 | |
| 53 | |
| 54 | /** |
| 55 | * The services for which a placeholder exists in the assets/images/placeholders folder. |
| 56 | * @var array |
| 57 | */ |
| 58 | public $placeholders; |
| 59 | |
| 60 | /** |
| 61 | * This is used in the scan function to tell the user he/she uses social media |
| 62 | * Also in the function to determine a media type for the placeholders |
| 63 | * Based on this the cookie warning is enabled. |
| 64 | * |
| 65 | * */ |
| 66 | |
| 67 | public $social_media_markers |
| 68 | = array( |
| 69 | "linkedin" => array( |
| 70 | "platform.linkedin.com", |
| 71 | 'addthis_widget.js', |
| 72 | 'linkedin.com/embed/feed' |
| 73 | ), |
| 74 | "twitter" => array( |
| 75 | 'super-socializer', |
| 76 | 'sumoSiteId', |
| 77 | 'addthis_widget.js', |
| 78 | "platform.twitter.com", |
| 79 | 'twitter-widgets.js' |
| 80 | ), |
| 81 | "facebook" => array( |
| 82 | 'fbq', |
| 83 | 'super-socializer', |
| 84 | 'sumoSiteId', |
| 85 | 'addthis_widget.js', |
| 86 | "fb-root", |
| 87 | "<!-- Facebook Pixel Code -->", |
| 88 | 'connect.facebook.net', |
| 89 | 'www.facebook.com/plugins', |
| 90 | 'pixel-caffeine', |
| 91 | 'facebook.com/plugins', |
| 92 | ), |
| 93 | "pinterest" => array( |
| 94 | 'super-socializer', |
| 95 | 'assets.pinterest.com' |
| 96 | ), |
| 97 | "disqus" => array( 'disqus.com' ), |
| 98 | "tiktok" => array( 'tiktok.com' ), |
| 99 | "instagram" => array( |
| 100 | 'instawidget.net/js/instawidget.js', |
| 101 | 'instagram.com', |
| 102 | ), |
| 103 | ); |
| 104 | |
| 105 | /** |
| 106 | * Scripts with this string in the content get listed in the third party list. |
| 107 | * Also used in cmplz_placeholder() |
| 108 | * */ |
| 109 | |
| 110 | public $thirdparty_service_markers |
| 111 | = array( |
| 112 | "google-maps" => array( |
| 113 | 'apis.google.com/js/platform.js', |
| 114 | 'new google.maps.', |
| 115 | 'google.com/maps', |
| 116 | 'maps.google.com', |
| 117 | 'wp-google-maps', |
| 118 | 'new google.maps.InfoWindow', |
| 119 | 'new google.maps.Marker', |
| 120 | 'new google.maps.Map', |
| 121 | 'var mapOptions', |
| 122 | 'var map', |
| 123 | 'var Latlng', |
| 124 | ), |
| 125 | "soundcloud" => array( 'w.soundcloud.com/player' ), |
| 126 | "openstreetmaps" => array( |
| 127 | 'openstreetmap.org', |
| 128 | 'osm/js/osm' |
| 129 | ), |
| 130 | "vimeo" => array( |
| 131 | 'player.vimeo.com', |
| 132 | 'i.vimeocdn.com', |
| 133 | ), |
| 134 | "google-recaptcha" => array( |
| 135 | 'google.com/recaptcha', |
| 136 | 'grecaptcha', |
| 137 | 'recaptcha.js', |
| 138 | 'recaptcha/api' |
| 139 | ), |
| 140 | "youtube" => array( |
| 141 | 'youtube.com', |
| 142 | 'youtube-nocookie.com', |
| 143 | 'youtu.be', |
| 144 | 'yotuwp', |
| 145 | ), |
| 146 | "videopress" => array( |
| 147 | 'videopress.com/embed', |
| 148 | 'videopress.com/videopress-iframe.js' |
| 149 | ), |
| 150 | "dailymotion" => array( 'dailymotion.com/embed/video/' ), |
| 151 | "hotjar" => array( 'static.hotjar.com' ), |
| 152 | "spotify" => array( 'open.spotify.com/embed' ), |
| 153 | "google-fonts" => array( 'fonts.googleapis.com' ), |
| 154 | "paypal" => array( |
| 155 | 'www.paypal.com/tagmanager/pptm.js', |
| 156 | 'www.paypalobjects.com/api/checkout.js' |
| 157 | ), |
| 158 | "disqus" => array( 'disqus.com' ), |
| 159 | "addthis" => array( 'addthis.com' ), |
| 160 | "addtoany" => array( 'static.addtoany.com/menu/page.js' ), |
| 161 | "sharethis" => array( 'sharethis.com' ), |
| 162 | "microsoftads" => array('bat.bing.com'), |
| 163 | "livechat" => array( 'cdn.livechatinc.com/tracking.js' ), |
| 164 | "hubspot" => array( 'js.hs-scripts.com/', 'hbspt.forms.create', 'js.hsforms.net','track.hubspot.com','js.hs-analytics.net'), |
| 165 | "calendly" => array( 'assets.calendly.com' ), |
| 166 | "twitch" => array( 'twitch.tv', 'player.twitch.tv'), |
| 167 | "adobe-fonts" => array( 'p.typekit.net', 'use.typekit.net'), |
| 168 | ); |
| 169 | |
| 170 | public $stats |
| 171 | = array( |
| 172 | 'google-analytics' => 'Google Analytics', |
| 173 | 'google-tag-manager' => 'Tag Manager', |
| 174 | 'matomo' => 'Matomo', |
| 175 | 'clicky' => 'Clicky', |
| 176 | 'yandex' => 'Yandex', |
| 177 | 'clarity' => 'Clarity', |
| 178 | |
| 179 | ); |
| 180 | public $stats_markers = array( |
| 181 | 'google-analytics' => array( |
| 182 | 'google-analytics.com/ga.js', |
| 183 | 'www.google-analytics.com/analytics.js', |
| 184 | '_getTracker', |
| 185 | "gtag('js'", |
| 186 | ), |
| 187 | 'google-tag-manager' => array( |
| 188 | 'gtm.start', |
| 189 | 'gtm.js', |
| 190 | ), |
| 191 | 'matomo' => array( 'piwik.js', 'matomo.js' ), |
| 192 | 'clicky' => array( 'static.getclicky.com/js', 'clicky_site_ids' ), |
| 193 | 'yandex' => array( 'mc.yandex.ru/metrika/watch.js' ), |
| 194 | 'clarity' => array( 'clarity.ms' ), |
| 195 | ); |
| 196 | |
| 197 | public $amp_tags |
| 198 | = array( |
| 199 | 'amp-ad-exit', |
| 200 | 'amp-ad', |
| 201 | 'amp-analytics', |
| 202 | 'amp-auto-ads', |
| 203 | 'amp-call-tracking', |
| 204 | 'amp-experiment', |
| 205 | 'amp-pixel', |
| 206 | 'amp-sticky-ad', |
| 207 | // Dynamic content. |
| 208 | 'amp-google-document-embed', |
| 209 | 'amp-gist', |
| 210 | // Media. |
| 211 | 'amp-brightcove', |
| 212 | 'amp-dailymotion', |
| 213 | 'amp-hulu', |
| 214 | 'amp-soundcloud', |
| 215 | 'amp-vimeo', |
| 216 | 'amp-youtube', |
| 217 | 'amp-iframe', |
| 218 | // Social. |
| 219 | 'amp-addthis', |
| 220 | 'amp-beopinion', |
| 221 | 'amp-facebook-comments', |
| 222 | 'amp-facebook-like', |
| 223 | 'amp-facebook-page', |
| 224 | 'amp-facebook', |
| 225 | 'amp-gfycat', |
| 226 | 'amp-instagram', |
| 227 | 'amp-pinterest', |
| 228 | 'amp-reddit', |
| 229 | 'amp-riddle-quiz', |
| 230 | 'amp-social-share', |
| 231 | 'amp-twitter', |
| 232 | 'amp-vine', |
| 233 | 'amp-vk', |
| 234 | ); |
| 235 | |
| 236 | public $lawful_bases; |
| 237 | |
| 238 | public $sections; |
| 239 | public $pages = array(); |
| 240 | public $warning_types; |
| 241 | public $yes_no; |
| 242 | public $countries; |
| 243 | public $purposes; |
| 244 | public $details_per_purpose_us; |
| 245 | public $regions; |
| 246 | public $eu_countries; |
| 247 | public $collected_info_children; |
| 248 | |
| 249 | function __construct() { |
| 250 | if ( isset( self::$_this ) ) { |
| 251 | wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.', |
| 252 | get_class( $this ) ) ); |
| 253 | } |
| 254 | |
| 255 | self::$_this = $this; |
| 256 | |
| 257 | /** |
| 258 | * The legal version is only updated when document contents or the questions leading to it are changed |
| 259 | * 1: start version |
| 260 | * 2: introduction of US privacy questions |
| 261 | * 3: new questions |
| 262 | * 4: new questions |
| 263 | * 5: UK as separate region |
| 264 | * 6: CA as separate region |
| 265 | * 7: Impressum in germany |
| 266 | * */ |
| 267 | define( 'CMPLZ_LEGAL_VERSION', '8' ); |
| 268 | require_once( cmplz_path . '/config/countries.php' ); |
| 269 | |
| 270 | //common options type |
| 271 | $this->yes_no = array( |
| 272 | 'yes' => __( 'Yes', 'complianz-gdpr' ), |
| 273 | 'no' => __( 'No', 'complianz-gdpr' ), |
| 274 | ); |
| 275 | |
| 276 | $this->lawful_bases = [ |
| 277 | '1' => __('I obtain permission from the person concerned', 'complianz-gdpr'), |
| 278 | '2' => __('It is necessary for the execution of an agreement with the person concerned', 'complianz-gdpr'), |
| 279 | '3' => __('I am obligated by law', 'complianz-gdpr'), |
| 280 | '4' => __('It is necessary to fulfilll a task concerning public law', 'complianz-gdpr'), |
| 281 | '5' => __('It is necessary for my own legitimate interest, and that interest outweighs the interest of the person concerned', 'complianz-gdpr'), |
| 282 | '6' => __('It is necessary to protect the life or physical safety of a person', 'complianz-gdpr'), |
| 283 | ]; |
| 284 | |
| 285 | $this->placeholders = array( |
| 286 | 'default' => __('Default','complianz-gdpr'), |
| 287 | 'calendly' => 'Calendly', |
| 288 | 'facebook' => 'Facebook', |
| 289 | 'google-maps' => 'Google Maps', |
| 290 | 'google-recaptcha' => 'Google Recaptcha', |
| 291 | 'instagram' => 'Instagram', |
| 292 | 'openstreetmaps' => 'Open Street Maps', |
| 293 | 'soundcloud' => 'SoundCloud', |
| 294 | 'spotify' => 'Spotify', |
| 295 | 'ted' => 'Ted', |
| 296 | 'twitter' => 'Twitter', |
| 297 | 'tiktok' => 'Tik Tok' |
| 298 | ); |
| 299 | |
| 300 | require_once( cmplz_path . '/config/purpose.php' ); |
| 301 | require_once( cmplz_path . '/config/documents/documents.php' ); |
| 302 | //always load the fields, for translation purposes etc. |
| 303 | require_once( cmplz_path . 'settings/config/config.php' ); |
| 304 | if ( file_exists(cmplz_path . 'pro/settings/config.php') ) { |
| 305 | require_once( cmplz_path . 'pro/settings/config.php'); |
| 306 | require_once( cmplz_path . 'pro/config/dynamic-document-elements.php'); |
| 307 | } |
| 308 | require_once( cmplz_path . '/cookiebanner/settings.php' ); |
| 309 | |
| 310 | /** |
| 311 | * Preload fields with a filter, to allow for overriding types |
| 312 | */ |
| 313 | add_action( 'plugins_loaded', array( $this, 'init' ), 10 ); |
| 314 | add_action( 'plugins_loaded', array( $this, 'load_pages' ), 10 ); |
| 315 | } |
| 316 | |
| 317 | static function this() { |
| 318 | return self::$_this; |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * Get full array of regions, but only active ones |
| 323 | * @return array |
| 324 | */ |
| 325 | public function active_regions(){ |
| 326 | return array_intersect_key( COMPLIANZ::$config->regions, cmplz_get_regions(false, 'short') ); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | public function init(){ |
| 331 | /** |
| 332 | * For the Brazil privacy law there are some additional options. These should only be enabled when the only chosen region is Brazil. |
| 333 | */ |
| 334 | if ( cmplz_has_region('br') && cmplz_multiple_regions() == false) { |
| 335 | $this->lawful_bases['7'] = __('It is necessary to carry out studies by a research body, ensuring, whenever possible, the anonymization of personal data', 'complianz-gdpr'); |
| 336 | $this->lawful_bases['8'] = __('It is necessary for the regular exercise of rights in judicial, administrative or arbitration proceedings', 'complianz-gdpr'); |
| 337 | $this->lawful_bases['9'] = __('It is necessary for the protection of health, exclusively, in a procedure performed by health professionals, health services or health authority', 'complianz-gdpr'); |
| 338 | $this->lawful_bases['10'] = __('It is necessary for credit protection', 'complianz-gdpr'); |
| 339 | } |
| 340 | $files = []; |
| 341 | $regions = cmplz_get_regions(); |
| 342 | $privacy_statement = cmplz_get_option( 'privacy-statement' ) === 'generated'; |
| 343 | $files[] = '/pro/config/documents/documents.php'; |
| 344 | foreach ($regions as $region) { |
| 345 | $files[] = "/config/documents/cookie-policy-$region.php"; |
| 346 | if ($privacy_statement) $files[] = "/pro/config/documents/$region/privacy-policy.php"; |
| 347 | $files[] = "/pro/config/documents/$region/privacy-policy-children.php"; |
| 348 | } |
| 349 | |
| 350 | if (cmplz_get_option( 'disclaimer' ) === 'generated') $files[] = '/pro/config/documents/disclaimer.php'; |
| 351 | if (cmplz_get_option( 'impressum' ) === 'generated') $files[] = '/pro/config/documents/impressum.php'; |
| 352 | |
| 353 | foreach ($files as $file) { |
| 354 | if ( file_exists( cmplz_path . $file ) ) { |
| 355 | require_once( cmplz_path . $file ); |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | $this->stats_markers = apply_filters( 'cmplz_stats_markers', $this->stats_markers ); |
| 360 | //ensure that indexes are sequential with array_values |
| 361 | $this->fields = array_values(apply_filters( 'cmplz_fields', [] )); |
| 362 | } |
| 363 | |
| 364 | public function load_pages(){ |
| 365 | $this->pages = apply_filters( 'cmplz_pages_load_types', $this->pages ); |
| 366 | $regions = cmplz_get_regions(); |
| 367 | foreach ($regions as $region) { |
| 368 | if ( !isset( $this->pages[ $region ] ) ) { |
| 369 | continue; |
| 370 | } |
| 371 | foreach ( $this->pages[ $region ] as $type => $data ) { |
| 372 | if ( !isset( $this->pages[ $region ][ $type ]['document_elements'] ) ) { |
| 373 | continue; |
| 374 | } |
| 375 | $this->pages[ $region ][ $type ]['document_elements'] = apply_filters( 'cmplz_document_elements', $this->pages[ $region ][ $type ]['document_elements'], $region, $type, $this->fields ); |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | } //class closure |
| 381 | } |
| 382 |