PluginProbe ʕ •ᴥ•ʔ
Complianz – GDPR/CCPA Cookie Consent / 7.5.0
Complianz – GDPR/CCPA Cookie Consent v7.5.0
7.5.0 7.4.7 7.4.6 trunk 6.5.6 7.0.4 7.0.5 7.1.0 7.1.4 7.1.5 7.2.0 7.3.0 7.3.1 7.4.0 7.4.0.1 7.4.1 7.4.2 7.4.3 7.4.4 7.4.4.1 7.4.4.2 7.4.5 beta
complianz-gdpr / integrations / integrations.php
complianz-gdpr / integrations Last commit date
admin 1 year ago plugins 5 days ago services 3 months ago statistics 7 months ago wordpress 1 year ago forms.php 2 years ago index.php 2 years ago integrations.php 3 months ago
integrations.php
907 lines
1 <?php
2 defined( 'ABSPATH' ) || die( "you do not have access to this page!" );
3 if ( cmplz_admin_logged_in() ) {
4 require_once( 'admin/integrations.php' );
5 }
6 require_once( trailingslashit(CMPLZ_PATH) . 'integrations/forms.php' );
7
8 global $cmplz_integrations_list;
9 $cmplz_integrations_list = apply_filters( 'cmplz_integrations', array(
10 'advanced-nocaptcha-recaptcha' => array(
11 'constant_or_function' => 'ANR_PLUGIN_VERSION',
12 'label' => 'Advanced noCaptcha & invisible Captcha',
13 'firstparty_marketing' => false,
14 ),
15
16 'advanced-ads' => array(
17 'constant_or_function' => 'ADVADS_VERSION',
18 'label' => 'Advanced Ads',
19 'firstparty_marketing' => false,
20 ),
21
22 // 'hcaptcha' => array(
23 // 'constant_or_function' => 'HCAPTCHA_VERSION',
24 // 'label' => 'hCaptcha for WordPress',
25 // 'firstparty_marketing' => false,
26 // ),
27
28
29 'wp-consent-api' => array(
30 'constant_or_function' => 'WP_CONSENT_API_VERSION',
31 'label' => 'WP Consent API',
32 'firstparty_marketing' => false,
33 ),
34
35 'omnisend' => array(
36 'constant_or_function' => 'OMNISEND_SETTINGS_PAGE',
37 'label' => 'Email Marketing for WooCommerce by Omnisend',
38 'firstparty_marketing' => false,
39 ),
40
41 'bb-powerpack' => array(
42 'constant_or_function' => 'BB_PowerPack',
43 'label' => 'Beaver Builder Power Pack',
44 'firstparty_marketing' => false,
45 ),
46 'content-views-plugin' => array(
47 'constant_or_function' => 'PT_CV_VERSION',
48 'label' => 'Content Views – Post Grid & Filter for WordPress',
49 'firstparty_marketing' => false,
50 ),
51 'divi' => array(
52 'constant_or_function' => 'Divi',
53 'label' => 'Divi',
54 'firstparty_marketing' => false,
55 ),
56 'divi-plugin' => array(
57 'constant_or_function' => 'ET_BUILDER_PLUGIN_DIR',
58 'label' => 'Divi Plugin',
59 'firstparty_marketing' => false,
60 ),
61 'agile-store-locator' => array(
62 'constant_or_function' => 'ASL_PLUGIN_PATH',
63 'label' => 'Agile Store Locator',
64 'firstparty_marketing' => false,
65 ),
66 'lead-forensics' => array(
67 'constant_or_function' => 'LFRTrackingCode',
68 'label' => 'Lead Forensics',
69 'firstparty_marketing' => false,
70 ),
71
72 'mailchimp-woocommerce' => array(
73 'constant_or_function' => 'MAILCHIMP_WOOCOMMERCE_NEWSLETTER_VERSION',
74 'label' => 'Mailchimp for Woocommerce',
75 'firstparty_marketing' => false,
76 ),
77
78 'burst-statistics' => array(
79 'constant_or_function' => 'burst_version',
80 'label' => 'Burst Statistics',
81 'firstparty_marketing' => false,
82 ),
83 'beaver-builder' => array(
84 'constant_or_function' => 'FL_BUILDER_VERSION',
85 'label' => 'Beaver Builder',
86 'firstparty_marketing' => false,
87 ),
88
89 'theeventscalendar' => array(
90 'constant_or_function' => 'TRIBE_EVENTS_FILE',
91 'label' => 'The Events Calendar',
92 'firstparty_marketing' => false,
93 ),
94
95 'themify-builder' => array(
96 'constant_or_function' => 'themify_builder_theme_check',
97 'label' => 'Themify Builder',
98 'firstparty_marketing' => false,
99 ),
100
101 'meks-easy-maps' => array(
102 'constant_or_function' => 'MKS_MAP_VER',
103 'label' => 'Meks Easy Maps',
104 'firstparty_marketing' => false,
105 ),
106
107 'wp-video-lightbox' => array(
108 'constant_or_function' => 'WP_VIDEO_LIGHTBOX_VERSION',
109 'label' => 'WP Video Lightbox',
110 'firstparty_marketing' => false,
111 ),
112
113 'woocommerce-variation-swatches' => array(
114 'constant_or_function' => 'woo_variation_swatches',
115 'label' => 'Variation Swatches for WooCommerce',
116 'firstparty_marketing' => false,
117 ),
118 /*
119 'ultimate-addons-elementor' => array(
120 'constant_or_function' => 'UAEL_FILE',
121 'label' => 'Ultimate Addons for Elementor - Google Maps',
122 'firstparty_marketing' => false,
123 ),
124 */
125 'invisible-recaptcha' => array(
126 'constant_or_function' => 'InvisibleReCaptcha',
127 'label' => 'Google Invisible reCaptcha voor WordPress',
128 'firstparty_marketing' => false,
129 ),
130
131 'easy-fancybox' => array(
132 'constant_or_function' => 'EASY_FANCYBOX_VERSION',
133 'label' => 'Easy FancyBox',
134 'firstparty_marketing' => false,
135 ),
136
137 'novo-map' => array(
138 'constant_or_function' => 'NOVO_MAP_VERSION',
139 'label' => 'Novo-Map',
140 'firstparty_marketing' => false,
141 ),
142
143 'wpadverts' => array(
144 'constant_or_function' => 'ADVERTS_PATH',
145 'label' => 'WP Adverts',
146 'firstparty_marketing' => false,
147 ),
148
149 'citadela-directory' => array(
150 'constant_or_function' => 'CITADELA_DIRECTORY_LITE_PLUGIN',
151 'label' => 'Citadela Directory',
152 'firstparty_marketing' => false,
153 ),
154
155 'elementor' => array(
156 'constant_or_function' => 'ELEMENTOR_VERSION',
157 'label' => 'Elementor',
158 'firstparty_marketing' => false,
159 ),
160
161 'elementor-pro/elementor-pro' => array(
162 'constant_or_function' => 'ELEMENTOR_PRO_VERSION',
163 'label' => 'Elementor Pro',
164 'firstparty_marketing' => false,
165 ),
166
167 'nudgify' => array(
168 'constant_or_function' => 'NUDGIFY_PLUGIN_VERSION',
169 'label' => 'Nudgify',
170 'firstparty_marketing' => false,
171 ),
172
173 'generatepress-maps' => array(
174 'constant_or_function' => 'GeneratePress',
175 'label' => 'GeneratePress Maps',
176 'firstparty_marketing' => false,
177 ),
178
179 'avada-maps' => array(
180 'constant_or_function' => 'FUSION_BUILDER_VERSION',
181 'label' => 'Avada Fusion Builder',
182 'firstparty_marketing' => false,
183 ),
184
185 'volocation' => array(
186 'constant_or_function' => 'VOSL_VERSION',
187 'label' => 'VO Locator',
188 'firstparty_marketing' => false,
189 ),
190
191 'trustpulse' => array(
192 'constant_or_function' => 'TRUSTPULSE_PLUGIN_VERSION',
193 'label' => 'TrustPulse',
194 'firstparty_marketing' => false,
195 ),
196
197 'addtoany' => array(
198 'constant_or_function' => 'A2A_SHARE_SAVE_init',
199 'label' => 'Add To Any',
200 'firstparty_marketing' => false,
201 ),
202
203 'amp' => array(
204 'constant_or_function' => 'AMP__VERSION',
205 'label' => 'AMP (official AMP plugin for WordPress)',
206 'firstparty_marketing' => false,
207 ),
208
209 'podcast-player' => array(
210 'constant_or_function' => 'PODCAST_PLAYER_VERSION',
211 'label' => 'Podcast Player',
212 'firstparty_marketing' => false,
213 ),
214
215 'google-maps-easy' => array(
216 'constant_or_function' => 'toeGetClassNameGmp',
217 'label' => 'Google Maps Easy',
218 'firstparty_marketing' => false,
219 ),
220
221 'flexible-map' => array(
222 'constant_or_function' => 'FLXMAP_PLUGIN_VERSION',
223 'label' => 'Flexible Map',
224 'firstparty_marketing' => false,
225 ),
226
227 'activecampaign' => array(
228 'constant_or_function' => 'ACTIVECAMPAIGN_URL',
229 'label' => 'Active Campaign',
230 'firstparty_marketing' => true,
231 ),
232
233 'google-site-kit' => array(
234 'constant_or_function' => 'GOOGLESITEKIT_VERSION',
235 'label' => 'Google Site Kit',
236 ),
237
238 'clarity' => array(
239 'constant_or_function' => 'clarity_register_settings',
240 'label' => 'Microsoft Clarity',
241 ),
242
243 'beehive' => array(
244 'constant_or_function' => 'BEEHIVE_PRO',
245 'label' => 'Beehive',
246 'firstparty_marketing' => false,
247 ),
248 'easy-liveblogs' => array(
249 'constant_or_function' => 'ELB_NAME',
250 'label' => 'Easy Liveblogs',
251 'firstparty_marketing' => false,
252 ),
253
254 'simple-business-directory' => array(
255 'constant_or_function' => 'QCSBD_DIR',
256 'label' => 'Simple Business Directory',
257 'firstparty_marketing' => false,
258 ),
259
260 'acf' => array(
261 'constant_or_function' => 'ACF_VERSION',
262 'label' => 'Advanced Custom Fields',
263 'firstparty_marketing' => false,
264 ),
265
266 'pixelyoursite' => array(
267 'constant_or_function' => 'PYS_FREE_VERSION',
268 'label' => 'PixelYourSite',
269 'firstparty_marketing' => false,
270 ),
271
272 'pixelyoursite-pro' => array(
273 'constant_or_function' => 'PYS_VERSION',
274 'label' => 'PixelYourSite Pro',
275 'firstparty_marketing' => false,
276 ),
277
278 'pixelyoursite-pinterest' => array(
279 'constant_or_function' => 'PYS_PINTEREST_VERSION',
280 'label' => 'PixelYourSite Pinterest',
281 'firstparty_marketing' => false,
282 ),
283
284 'pixelyoursite-bing' => array(
285 'constant_or_function' => 'PYS_BING_VERSION',
286 'label' => 'PixelYourSite Bing',
287 'firstparty_marketing' => false,
288 ),
289
290 'weglot-translate' => array(
291 'constant_or_function' => 'WEGLOT_VERSION',
292 'label' => 'Weglot Translate',
293 'firstparty_marketing' => false,
294 ),
295
296 'colibriwp' => array(
297 'constant_or_function' => 'COLIBRI_PAGE_BUILDER_VERSION',
298 'label' => 'ColibriWP Page Builder',
299 'firstparty_marketing' => false,
300 ),
301
302 'user-registration' => array(
303 'constant_or_function' => 'UR',
304 'label' => 'User Registration',
305 'firstparty_marketing' => false,
306 ),
307
308 'user-registration-pro' => array(
309 'constant_or_function' => 'User_Registration_Pro_Shortcodes',
310 'label' => 'User Registration Pro',
311 'firstparty_marketing' => false,
312 ),
313
314 'contact-form-7' => array(
315 'constant_or_function' => 'WPCF7_VERSION',
316 'label' => 'Contact Form 7',
317 'firstparty_marketing' => false,
318 ),
319
320 'disable-and-remove-google-fonts' => array(
321 'constant_or_function' => 'drgf_dequeueu_fonts',
322 'label' => 'Disable and remove Google Fonts',
323 'firstparty_marketing' => false,
324 ),
325 'embed-google-fonts' => array(
326 'constant_or_function' => 'Embed_Google_Fonts_Proxy',
327 'label' => 'Embed Google Fonts',
328 'firstparty_marketing' => false,
329 ),
330
331 'omgf' => array(
332 'constant_or_function' => 'OMGF_PLUGIN_DIR',
333 'label' => 'OMGF',
334 'firstparty_marketing' => false,
335 ),
336 'local-google-fonts' => array(
337 'constant_or_function' => 'LGF_PLUGIN_FILE',
338 'label' => 'Local Google Fonts',
339 'firstparty_marketing' => false,
340 ),
341 'olympus-google-fonts' => array(
342 'constant_or_function' => 'ogf_initiate',
343 'label' => 'Fonts Plugin | Google Fonts Typography',
344 'firstparty_marketing' => false,
345 ),
346 'use-any-font' => array(
347 'constant_or_function' => 'UAF_FILE_PATH',
348 'label' => 'Use Any Font',
349 'firstparty_marketing' => false,
350 ),
351
352 'facebook-for-wordpress' => array(
353 'constant_or_function' => 'FacebookPixelPlugin\\FacebookForWordpress',
354 'label' => 'Official Facebook Pixel',
355 'firstparty_marketing' => false,
356 ),
357
358 'facebook-for-woocommerce' => array(
359 'constant_or_function' => 'facebook_for_woocommerce',
360 'label' => 'Facebook for WooCommerce',
361 'firstparty_marketing' => false,
362 ),
363
364 'google-tagmanager-for-wordpress' => array(
365 'constant_or_function' => 'GTM4WP_VERSION',
366 'label' => 'Google Tag Manager for WordPress',
367 'firstparty_marketing' => false,
368 ),
369
370 'jetpack' => array(
371 'constant_or_function' => 'JETPACK__VERSION',
372 'label' => 'JetPack',
373 'firstparty_marketing' => false,
374 ),
375
376 'g1-gmaps' => array(
377 'constant_or_function' => 'G1_GMaps',
378 'label' => 'G1 GMAPS',
379 'firstparty_marketing' => false,
380 ),
381
382 'monsterinsights' => array(
383 'constant_or_function' => 'MonsterInsights',
384 'label' => 'MonsterInsights',
385 'firstparty_marketing' => false,
386 ),
387
388 'map-multi-marker' => array(
389 'constant_or_function' => 'MapMultiMarker',
390 'label' => 'Map Multi Marker',
391 'firstparty_marketing' => false,
392 ),
393
394 'caos-host-analytics-local' => array(
395 'constant_or_function' => 'CAOS_STATIC_VERSION',
396 'label' => 'CAOS host analytics locally',
397
398 'firstparty_marketing' => false,
399 ),
400 'wp-google-maps' => array(
401 'constant_or_function' => 'WPGMZA_VERSION',
402 'label' => 'WP Go Maps',
403 'firstparty_marketing' => false,
404 ),
405 'wp-google-map-plugin' => array(
406 'constant_or_function' => 'WPGMP_VERSION',
407 'label' => 'WP Google Map Plugin',
408 'firstparty_marketing' => false,
409 ),
410 'woocommerce-google-analytics-pro' => array(
411 'constant_or_function' => 'WC_Google_Analytics_Pro_Loader',
412 'label' => 'Woocommerce Google Analytics Pro',
413 'firstparty_marketing' => false,
414 ),
415 'woocommerce-google-analytics-integration' => array(
416 'constant_or_function' => 'WC_Google_Analytics_Integration',
417 'label' => 'Woocommerce Google Analytics Integration',
418 'firstparty_marketing' => false,
419 ),
420 'woocommerce' => array(
421 'constant_or_function' => 'WC_PLUGIN_FILE',
422 'label' => 'WooCommerce',
423 'firstparty_marketing' => false,
424 ),
425
426 'geo-my-wp' => array(
427 'constant_or_function' => 'GMW_VERSION',
428 'label' => 'Geo My WP',
429 'firstparty_marketing' => false,
430 ),
431
432 'google-analytics-dashboard-for-wp' => array(
433 'constant_or_function' => 'EXACTMETRICS_VERSION',
434 'label' => 'ExactMetrics',
435 'firstparty_marketing' => false,
436 ),
437
438 'wp-google-maps-widget' => array(
439 'constant_or_function' => 'GMW_PLUGIN_DIR',
440 'label' => 'Maps Widget for Google Maps',
441 'firstparty_marketing' => false,
442 ),
443
444 'wp-donottrack' => array(
445 'constant_or_function' => 'wp_donottrack_config',
446 'label' => 'WP Do Not Track',
447 'firstparty_marketing' => false,
448 ),
449
450 'pixel-caffeine' => array(
451 'constant_or_function' => 'AEPC_PIXEL_VERSION',
452 'label' => 'Pixel Caffeine',
453 'firstparty_marketing' => false,
454 ),
455
456 'rate-my-post' => array(
457 'constant_or_function' => 'RATE_MY_POST_VERSION',
458 'label' => 'Rate My Post',
459 'firstparty_marketing' => false,
460 ),
461
462 'super-socializer' => array(
463 'constant_or_function' => 'THE_CHAMP_SS_VERSION',
464 'label' => 'Super Socializer',
465 'firstparty_marketing' => false,
466 ),
467
468 'tidio-live-chat' => array(
469 'constant_or_function' => 'TIDIOCHAT_VERSION',
470 'label' => 'Tidio Live Chat',
471 'firstparty_marketing' => false,
472 ),
473
474 'sumo' => array(
475 'constant_or_function' => 'SUMOME__PLUGIN_DIR',
476 'label' => 'Sumo – Boost Conversion and Sales',
477 'firstparty_marketing' => false,
478 ),
479
480 'wpforms' => array(
481 'constant_or_function' => 'wpforms',
482 'label' => 'WP Forms',
483 'firstparty_marketing' => false,
484 ),
485
486 'wp-rocket' => array(
487 'constant_or_function' => 'WP_ROCKET_VERSION',
488 'label' => 'WP Rocket',
489 'firstparty_marketing' => false,
490 ),
491
492 'uncode' => array(
493 'constant_or_function' => 'UncodeCore_Plugin',
494 'label' => 'Uncode Google Maps',
495 'firstparty_marketing' => false,
496 ),
497
498 'forminator' => array(
499 'constant_or_function' => 'FORMINATOR_VERSION',
500 'label' => 'Forminator',
501 'early_load' => 'forminator-addon-registration.php',
502 'callback_condition' => array(
503 'regions' => array( 'eu', 'uk', 'za'),
504 ),
505 'firstparty_marketing' => false,
506
507 ),
508
509 'happyforms' => array(
510 'constant_or_function' => 'HAPPYFORMS_VERSION',
511 'label' => 'Happy Forms',
512 'firstparty_marketing' => false,
513 ),
514
515 'lazy-loader' => array(
516 'constant_or_function' => 'FlorianBrinkmann\LazyLoadResponsiveImages\Plugin',
517 'label' => 'Lazy Loader',
518 'firstparty_marketing' => false,
519 ),
520
521 'osm' => array(
522 'constant_or_function' => 'OSM_PLUGIN_URL',
523 'label' => 'OSM - OpenStreetMap',
524 'firstparty_marketing' => false,
525 ),
526
527 'primavera' => array(
528 'constant_or_function' => 'Primavera',
529 'label' => 'Primavera Theme',
530 'firstparty_marketing' => false,
531 ),
532
533 'so-widgets-bundle' => array(
534 'constant_or_function' => 'SOW_BUNDLE_VERSION',
535 'label' => 'SiteOrigin Widgets Bundle',
536 'firstparty_marketing' => false,
537 ),
538
539 'superfly-menu' => array(
540 'constant_or_function' => 'SFM_VERSION_KEY',
541 'label' => 'Superfly Menu',
542 'firstparty_marketing' => false,
543 ),
544
545 'wp-store-locator' => array(
546 'constant_or_function' => 'WPSL_VERSION_NUM',
547 'label' => 'WP Store Locator',
548 'firstparty_marketing' => false,
549 ),
550 'thrive' => array(
551 'constant_or_function' => 'Thrive_Product_Manager',
552 'label' => 'Thrive',
553 'firstparty_marketing' => false,
554 ),
555 'gravity-forms' => array(
556 'constant_or_function' => 'GF_MIN_WP_VERSION',
557 'label' => 'Gravity Forms',
558 'firstparty_marketing' => false,
559 ),
560 'qtranslate' => array(
561 'constant_or_function' => 'QTX_VERSION',
562 'label' => 'qTranslate-XT',
563 'firstparty_marketing' => false,
564 ),
565 'welaunch-store-locator' => array(
566 'constant_or_function' => 'run_WordPress_Store_Locator',
567 'label' => 'WeLaunch Store Locator',
568 'firstparty_marketing' => false,
569 ),
570 'presto-player' => array(
571 'constant_or_function' => 'PRESTO_PLAYER_PLUGIN_FILE',
572 'label' => 'Presto Player',
573 'firstparty_marketing' => false,
574 ),
575 'yotu-wp' => array(
576 'constant_or_function' => 'YOTUWP_VERSION',
577 'label' => 'Video Gallery – YouTube Playlist, Channel Gallery by YotuWP',
578 'firstparty_marketing' => false,
579 ),
580 'buttonizer' => array(
581 'constant_or_function' => 'BUTTONIZER_VERSION',
582 'label' => 'Buttonizer',
583 'firstparty_marketing' => false,
584 ),
585 'greenshift' => array(
586 'constant_or_function' => 'GREENSHIFT_DIR_URL',
587 'label' => 'Greenshift',
588 'firstparty_marketing' => false,
589 ),
590 'funnelkit' => array(
591 'constant_or_function' => 'WFFN_VERSION',
592 'label' => 'FunnelKit',
593 'firstparty_marketing' => false,
594 ),
595 'pinterest-for-woocommerce' => array(
596 'constant_or_function' => 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE',
597 'label' => 'Pinterest for WooCommerce',
598 'firstparty_marketing' => false,
599 ),
600 ) );
601
602
603 /**
604 * WordPress, include always
605 */
606 require_once( 'wordpress/wordpress.php' );
607
608 foreach ( $cmplz_integrations_list as $plugin => $details ) {
609 if ( ! isset( $details['early_load'] ) ) {
610 continue;
611 }
612
613 if ( ! file_exists( WP_PLUGIN_DIR . "/" . $plugin . "/" . $plugin . ".php" ) ) {
614 continue;
615 }
616
617 $early_load = $details['early_load'];
618 $file = apply_filters( 'cmplz_early_load_path', CMPLZ_PATH . "integrations/plugins/$early_load", $details );
619
620 if ( file_exists( $file ) ) {
621 require_once( $file );
622 }
623 }
624
625 /**
626 * Check if a plugin from the integrations list is active
627 *
628 * @param string $plugin
629 *
630 * @return bool
631 */
632 function cmplz_integration_plugin_is_enabled( string $plugin ): bool {
633 //because we need a default, we don't use the get_value from complianz. The fields array is not loaded yet, so there are no defaults
634 $fields = get_option( 'complianz_options_integrations', [] );
635 $enabled = ! isset( $fields[ $plugin ] ) || $fields[ $plugin ];
636 return cmplz_integration_plugin_is_active( $plugin ) && $enabled;
637 }
638
639 /**
640 * Check if a plugin from the integrations list is activated
641 *
642 * @param string $plugin
643 *
644 * @return bool
645 */
646 function cmplz_integration_plugin_is_active( string $plugin ): bool {
647 global $cmplz_integrations_list;
648 if ( !isset($cmplz_integrations_list[ $plugin ]) ) {
649 return false;
650 }
651 $details = $cmplz_integrations_list[ $plugin ];
652 $theme = wp_get_theme();
653 $active = defined( $details['constant_or_function'] )
654 || function_exists( $details['constant_or_function'] )
655 || class_exists( $details['constant_or_function'] )
656 || ( $theme && ( $theme->name === $details['constant_or_function'] ) )
657 || ( $theme->parent() !== false && trim( $theme->parent()->Name ) === trim( $details['constant_or_function'] ) );
658 return $active;
659 }
660
661 /**
662 * code loaded without privileges to allow integrations between plugins and services, when enabled.
663 */
664
665 function cmplz_integrations() {
666 global $cmplz_integrations_list;
667 $stored_integrations_count = get_option('cmplz_active_integrations', 0 );
668 $actual_integrations_count = 0;
669 foreach ( $cmplz_integrations_list as $plugin => $details ) {
670 if ( cmplz_integration_plugin_is_enabled( $plugin ) ) {
671 $actual_integrations_count++;
672 $file = apply_filters( 'cmplz_integration_path', CMPLZ_PATH . "integrations/plugins/$plugin.php", $plugin );
673 if ( file_exists( $file ) ) {
674 require_once( $file );
675 }
676 }
677 }
678
679 //cannot be an absolute match.
680 if ( $stored_integrations_count != $actual_integrations_count) {
681 update_option('cmplz_active_integrations', $actual_integrations_count);
682 update_option('cmplz_integrations_changed', true );
683 }
684
685 /**
686 * Services
687 */
688
689 $services = COMPLIANZ::$config->thirdparty_service_markers;
690 $services = array_keys( $services );
691 foreach ( $services as $service ) {
692 if ( cmplz_uses_thirdparty( $service ) ) {
693 if ( file_exists( CMPLZ_PATH . "integrations/services/$service.php" ) ) {
694 require_once( "services/$service.php" );
695 }
696 }
697 }
698
699 $services = COMPLIANZ::$config->social_media_markers;
700 $services = array_keys( $services );
701 foreach ( $services as $service ) {
702 if ( cmplz_uses_thirdparty( $service ) ) {
703 if ( file_exists( CMPLZ_PATH . "integrations/services/$service.php" ) ) {
704 require_once( "services/$service.php" );
705 }
706 }
707 }
708
709 /**
710 * statistics
711 */
712
713 $statistics = cmplz_get_option( 'compile_statistics' );
714 if ( $statistics === 'google-analytics' ) {
715 require_once( 'statistics/google-analytics.php' );
716 }
717 if ( $statistics === 'matomo' && cmplz_get_option('configuration_by_complianz') !=='yes' ) {
718 require_once( 'statistics/matomo.php' );
719 }
720 }
721
722 add_action( 'plugins_loaded', 'cmplz_integrations', 10 );
723
724
725 /**
726 * Check if a third party is used on this site
727 *
728 * @param string $name
729 *
730 * @return bool uses_thirdparty
731 */
732
733 function cmplz_uses_thirdparty( $name ) {
734 if ( cmplz_get_option( 'uses_thirdparty_services' ) === 'yes' ) {
735 $thirdparty_types = cmplz_get_option( 'thirdparty_services_on_site' );
736
737 if ( is_array($thirdparty_types) && in_array( $name, $thirdparty_types) ) {
738 return true;
739 }
740 }
741
742 if ( cmplz_get_option( 'uses_social_media' ) === 'yes' ) {
743 $social_media_types = cmplz_get_option( 'socialmedia_on_site' );
744 if ( is_array($social_media_types) && in_array( $name, $social_media_types) ) {
745 return true;
746 }
747 }
748
749 return false;
750 }
751
752 /**
753 * Callback to check if google maps is used
754 * @return bool
755 */
756 function cmplz_uses_google_maps(){
757 return cmplz_uses_thirdparty('google-maps');
758 }
759
760 function cmplz_google_maps_integration_enabled(){
761 return defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE');
762 }
763
764 function cmplz_uses_woocmmerce(){
765 return cmplz_uses_thirdparty('google-maps');
766 }
767
768 /**
769 * placeholders that are disabled will be removed by hook here.
770 *
771 * This only applies to the non iframe placeholders. Other placeholders are blocked using the cmplz_placeholder_disabled function
772 */
773
774 //add_action( "plugins_loaded", 'cmplz_unset_placeholder_hooks' );
775 //function cmplz_unset_placeholder_hooks() {
776 // $disabled_placeholders = get_option( 'cmplz_disabled_placeholders', array() );
777 // foreach ( $disabled_placeholders as $service ) {
778 // $has_placeholder = ( function_exists( "cmplz_{$service}_placeholder" ) );
779 // if ( $has_placeholder ) {
780 // remove_filter( 'cmplz_placeholder_markers', "cmplz_{$service}_placeholder" );
781 // }
782 // }
783 //}
784
785 /**
786 * check if the placeholder for a service is disabled
787 *
788 * @param string $service
789 *
790 * @return bool $disabled
791 */
792
793 function cmplz_placeholder_disabled( $service ) {
794 $disabled_placeholders = get_option( 'cmplz_disabled_placeholders',
795 array() );
796
797 if ( in_array( $service, $disabled_placeholders ) ) {
798 return true;
799 }
800 //check also other variation
801 $service = str_replace( '-', "_", $service );
802 if ( in_array( $service, $disabled_placeholders ) ) {
803 return true;
804 }
805
806 return false;
807
808 }
809
810 /**
811 * check if we should use placeholders
812 *
813 * @param string|bool $src
814 *
815 * @return bool
816 */
817
818 function cmplz_use_placeholder( $src = false ) {
819 if ( cmplz_get_option( 'dont_use_placeholders' ) ) {
820 return false;
821 }
822
823 if ( ! $src ) {
824 return true;
825 }
826
827
828 //no placeholder on facebook like button
829 if ( strpos( $src, 'like.php' ) !== false ) {
830 return false;
831 }
832
833 //get service from $src
834 $service = cmplz_get_service_by_src( $src );
835 if ( cmplz_placeholder_disabled( $service ) ) {
836 return false;
837 }
838
839 return true;
840 }
841
842 /**
843 * Get a service by string, looking at the src of a frame or script
844 *
845 * @param string $src
846 *
847 * @return bool|string
848 */
849
850 function cmplz_get_service_by_src( $src ) {
851 $type = false;
852 $services = COMPLIANZ::$config->thirdparty_service_markers;
853 $social = COMPLIANZ::$config->social_media_markers;
854 $stats = COMPLIANZ::$config->stats_markers;
855 $all = $services+$social+$stats;
856 foreach ( $all as $service_id => $markers ) {
857 $service = cmplz_strpos_arr($src, $markers);
858 if ( $service !== FALSE ) {
859 $type = $service_id;
860 break;
861 }
862 }
863
864 if ( ! $type ) {
865 $type = COMPLIANZ::$banner_loader->parse_for_social_media( $src, true );
866 if ( ! $type ) {
867 $type = COMPLIANZ::$banner_loader->parse_for_thirdparty_services( $src, true );
868 }
869 }
870 return $type ?: 'general';
871 }
872
873 /**
874 * Maybe update css if integrations have been changed
875 */
876
877 function cmplz_maybe_update_css(){
878
879 if ( !cmplz_admin_logged_in() ) {
880 return;
881 }
882
883 $integrations_changed = get_option('cmplz_integrations_changed', false );
884 if ( $integrations_changed ) {
885 cmplz_update_all_banners();
886 }
887 update_option('cmplz_integrations_changed', false );
888 }
889 add_action('admin_init', 'cmplz_maybe_update_css');
890
891 /**
892 * Check if this plugin's integration is enabled
893 *
894 * @param string $plugin_name
895 *
896 * @return bool
897 */
898 function cmplz_is_integration_enabled( string $plugin_name ): bool {
899 global $cmplz_integrations_list;
900 if ( ! array_key_exists( $plugin_name, $cmplz_integrations_list ) ) {
901 return false;
902 }
903 $fields = get_option( 'complianz_options_integrations' );
904 //default enabled, which means it's enabled when not set.
905 return ! ( isset( $fields[ $plugin_name ] ) && $fields[ $plugin_name ] != 1 );
906 }
907