Cookiebot | GDPR Compliant Cookie Consent and Notice - Version 3.8.0

Version Description

Download this release

Release Info

Developer cookiebot
Plugin Icon 128x128 Cookiebot | GDPR Compliant Cookie Consent and Notice
Version 3.8.0
Comparing to
See all releases

Code changes from version 3.7.1 to 3.8.0

Files changed (49) hide show
  1. addons/addons.json +3 -0
  2. addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php +16 -11
  3. addons/controller/addons/enhanced-ecommerce-for-woocommerce-store/enhanced-ecommerce-for-woocommerce-store.php +8 -10
  4. addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php +1 -1
  5. addons/controller/addons/official-facebook-pixel/official-facebook-pixel.php +431 -0
  6. addons/cookiebot-addons-init.php +1 -1
  7. addons/lib/buffer/buffer-output-tag.php +13 -1
  8. addons/lib/buffer/buffer-output.php +4 -0
  9. addons/lib/helper.php +45 -17
  10. addons/tests/integration/addons/addons-base.php +34 -0
  11. addons/tests/integration/addons/test-add-to-any.php +6 -4
  12. addons/tests/integration/addons/test-addthis.php +2 -2
  13. addons/tests/integration/addons/test-caos-host-analyticsjs-local-save-ga-local.php +2 -2
  14. addons/tests/integration/addons/test-caos-host-analyticsjs-local.php +4 -4
  15. addons/tests/integration/addons/test-custom-facebook-feed.php +2 -2
  16. addons/tests/integration/addons/test-enhanced-ecommerce-for-woocommerce-store.php +2 -2
  17. addons/tests/integration/addons/test-facebook-for-woocommerce.php +3 -3
  18. addons/tests/integration/addons/test-ga-google-analytics.php +2 -2
  19. addons/tests/integration/addons/test-gadwp.php +4 -4
  20. addons/tests/integration/addons/test-google-analyticator.php +2 -2
  21. addons/tests/integration/addons/test-google-analytics-plus.php +23 -20
  22. addons/tests/integration/addons/test-google-analytics.php +4 -4
  23. addons/tests/integration/addons/test-hubspot-leadin.php +2 -2
  24. addons/tests/integration/addons/test-hubspot-tracking-code.php +2 -2
  25. addons/tests/integration/addons/test-instagram-feed.php +2 -2
  26. addons/tests/integration/addons/test-jetpack-facebook-widget.php +2 -2
  27. addons/tests/integration/addons/test-jetpack-goodreads-widget.php +2 -2
  28. addons/tests/integration/addons/test-jetpack-google-maps-widget.php +2 -2
  29. addons/tests/integration/addons/test-jetpack-googleplus-badge-widget.php +2 -2
  30. addons/tests/integration/addons/test-jetpack-internet-defense-league-widget.php +2 -2
  31. addons/tests/integration/addons/test-jetpack-twitter-timeline-widget.php +2 -2
  32. addons/tests/integration/addons/test-lightspeed-cache.php +2 -2
  33. addons/tests/integration/addons/test-ninja-forms.php +2 -2
  34. addons/tests/integration/addons/test-official-facebook-pixel.php +195 -0
  35. addons/tests/integration/addons/test-optinmonster.php +2 -2
  36. addons/tests/integration/addons/test-pixel-caffeine.php +2 -2
  37. addons/tests/integration/addons/test-simple-share-buttons-adder.php +2 -2
  38. addons/tests/integration/addons/test-wd-google-analytics.php +2 -2
  39. addons/tests/integration/addons/test-wp-analytify.php +2 -2
  40. addons/tests/integration/addons/test-wp-mautic.php +2 -2
  41. addons/tests/integration/addons/test-wp-piwik.php +2 -2
  42. addons/tests/integration/test-buffer-priorities.php +13 -8
  43. addons/tests/unit/test-addon-file-name.php +23 -12
  44. addons/tests/unit/test-get-option-name.php +17 -5
  45. addons/tests/unit/test-manipulate-script.php +24 -3
  46. cookiebot.php +3 -3
  47. phpunit.xml +1 -2
  48. readme.txt +5 -1
  49. widgets/cookiebot-declaration-widget.php +1 -0
addons/addons.json CHANGED
@@ -85,5 +85,8 @@
85
  },
86
  "Simple_Share_Buttons_Adder": {
87
  "class": "cookiebot_addons\\controller\\addons\\simple_share_buttons_adder\\Simple_Share_Buttons_Adder"
 
 
 
88
  }
89
  }
85
  },
86
  "Simple_Share_Buttons_Adder": {
87
  "class": "cookiebot_addons\\controller\\addons\\simple_share_buttons_adder\\Simple_Share_Buttons_Adder"
88
+ },
89
+ "Official_Facebook_Pixel": {
90
+ "class": "cookiebot_addons\\controller\\addons\\official_facebook_pixel\\Official_Facebook_Pixel"
91
  }
92
  }
addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php CHANGED
@@ -48,7 +48,12 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
48
  *
49
  * @since 1.3.0
50
  */
51
- public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
 
 
 
 
 
52
  $this->settings = $settings;
53
  $this->script_loader_tag = $script_loader_tag;
54
  $this->cookie_consent = $cookie_consent;
@@ -70,7 +75,7 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
70
  * @since 1.3.0
71
  */
72
  public function cookiebot_addon_host_analyticsjs_local() {
73
-
74
  /* Priority need to be more than 0 so we are able to hook in before output begins */
75
  $scriptPriority = $this->cookiebot_addon_host_analyticsjs_local_priority();
76
  if ( $scriptPriority <= 0 ) {
@@ -83,9 +88,9 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
83
  * ga scripts are loaded in wp_footer priority is defined in option variable
84
  */
85
  if ( has_action( 'wp_footer', 'caos_analytics_render_tracking_code' ) ||
86
- has_action( 'wp_footer', 'caos_render_tracking_code' ) ||
87
- has_action( 'wp_footer', 'add_ga_header_script' ) ||
88
- ( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION == 'footer' ) ) {
89
  /**
90
  * Consent not given - no cache
91
  */
@@ -97,10 +102,10 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
97
  /**
98
  * ga scripts are loaded in wp_head priority is defined in option variable
99
  */
100
- if ( has_action( 'wp_head', 'caos_analytics_render_tracking_code' ) ||
101
- has_action( 'wp_head', 'caos_render_tracking_code' ) ||
102
- has_action( 'wp_head', 'add_ga_header_script' ) ||
103
- ( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION != 'footer' ) ) {
104
  /**
105
  * Consent not given - no cache
106
  */
@@ -108,7 +113,6 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
108
  'GoogleAnalyticsObject' => $this->get_cookie_types(),
109
  ), false );
110
  }
111
-
112
  }
113
 
114
  /**
@@ -238,7 +242,8 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
238
  * @since 1.8.0
239
  */
240
  public function get_placeholder( $src = '' ) {
241
- return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(), cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
 
242
  }
243
 
244
  /**
48
  *
49
  * @since 1.3.0
50
  */
51
+ public function __construct(
52
+ Settings_Service_Interface $settings,
53
+ Script_Loader_Tag_Interface $script_loader_tag,
54
+ Cookie_Consent_Interface $cookie_consent,
55
+ Buffer_Output_Interface $buffer_output
56
+ ) {
57
  $this->settings = $settings;
58
  $this->script_loader_tag = $script_loader_tag;
59
  $this->cookie_consent = $cookie_consent;
75
  * @since 1.3.0
76
  */
77
  public function cookiebot_addon_host_analyticsjs_local() {
78
+
79
  /* Priority need to be more than 0 so we are able to hook in before output begins */
80
  $scriptPriority = $this->cookiebot_addon_host_analyticsjs_local_priority();
81
  if ( $scriptPriority <= 0 ) {
88
  * ga scripts are loaded in wp_footer priority is defined in option variable
89
  */
90
  if ( has_action( 'wp_footer', 'caos_analytics_render_tracking_code' ) ||
91
+ has_action( 'wp_footer', 'caos_render_tracking_code' ) ||
92
+ has_action( 'wp_footer', 'add_ga_header_script' ) ||
93
+ ( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION == 'footer' ) ) {
94
  /**
95
  * Consent not given - no cache
96
  */
102
  /**
103
  * ga scripts are loaded in wp_head priority is defined in option variable
104
  */
105
+ if ( has_action( 'wp_head', 'caos_analytics_render_tracking_code' ) ||
106
+ has_action( 'wp_head', 'caos_render_tracking_code' ) ||
107
+ has_action( 'wp_head', 'add_ga_header_script' ) ||
108
+ ( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION != 'footer' ) ) {
109
  /**
110
  * Consent not given - no cache
111
  */
113
  'GoogleAnalyticsObject' => $this->get_cookie_types(),
114
  ), false );
115
  }
 
116
  }
117
 
118
  /**
242
  * @since 1.8.0
243
  */
244
  public function get_placeholder( $src = '' ) {
245
+ return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(),
246
+ cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
247
  }
248
 
249
  /**
addons/controller/addons/enhanced-ecommerce-for-woocommerce-store/enhanced-ecommerce-for-woocommerce-store.php CHANGED
@@ -70,16 +70,14 @@
70
  * @since 1.3.0
71
  */
72
  public function cookiebot_addon_enhanced_ecommerce_for_woocommerce_store() {
73
- cookiebot_addons_remove_class_action('woocommerce_after_checkout_billing_form', 'Enhanced_Ecommerce_Google_Analytics_Public', 'checkout_step_3_tracking', 10);
74
- cookiebot_addons_remove_class_action('woocommerce_after_add_to_cart_button', 'Enhanced_Ecommerce_Google_Analytics_Public', 'add_to_cart', 10);
75
- cookiebot_addons_remove_class_action('wp_head', 'Enhanced_Ecommerce_Google_Analytics_Public', 'add_dev_id', 10);
76
- cookiebot_addons_remove_class_action('wp_footer', 'Enhanced_Ecommerce_Google_Analytics_Public', 'tvc_store_meta_data', 10);
77
- cookiebot_addons_remove_class_action('woocommerce_thankyou', 'Enhanced_Ecommerce_Google_Analytics_Public', 'ecommerce_tracking_code', 10);
78
- cookiebot_addons_remove_class_action('wp_head', 'Enhanced_Ecommerce_Google_Analytics_Public', 'ee_settings', 10);
79
- cookiebot_addons_remove_class_action('wp_footer', 'Enhanced_Ecommerce_Google_Analytics_Public', 't_products_impre_clicks', 10);
80
- cookiebot_addons_remove_class_action('woocommerce_after_shop_loop_item', 'Enhanced_Ecommerce_Google_Analytics_Public', 'bind_product_metadata', 10);
81
- cookiebot_addons_remove_class_action('woocommerce_after_single_product', 'Enhanced_Ecommerce_Google_Analytics_Public', 'product_detail_view', 10);
82
- cookiebot_addons_remove_class_action('woocommerce_after_cart', 'Enhanced_Ecommerce_Google_Analytics_Public', 'remove_cart_tracking', 10);
83
  }
84
 
85
  /**
70
  * @since 1.3.0
71
  */
72
  public function cookiebot_addon_enhanced_ecommerce_for_woocommerce_store() {
73
+ $this->buffer_output->add_tag( 'wp_footer', 25, array(
74
+ 'gtag' => $this->get_cookie_types()
75
+ ), false );
76
+
77
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
78
+ 'gtag' => $this->get_cookie_types(),
79
+ 'gaProperty' => $this->get_cookie_types(),
80
+ ), false );
 
 
81
  }
82
 
83
  /**
addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php CHANGED
@@ -305,7 +305,7 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
305
  * @since 1.8.0
306
  */
307
  public function get_svn_url() {
308
- return 'https://github.com/facebookincubator/facebook-for-woocommerce/blob/master/facebook-commerce.php';
309
  }
310
 
311
  /**
305
  * @since 1.8.0
306
  */
307
  public function get_svn_url() {
308
+ return 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce.php';
309
  }
310
 
311
  /**
addons/controller/addons/official-facebook-pixel/official-facebook-pixel.php ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cookiebot_addons\controller\addons\official_facebook_pixel;
4
+
5
+ use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
6
+ use cookiebot_addons\lib\Cookie_Consent_Interface;
7
+ use cookiebot_addons\lib\Settings_Service_Interface;
8
+ use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
9
+ use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
10
+ use FacebookPixelPlugin\Core\FacebookPluginConfig;
11
+
12
+ class Official_Facebook_Pixel implements Cookiebot_Addons_Interface {
13
+
14
+ /**
15
+ * @var Settings_Service_Interface
16
+ *
17
+ * @since 1.3.0
18
+ */
19
+ protected $settings;
20
+
21
+ /**
22
+ * @var Script_Loader_Tag_Interface
23
+ *
24
+ * @since 1.3.0
25
+ */
26
+ protected $script_loader_tag;
27
+
28
+ /**
29
+ * @var Cookie_Consent_Interface
30
+ *
31
+ * @since 1.3.0
32
+ */
33
+ public $cookie_consent;
34
+
35
+ /**
36
+ * @var Buffer_Output_Interface
37
+ *
38
+ * @since 1.3.0
39
+ */
40
+ protected $buffer_output;
41
+
42
+ /**
43
+ * Jetpack constructor.
44
+ *
45
+ * @param $settings Settings_Service_Interface
46
+ * @param $script_loader_tag Script_Loader_Tag_Interface
47
+ * @param $cookie_consent Cookie_Consent_Interface
48
+ * @param $buffer_output Buffer_Output_Interface
49
+ *
50
+ * @since 1.3.0
51
+ */
52
+ public function __construct(
53
+ Settings_Service_Interface $settings,
54
+ Script_Loader_Tag_Interface $script_loader_tag,
55
+ Cookie_Consent_Interface $cookie_consent,
56
+ Buffer_Output_Interface $buffer_output
57
+ ) {
58
+ $this->settings = $settings;
59
+ $this->script_loader_tag = $script_loader_tag;
60
+ $this->cookie_consent = $cookie_consent;
61
+ $this->buffer_output = $buffer_output;
62
+ }
63
+
64
+ /**
65
+ * Loads addon configuration
66
+ *
67
+ * @since 1.3.0
68
+ */
69
+ public function load_configuration() {
70
+ add_action( 'wp_loaded', array( $this, 'cookiebot_addon_official_facebook_pixel' ), 5 );
71
+ }
72
+
73
+ /**
74
+ * Disable scripts if state not accepted
75
+ *
76
+ * @since 1.3.0
77
+ */
78
+ public function cookiebot_addon_official_facebook_pixel() {
79
+ // Pageview
80
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
81
+ 'connect.facebook.net' => $this->get_cookie_types(),
82
+ 'fbq' => $this->get_cookie_types(),
83
+ ) );
84
+
85
+ // Caldera forms integration
86
+ $this->buffer_output->add_tag( 'caldera_forms_ajax_return', 10, array(
87
+ 'fbq' => $this->get_cookie_types(),
88
+ ), false );
89
+
90
+ // Gravity forms integration
91
+ $this->buffer_output->add_tag( 'gform_confirmation', 10, array(
92
+ 'fbq' => $this->get_cookie_types(),
93
+ ), false );
94
+
95
+ // Ninja forms integration
96
+ $this->buffer_output->add_tag( 'ninja_forms_submission_actions', 10, array(
97
+ 'fbq' => $this->get_cookie_types(),
98
+ ), false );
99
+
100
+ // WP Ecommerce integration
101
+ $this->buffer_output->add_tag( 'wpsc_add_to_cart_json_response', 11, array(
102
+ 'fbq' => $this->get_cookie_types(),
103
+ ), false );
104
+
105
+ $this->buffer_output->add_tag( 'wpsc_transaction_results_shutdown', 11, array(
106
+ 'fbq' => $this->get_cookie_types(),
107
+ ), false );
108
+
109
+ // WP Forms integration
110
+ $this->buffer_output->add_tag( 'wp_footer', 20, array(
111
+ 'fbq' => $this->get_cookie_types(),
112
+ ), false );
113
+
114
+ // Catching most events created with \FacebookPixelPlugin\Integration\FacebookWordpressIntegrationBase::addPixelFireForHook
115
+ $this->buffer_output->add_tag( 'wp_footer', 11, array(
116
+ 'fbq' => $this->get_cookie_types(),
117
+ ), false );
118
+
119
+ // Server side pixel events
120
+ // Caldera form integration
121
+ cookiebot_addons_remove_class_action( 'caldera_forms_ajax_return',
122
+ 'FacebookPixelPlugin\Integration\FacebookWordpressCalderaForm', 'injectLeadEvent' );
123
+
124
+ // Contact Form 7 integration
125
+ cookiebot_addons_remove_class_action( 'wpcf7_submit',
126
+ 'FacebookPixelPlugin\Integration\FacebookWordpressContactForm7', 'trackServerEvent' );
127
+ cookiebot_addons_remove_class_action( 'wpcf7_ajax_json_echo',
128
+ 'FacebookPixelPlugin\Integration\FacebookWordpressContactForm7', 'injectLeadEvent', 20 );
129
+
130
+ // Formidable Form integration
131
+ cookiebot_addons_remove_class_action( 'frm_after_create_entry',
132
+ 'FacebookPixelPlugin\Integration\FacebookWordpressFormidableForm', 'trackServerEvent', 20 );
133
+ cookiebot_addons_remove_class_action( 'wp_footer',
134
+ 'FacebookPixelPlugin\Integration\FacebookWordpressFormidableForm', 'injectLeadEvent', 20 );
135
+
136
+ // Easy digital downloads integration
137
+ cookiebot_addons_remove_class_action( 'edd_payment_receipt_after',
138
+ 'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads', 'trackPurchaseEvent' );
139
+ cookiebot_addons_remove_class_action( 'edd_after_download_content',
140
+ 'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads', 'injectAddToCartEvent', 11 );
141
+ cookiebot_addons_remove_class_action( 'edd_after_checkout_cart',
142
+ 'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads', 'injectInitiateCheckoutEvent',
143
+ 11 );
144
+ cookiebot_addons_remove_class_action( 'edd_after_download_content',
145
+ 'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads', 'injectViewContentEvent', 11 );
146
+
147
+ // Gravity forms integration
148
+ cookiebot_addons_remove_class_action( 'gform_confirmation',
149
+ 'FacebookPixelPlugin\Integration\FacebookWordpressGravityForms', 'injectLeadEvent' );
150
+
151
+ // Mailchimp for WP integration
152
+ cookiebot_addons_remove_class_action( 'mc4wp_form_subscribed',
153
+ 'FacebookPixelPlugin\Integration\FacebookWordpressMailchimpForWp', 'injectLeadEvent', 11 );
154
+
155
+ // Ninja forms integration
156
+ cookiebot_addons_remove_class_action( 'ninja_forms_submission_actions',
157
+ 'FacebookPixelPlugin\Integration\FacebookWordpressNinjaForms', 'injectLeadEvent' );
158
+
159
+ // WooCommerce integration
160
+ cookiebot_addons_remove_class_action( 'woocommerce_after_checkout_form',
161
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce', 'trackInitiateCheckout', 40 );
162
+ cookiebot_addons_remove_class_action( 'woocommerce_add_to_cart',
163
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce', 'trackAddToCartEvent', 40 );
164
+ cookiebot_addons_remove_class_action( 'woocommerce_thankyou',
165
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce', 'trackPurchaseEvent', 40 );
166
+ cookiebot_addons_remove_class_action( 'woocommerce_payment_complete',
167
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce', 'trackPurchaseEvent', 40 );
168
+
169
+ // WP Ecommerce integration
170
+ cookiebot_addons_remove_class_action( 'wpsc_add_to_cart_json_response',
171
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce', 'injectAddToCartEvent', 11 );
172
+ cookiebot_addons_remove_class_action( 'wpsc_before_shopping_cart_page',
173
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce', 'injectInitiateCheckoutEvent', 11 );
174
+ cookiebot_addons_remove_class_action( 'wpsc_transaction_results_shutdown',
175
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce', 'injectPurchaseEvent', 11 );
176
+
177
+ // WP Forms integration
178
+ cookiebot_addons_remove_class_action( 'wpforms_process_before',
179
+ 'FacebookPixelPlugin\Integration\FacebookWordpressWPForms', 'trackEvent', 20 );
180
+ }
181
+
182
+ /**
183
+ * Return addon/plugin name
184
+ *
185
+ * @return string
186
+ *
187
+ * @since 1.3.0
188
+ */
189
+ public function get_addon_name() {
190
+ return 'Official Facebook Pixel';
191
+ }
192
+
193
+ /**
194
+ * Default placeholder content
195
+ *
196
+ * @return string
197
+ *
198
+ * @since 1.8.0
199
+ */
200
+ public function get_default_placeholder() {
201
+ return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Social Share buttons.';
202
+ }
203
+
204
+ /**
205
+ * Get placeholder content
206
+ *
207
+ * This function will check following features:
208
+ * - Current language
209
+ *
210
+ * @param $src
211
+ *
212
+ * @return bool|mixed
213
+ *
214
+ * @since 1.8.0
215
+ */
216
+ public function get_placeholder( $src = '' ) {
217
+ return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(),
218
+ cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
219
+ }
220
+
221
+ /**
222
+ * Option name in the database
223
+ *
224
+ * @return string
225
+ *
226
+ * @since 1.3.0
227
+ */
228
+ public function get_option_name() {
229
+ return 'official_facebook_pixel';
230
+ }
231
+
232
+ /**
233
+ * Plugin file name
234
+ *
235
+ * @return string
236
+ *
237
+ * @since 1.3.0
238
+ */
239
+ public function get_plugin_file() {
240
+ return 'official-facebook-pixel/facebook-for-wordpress.php';
241
+ }
242
+
243
+ /**
244
+ * Returns checked cookie types
245
+ * @return mixed
246
+ *
247
+ * @since 1.3.0
248
+ */
249
+ public function get_cookie_types() {
250
+ return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
251
+ }
252
+
253
+ /**
254
+ * Returns default cookie types
255
+ * @return array
256
+ *
257
+ * @since 1.5.0
258
+ */
259
+ public function get_default_cookie_types() {
260
+ return array( 'marketing' );
261
+ }
262
+
263
+ /**
264
+ * Check if plugin is activated and checked in the backend
265
+ *
266
+ * @since 1.3.0
267
+ */
268
+ public function is_addon_enabled() {
269
+ return $this->settings->is_addon_enabled( $this->get_option_name() );
270
+ }
271
+
272
+ /**
273
+ * Checks if addon is installed
274
+ *
275
+ * @since 1.3.0
276
+ */
277
+ public function is_addon_installed() {
278
+ return $this->settings->is_addon_installed( $this->get_plugin_file() );
279
+ }
280
+
281
+ /**
282
+ * Checks if addon is activated
283
+ *
284
+ * @since 1.3.0
285
+ */
286
+ public function is_addon_activated() {
287
+ return $this->settings->is_addon_activated( $this->get_plugin_file() );
288
+ }
289
+
290
+ /**
291
+ * Retrieves current installed version of the addon
292
+ *
293
+ * @return bool
294
+ *
295
+ * @since 2.2.1
296
+ */
297
+ public function get_addon_version() {
298
+ return $this->settings->get_addon_version( $this->get_plugin_file() );
299
+ }
300
+
301
+ /**
302
+ * Checks if it does have custom placeholder content
303
+ *
304
+ * @return mixed
305
+ *
306
+ * @since 1.8.0
307
+ */
308
+ public function has_placeholder() {
309
+ return $this->settings->has_placeholder( $this->get_option_name() );
310
+ }
311
+
312
+ /**
313
+ * returns all placeholder contents
314
+ *
315
+ * @return mixed
316
+ *
317
+ * @since 1.8.0
318
+ */
319
+ public function get_placeholders() {
320
+ return $this->settings->get_placeholders( $this->get_option_name() );
321
+ }
322
+
323
+ /**
324
+ * Return true if the placeholder is enabled
325
+ *
326
+ * @return mixed
327
+ *
328
+ * @since 1.8.0
329
+ */
330
+ public function is_placeholder_enabled() {
331
+ return $this->settings->is_placeholder_enabled( $this->get_option_name() );
332
+ }
333
+
334
+ /**
335
+ * Adds extra information under the label
336
+ *
337
+ * @return string
338
+ *
339
+ * @since 1.8.0
340
+ */
341
+ public function get_extra_information() {
342
+ return '<p>' . __( 'Blocks Official Facebook Pixel scripts', 'cookiebot-addons' ) . '</p>';
343
+ }
344
+
345
+ /**
346
+ * Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
347
+ *
348
+ * @return string
349
+ *
350
+ * @since 1.8.0
351
+ */
352
+ public function get_svn_url() {
353
+ return 'https://plugins.svn.wordpress.org/official-facebook-pixel/trunk/facebook-for-wordpress.php';
354
+ }
355
+
356
+ /**
357
+ * Placeholder helper overlay in the settings page.
358
+ *
359
+ * @return string
360
+ *
361
+ * @since 1.8.0
362
+ */
363
+ public function get_placeholder_helper() {
364
+ return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
365
+ }
366
+
367
+
368
+ /**
369
+ * Returns parent class or false
370
+ *
371
+ * @return string|bool
372
+ *
373
+ * @since 2.1.3
374
+ */
375
+ public function get_parent_class() {
376
+ return get_parent_class( $this );
377
+ }
378
+
379
+ /**
380
+ * Action after enabling the addon on the settings page
381
+ *
382
+ * @since 2.2.0
383
+ */
384
+ public function post_hook_after_enabling() {
385
+ //do nothing
386
+ }
387
+
388
+ /**
389
+ * Cookiebot plugin is deactivated
390
+ *
391
+ * @since 2.2.0
392
+ */
393
+ public function plugin_deactivated() {
394
+ //do nothing
395
+ }
396
+
397
+ /**
398
+ * @return mixed
399
+ *
400
+ * @since 2.4.5
401
+ */
402
+ public function extra_available_addon_option() {
403
+ //do nothing
404
+ }
405
+
406
+ /**
407
+ * Returns boolean to enable/disable plugin by default
408
+ *
409
+ * @return bool
410
+ *
411
+ * @since 3.6.3
412
+ */
413
+ public function enable_by_default() {
414
+ return false;
415
+ }
416
+
417
+ /**
418
+ * Sets default settings for this addon
419
+ *
420
+ * @return array
421
+ *
422
+ * @since 3.6.3
423
+ */
424
+ public function get_default_enable_setting() {
425
+ return array(
426
+ 'enabled' => 1,
427
+ 'cookie_type' => $this->get_default_cookie_types(),
428
+ 'placeholder' => $this->get_default_placeholder(),
429
+ );
430
+ }
431
+ }
addons/cookiebot-addons-init.php CHANGED
@@ -23,7 +23,7 @@ define( 'COOKIEBOT_ADDONS_BASE_NAME', dirname( plugin_basename( __FILE__ ) ) );
23
  /**
24
  * Same version as the CookiebotWP
25
  */
26
- define( 'COOKIEBOT_ADDONS_VERSION', '3.7.1' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
23
  /**
24
  * Same version as the CookiebotWP
25
  */
26
+ define( 'COOKIEBOT_ADDONS_VERSION', '3.8.0' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
addons/lib/buffer/buffer-output-tag.php CHANGED
@@ -64,7 +64,10 @@ class Buffer_Output_Tag implements Buffer_Output_Tag_Interface {
64
  $this->tag = $tag;
65
  $this->priority = $priority;
66
  $this->keywords = $keywords;
67
- $this->use_cache = $use_cache;
 
 
 
68
  }
69
 
70
  /**
@@ -78,6 +81,15 @@ class Buffer_Output_Tag implements Buffer_Output_Tag_Interface {
78
  $this->keywords = array_merge( $this->keywords, $keywords );
79
  }
80
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Start reading the buffer/output
83
  *
64
  $this->tag = $tag;
65
  $this->priority = $priority;
66
  $this->keywords = $keywords;
67
+
68
+ $this->transient_name = "cookiebot_output_buffer_{$tag}_{$priority}";
69
+
70
+ $this->set_use_cache($use_cache);
71
  }
72
 
73
  /**
81
  $this->keywords = array_merge( $this->keywords, $keywords );
82
  }
83
 
84
+ /**
85
+ * Set use cache
86
+ *
87
+ * @param $use_cache
88
+ */
89
+ public function set_use_cache($use_cache) {
90
+ $this->use_cache = $use_cache;
91
+ }
92
+
93
  /**
94
  * Start reading the buffer/output
95
  *
addons/lib/buffer/buffer-output.php CHANGED
@@ -31,6 +31,10 @@ class Buffer_Output implements Buffer_Output_Interface {
31
  */
32
  if ( isset( $this->tags[ $unique_id ] ) ) {
33
  $this->tags[ $unique_id ]->merge_keywords( $keywords );
 
 
 
 
34
  }
35
  else {
36
  $this->tags[ $unique_id ] = $tag;
31
  */
32
  if ( isset( $this->tags[ $unique_id ] ) ) {
33
  $this->tags[ $unique_id ]->merge_keywords( $keywords );
34
+
35
+ if(!$use_cache) {
36
+ $this->tags[ $unique_id ]->set_use_cache(false);
37
+ }
38
  }
39
  else {
40
  $this->tags[ $unique_id ] = $tag;
addons/lib/helper.php CHANGED
@@ -84,24 +84,37 @@ function cookiebot_addons_remove_class_action( $action, $class, $method, $priori
84
  * @since 1.2.0
85
  */
86
  function cookiebot_addons_manipulate_script( $buffer, $keywords ) {
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * Pattern to get all scripts
89
  *
90
  * @version 2.0.4
91
  * @since 1.2.0
92
  */
93
- $pattern = "/<script[\s\S]*?>[\s\S]*?<\/script>/i";
94
 
95
  /**
96
  * Get all scripts and add cookieconsent if it does match with the criterion
97
  */
98
  $updated_scripts = preg_replace_callback( $pattern, function ( $matches ) use ( $keywords ) {
99
- /**
100
- * Matched script data
101
- */
102
- $data = ( isset( $matches[0] ) ) ? $matches[0] : '';
103
 
104
- /**
 
 
 
 
 
105
  * Check if the script contains the keywords, checks keywords one by one
106
  *
107
  * If one match, then the rest of the keywords will be skipped.
@@ -110,21 +123,36 @@ function cookiebot_addons_manipulate_script( $buffer, $keywords ) {
110
  /**
111
  * The script contains the needle
112
  **/
113
- if ( strpos( $data, $needle ) !== false ) {
114
- $data = preg_replace( '/\<script/', '<script type="text/plain" data-cookieconsent="' . cookiebot_addons_output_cookie_types( $cookie_type ) . '"', $data );
115
- $data = preg_replace( '/type\=\"text\/javascript\"/', '', $data );
116
-
117
- /**
118
- * matched already so we can skip other keywords
119
- **/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  continue;
121
  }
122
  }
123
 
124
- /**
125
- * Return updated script data
126
- */
127
- return $data;
128
  }, $buffer );
129
 
130
  /**
84
  * @since 1.2.0
85
  */
86
  function cookiebot_addons_manipulate_script( $buffer, $keywords ) {
87
+ /**
88
+ * normalize potential self-closing script tags
89
+ */
90
+
91
+ $normalized_buffer = preg_replace('/(<script(.*?)\/>)/is', '<script$2></script>', $buffer);
92
+
93
+ if($normalized_buffer !== null) {
94
+ $buffer = $normalized_buffer;
95
+ }
96
+
97
+
98
+
99
  /**
100
  * Pattern to get all scripts
101
  *
102
  * @version 2.0.4
103
  * @since 1.2.0
104
  */
105
+ $pattern = '/(<script(?:.*?)>)(.*?)(<\/script>)/is';
106
 
107
  /**
108
  * Get all scripts and add cookieconsent if it does match with the criterion
109
  */
110
  $updated_scripts = preg_replace_callback( $pattern, function ( $matches ) use ( $keywords ) {
 
 
 
 
111
 
112
+ $script = $matches[0]; // the full script html
113
+ $script_tag_open = $matches[1]; // only the script open tag with all attributes
114
+ $script_tag_inner = $matches[2]; // only the script's innerText
115
+ $script_tag_close = $matches[3]; // only the script closing tag
116
+
117
+ /**
118
  * Check if the script contains the keywords, checks keywords one by one
119
  *
120
  * If one match, then the rest of the keywords will be skipped.
123
  /**
124
  * The script contains the needle
125
  **/
126
+ if ( strpos( $script, $needle ) !== false ) {
127
+ /**
128
+ * replace all single quotes with double quotes in the open tag
129
+ * remove previously set data-cookieconsent attribute
130
+ * remove type attribute
131
+ */
132
+ $script_tag_open = preg_replace('/\'/', '"', $script_tag_open);
133
+ $script_tag_open = preg_replace('/\sdata-cookieconsent=\"(?:.*?)\"/', '', $script_tag_open);
134
+ $script_tag_open = preg_replace( '/\stype=\"(?:.*?)\"/', '', $script_tag_open );
135
+
136
+ /**
137
+ * set the type attribute to text/plain to prevent javascript execution
138
+ * add data-cookieconsent attribute
139
+ */
140
+ $cookie_types = cookiebot_addons_output_cookie_types( $cookie_type );
141
+ $replacement = '<script type="text/plain" data-cookieconsent="' . $cookie_types . '"';
142
+ $script_tag_open = preg_replace( '/<script/', $replacement, $script_tag_open );
143
+
144
+ /**
145
+ * reconstruct the script and break the foreach loop
146
+ */
147
+ $script = $script_tag_open . $script_tag_inner . $script_tag_close;
148
  continue;
149
  }
150
  }
151
 
152
+ /**
153
+ * return the reconstructed script
154
+ */
155
+ return $script;
156
  }, $buffer );
157
 
158
  /**
addons/tests/integration/addons/addons-base.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cookiebot_addons\tests\integration\addons;
4
+
5
+ abstract class Addons_Base extends \WP_UnitTestCase {
6
+
7
+ /**
8
+ * Returns the file content from the WordPress repository.
9
+ *
10
+ * @param $url
11
+ *
12
+ * @return bool|string
13
+ */
14
+ public function curl_get_content( $url ) {
15
+ $curl = curl_init();
16
+
17
+ curl_setopt_array( $curl, array(
18
+ CURLOPT_URL => $url,
19
+ CURLOPT_RETURNTRANSFER => true,
20
+ CURLOPT_FOLLOWLOCATION => true,
21
+ CURLOPT_CUSTOMREQUEST => "GET",
22
+ CURLOPT_HTTPHEADER => array(
23
+ "Host: plugins.svn.wordpress.org",
24
+ "User-Agent: PostmanRuntime/7.26.1"
25
+ ),
26
+ ) );
27
+
28
+ $response = curl_exec( $curl );
29
+
30
+ curl_close( $curl );
31
+
32
+ return $response;
33
+ }
34
+ }
addons/tests/integration/addons/test-add-to-any.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Add_To_Any extends \WP_UnitTestCase {
6
-
7
  /**
8
  * This will cover the existince of the wp_enqueue_script addtoany
9
  *
@@ -12,8 +12,10 @@ class Test_Add_To_Any extends \WP_UnitTestCase {
12
  * @since 2.1.0
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/add-to-any/trunk/add-to-any.php' );
16
-
 
 
17
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script( 'addtoany'" ) );
18
  }
19
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Add_To_Any extends Addons_Base {
6
+
7
  /**
8
  * This will cover the existince of the wp_enqueue_script addtoany
9
  *
12
  * @since 2.1.0
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
+ $url = 'http://plugins.svn.wordpress.org/add-to-any/trunk/add-to-any.php';
16
+ $content = $this->curl_get_content( $url );
17
+
18
+ // test the content
19
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script( 'addtoany'" ) );
20
  }
21
  }
addons/tests/integration/addons/test-addthis.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Addthis extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -13,7 +13,7 @@ class Test_Addthis extends \WP_UnitTestCase {
13
  *
14
  */
15
  public function test_addthis() {
16
- $content = file_get_contents( 'https://plugins.svn.wordpress.org/addthis/trunk/backend/AddThisPlugin.php' );
17
 
18
  $this->assertNotFalse( strpos( $content, "'addthis_widget',") );
19
  $this->assertNotFalse( strpos( $content, "window.addthis_product ") );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Addthis extends Addons_Base {
6
 
7
  public function setUp() {
8
 
13
  *
14
  */
15
  public function test_addthis() {
16
+ $content = $this->curl_get_content( 'https://plugins.svn.wordpress.org/addthis/trunk/backend/AddThisPlugin.php' );
17
 
18
  $this->assertNotFalse( strpos( $content, "'addthis_widget',") );
19
  $this->assertNotFalse( strpos( $content, "window.addthis_product ") );
addons/tests/integration/addons/test-caos-host-analyticsjs-local-save-ga-local.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Caos_Host_Analyticsjs_Local_Save_Ga_Local extends \WP_UnitTestCase {
6
 
7
  /**
8
  * This will validate if the hook "caos_analytics_render_tracking_code" still exists
@@ -12,7 +12,7 @@ class Test_Caos_Host_Analyticsjs_Local_Save_Ga_Local extends \WP_UnitTestCase {
12
  * @since 2.1.0
13
  */
14
  public function test_host_analyticsjs_local() {
15
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/tags/2.0.0/save-ga-local.php' );
16
 
17
  $this->assertNotFalse( strpos( $content,
18
  'add_action(\'wp_footer\', \'caos_analytics_render_tracking_code\', $sgal_enqueue_order);' ) );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Caos_Host_Analyticsjs_Local_Save_Ga_Local extends Addons_Base {
6
 
7
  /**
8
  * This will validate if the hook "caos_analytics_render_tracking_code" still exists
12
  * @since 2.1.0
13
  */
14
  public function test_host_analyticsjs_local() {
15
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/tags/1.97/save-ga-local.php' );
16
 
17
  $this->assertNotFalse( strpos( $content,
18
  'add_action(\'wp_footer\', \'caos_analytics_render_tracking_code\', $sgal_enqueue_order);' ) );
addons/tests/integration/addons/test-caos-host-analyticsjs-local.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Caos_Host_Analyticsjs_Local extends \WP_UnitTestCase {
6
 
7
  /**
8
  * This will validate if the hook "caos_analytics_render_tracking_code" still exists
@@ -12,12 +12,12 @@ class Test_Caos_Host_Analyticsjs_Local extends \WP_UnitTestCase {
12
  * @since 2.1.0
13
  */
14
  public function test_host_analyticsjs_local() {
15
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/trunk/includes/frontend/class-tracking.php' );
16
 
17
  $this->assertNotFalse( strpos( $content,
18
- 'add_action(\'wp_footer\', array($this, \'render_tracking_code\'), CAOS_OPT_ENQUEUE_ORDER);' ) );
19
 
20
  $this->assertNotFalse( strpos( $content,
21
- 'switch (CAOS_OPT_SCRIPT_POSITION) {' ) );
22
  }
23
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Caos_Host_Analyticsjs_Local extends Addons_Base {
6
 
7
  /**
8
  * This will validate if the hook "caos_analytics_render_tracking_code" still exists
12
  * @since 2.1.0
13
  */
14
  public function test_host_analyticsjs_local() {
15
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/trunk/includes/frontend/class-tracking.php' );
16
 
17
  $this->assertNotFalse( strpos( $content,
18
+ 'add_filter(\'woocommerce_google_analytics_script_src\'' ) );
19
 
20
  $this->assertNotFalse( strpos( $content,
21
+ '\'render_tracking_code\']' ) );
22
  }
23
  }
addons/tests/integration/addons/test-custom-facebook-feed.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Custom_Facebook_Feed extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Custom_Facebook_Feed extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/custom-facebook-feed/trunk/custom-facebook-feed.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'echo \'var cfflinkhashtags = "\' .') );
20
  $this->assertNotFalse( strpos( $content, "wp_register_script( 'cffscripts',") );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Custom_Facebook_Feed extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/custom-facebook-feed/trunk/custom-facebook-feed.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'echo \'var cfflinkhashtags = "\' .') );
20
  $this->assertNotFalse( strpos( $content, "wp_register_script( 'cffscripts',") );
addons/tests/integration/addons/test-enhanced-ecommerce-for-woocommerce-store.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Enhanced_Ecommerce_For_WooCommerce_Store extends \WP_UnitTestCase {
6
 
7
  /**
8
  * This will cover the existince of the wc_enqueue_js
@@ -12,7 +12,7 @@
12
  * @since 3.6.6
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
- $content = file_get_contents( 'https://plugins.svn.wordpress.org/enhanced-e-commerce-for-woocommerce-store/trunk/public/class-enhanced-ecommerce-google-analytics-public.php' );
16
 
17
  $this->assertNotFalse( strpos( $content, "wc_enqueue_js(" ) );
18
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Enhanced_Ecommerce_For_WooCommerce_Store extends Addons_Base {
6
 
7
  /**
8
  * This will cover the existince of the wc_enqueue_js
12
  * @since 3.6.6
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
+ $content = $this->curl_get_content( 'https://plugins.svn.wordpress.org/enhanced-e-commerce-for-woocommerce-store/trunk/public/class-enhanced-ecommerce-google-analytics-public.php' );
16
 
17
  $this->assertNotFalse( strpos( $content, "wc_enqueue_js(" ) );
18
  }
addons/tests/integration/addons/test-facebook-for-woocommerce.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Facebook_For_Woocommerce extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -13,7 +13,7 @@ class Test_Facebook_For_Woocommerce extends \WP_UnitTestCase {
13
  */
14
  public function test_facebook_for_woocommerce_main_file() {
15
  $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce.php' );
16
-
17
  $this->assertNotFalse( strpos( $content, 'WC_Facebookcommerce' ) );
18
  }
19
 
@@ -23,7 +23,7 @@ class Test_Facebook_For_Woocommerce extends \WP_UnitTestCase {
23
  public function test_facebook_for_woocommerce_hooks() {
24
 
25
  $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce-pixel-event.php' );
26
-
27
  $this->assertNotFalse( strpos( $content, 'apply_filters( \'wc_facebook_pixel_script_attributes\',' ) );
28
 
29
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Facebook_For_Woocommerce extends Addons_Base {
6
 
7
  public function setUp() {
8
 
13
  */
14
  public function test_facebook_for_woocommerce_main_file() {
15
  $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce.php' );
16
+
17
  $this->assertNotFalse( strpos( $content, 'WC_Facebookcommerce' ) );
18
  }
19
 
23
  public function test_facebook_for_woocommerce_hooks() {
24
 
25
  $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce-pixel-event.php' );
26
+
27
  $this->assertNotFalse( strpos( $content, 'apply_filters( \'wc_facebook_pixel_script_attributes\',' ) );
28
 
29
  }
addons/tests/integration/addons/test-ga-google-analytics.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Ga_Google_Analytics extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Ga_Google_Analytics extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/ga-google-analytics/trunk/inc/plugin-core.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'ga_google_analytics_tracking_code') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Ga_Google_Analytics extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/ga-google-analytics/trunk/inc/plugin-core.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'ga_google_analytics_tracking_code') );
20
  }
addons/tests/integration/addons/test-gadwp.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Gadwp extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,15 +14,15 @@ class Test_Gadwp extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/tracking/class-tracking-analytics.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'GoogleAnalyticsObject') );
20
 
21
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/frontend.php' );
22
 
23
  $this->assertNotFalse( strpos( $content, "add_action( 'wp_head', 'exactmetrics_tracking_script', 6 );") );
24
 
25
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/events/class-analytics-events.php' );
26
 
27
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script( 'exactmetrics-frontend-script',") );
28
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Gadwp extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/tracking/class-tracking-analytics.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'GoogleAnalyticsObject') );
20
 
21
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/frontend.php' );
22
 
23
  $this->assertNotFalse( strpos( $content, "add_action( 'wp_head', 'exactmetrics_tracking_script', 6 );") );
24
 
25
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/events/class-analytics-events.php' );
26
 
27
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script( 'exactmetrics-frontend-script',") );
28
  }
addons/tests/integration/addons/test-google-analyticator.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Google_Analyticator extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Google_Analyticator extends \WP_UnitTestCase {
14
  * @since 2.1.1
15
  */
16
  public function test_hooks() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analyticator/trunk/google-analyticator.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_print_scripts\', \'ga_external_tracking_js\',99999);') );
20
  $this->assertNotFalse( strpos( $content, 'add_action(\'login_head\', \'add_google_analytics\', 99);') );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Google_Analyticator extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.1
15
  */
16
  public function test_hooks() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/google-analyticator/trunk/google-analyticator.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_print_scripts\', \'ga_external_tracking_js\',99999);') );
20
  $this->assertNotFalse( strpos( $content, 'add_action(\'login_head\', \'add_google_analytics\', 99);') );
addons/tests/integration/addons/test-google-analytics-plus.php CHANGED
@@ -2,24 +2,27 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Google_Analytics_Async extends \WP_UnitTestCase {
6
-
7
- public function setUp() {
8
-
9
- }
10
-
11
- /**
12
- * This will validate if the hook for "google_analytics_async" still exists
13
- *
14
- * @since 2.1.0
15
- */
16
- public function test_hooks() {
17
- $file = WP_PLUGIN_DIR . '/google-analytics-async/google-analytics-async.php';
18
-
19
- if( file_exists( $file ) ) {
20
- $content = file_get_contents( $file );
21
-
22
- $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( &$this, \'tracking_code_output\' ) );') );
23
- }
24
- }
 
 
 
25
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Google_Analytics_Async extends Addons_Base
6
+ {
7
+
8
+ public function setUp()
9
+ {
10
+
11
+ }
12
+
13
+ /**
14
+ * This will validate if the hook for "google_analytics_async" still exists
15
+ *
16
+ * @since 2.1.0
17
+ */
18
+ public function test_hooks()
19
+ {
20
+ $file = WP_PLUGIN_DIR . '/google-analytics-async/google-analytics-async.php';
21
+
22
+ $needle = $content = 'add_action( \'wp_head\', array( &$this, \'tracking_code_output\' ) );';
23
+ if (file_exists($file)) {
24
+ $content = file_get_contents($file);
25
+ }
26
+ $this->assertNotFalse(strpos($content, $needle));
27
+ }
28
  }
addons/tests/integration/addons/test-google-analytics.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Google_Analytics extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,9 +14,9 @@ class Test_Google_Analytics extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/googleanalytics/trunk/class/Ga_Frontend.php' );
18
-
19
- $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', \'Ga_Frontend::insert_ga_script\' );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', \'Ga_Frontend::platform_sharethis\' );') );
21
  }
22
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Google_Analytics extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/googleanalytics/trunk/class/Ga_Frontend.php' );
18
+
19
+ $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', \'Ga_Frontend::insert_ga_script\' );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', \'Ga_Frontend::platform_sharethis\' );') );
21
  }
22
  }
addons/tests/integration/addons/test-hubspot-leadin.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Hubspot_Leadin extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Hubspot_Leadin extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hook() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/leadin/trunk/src/class-assetsmanager.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, "const TRACKING_CODE = 'leadin-script-loader-js';") );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Hubspot_Leadin extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_hook() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/leadin/trunk/src/class-assetsmanager.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, "const TRACKING_CODE = 'leadin-script-loader-js';") );
20
  }
addons/tests/integration/addons/test-hubspot-tracking-code.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Hubspot_Tracking_Code extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Hubspot_Tracking_Code extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hubspot_tracking_code() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/hubspot-tracking-code/trunk/inc/class-hubspot-tracking-code-analytics.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, '<script type="text/javascript" id="hs-script-loader"') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Hubspot_Tracking_Code extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_hubspot_tracking_code() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/hubspot-tracking-code/trunk/inc/class-hubspot-tracking-code-analytics.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, '<script type="text/javascript" id="hs-script-loader"') );
20
  }
addons/tests/integration/addons/test-instagram-feed.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Instagram_Feed extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Instagram_Feed extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_instagram_feed() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/instagram-feed/trunk/inc/if-functions.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', \'sb_instagram_scripts_enqueue\', 2 );') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Instagram_Feed extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_instagram_feed() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/instagram-feed/trunk/inc/if-functions.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', \'sb_instagram_scripts_enqueue\', 2 );') );
20
  }
addons/tests/integration/addons/test-jetpack-facebook-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Facebook_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Facebook_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_facebook_widget() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/jetpack/trunk/class.jetpack.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_register_script(
20
  \'jetpack-facebook-embed\'') );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Facebook_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_facebook_widget() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/jetpack/trunk/class.jetpack.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_register_script(
20
  \'jetpack-facebook-embed\'') );
addons/tests/integration/addons/test-jetpack-goodreads-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Goodreads_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Goodreads_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_goodreads_widget() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/goodreads.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'parent::__construct(
20
  \'wpcom-goodreads\'') );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Goodreads_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_goodreads_widget() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/goodreads.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'parent::__construct(
20
  \'wpcom-goodreads\'') );
addons/tests/integration/addons/test-jetpack-google-maps-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Google_Maps_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Google_Maps_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_google_maps_widget() {
17
- $content = file_get_contents('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/contact-info.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'do_action( \'jetpack_contact_info_widget_start\' );' ) );
20
  $this->assertNotFalse( strpos( $content, 'do_action( \'jetpack_contact_info_widget_end\' );' ) );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Google_Maps_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_google_maps_widget() {
17
+ $content = $this->curl_get_content('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/contact-info.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'do_action( \'jetpack_contact_info_widget_start\' );' ) );
20
  $this->assertNotFalse( strpos( $content, 'do_action( \'jetpack_contact_info_widget_end\' );' ) );
addons/tests/integration/addons/test-jetpack-googleplus-badge-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Googleplus_Badge_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Googleplus_Badge_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_googleplus_badge_widget() {
17
- $content = file_get_contents('http://plugins.svn.wordpress.org/jetpack/tags/6.9/modules/widgets/googleplus-badge.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script( \'googleplus-widget\',' ) );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Googleplus_Badge_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_googleplus_badge_widget() {
17
+ $content = $this->curl_get_content('http://plugins.svn.wordpress.org/jetpack/tags/6.9/modules/widgets/googleplus-badge.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script( \'googleplus-widget\',' ) );
20
  }
addons/tests/integration/addons/test-jetpack-internet-defense-league-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Internet_Defense_League_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Internet_Defense_League_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_internet_defense_league_widget() {
17
- $content = file_get_contents('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/internet-defense-league.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', array( $this, \'footer_script\' ) );' ) );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Internet_Defense_League_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_internet_defense_league_widget() {
17
+ $content = $this->curl_get_content('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/internet-defense-league.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', array( $this, \'footer_script\' ) );' ) );
20
  }
addons/tests/integration/addons/test-jetpack-twitter-timeline-widget.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Jetpack_Twitter_Timeline_Widget extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Jetpack_Twitter_Timeline_Widget extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_twitter_timeline_widget() {
17
- $content = file_get_contents('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/twitter-timeline.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script( \'jetpack-twitter-timeline\' );' ) );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Jetpack_Twitter_Timeline_Widget extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_twitter_timeline_widget() {
17
+ $content = $this->curl_get_content('http://plugins.svn.wordpress.org/jetpack/trunk/modules/widgets/twitter-timeline.php');
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script( \'jetpack-twitter-timeline\' );' ) );
20
  }
addons/tests/integration/addons/test-lightspeed-cache.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Lightspeed_Cache extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Lightspeed_Cache extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/litespeed-cache/trunk/src/optimize.cls.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'apply_filters( \'litespeed_optimize_js_excludes\'') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Lightspeed_Cache extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/litespeed-cache/trunk/src/optimize.cls.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'apply_filters( \'litespeed_optimize_js_excludes\'') );
20
  }
addons/tests/integration/addons/test-ninja-forms.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Ninja_Forms extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Ninja_Forms extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/ninja-forms/trunk/includes/Display/Render.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script(\'nf-google-recaptcha\'') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Ninja_Forms extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/ninja-forms/trunk/includes/Display/Render.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'wp_enqueue_script(\'nf-google-recaptcha\'') );
20
  }
addons/tests/integration/addons/test-official-facebook-pixel.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cookiebot_addons\tests\integration\addons;
4
+
5
+ class Test_Official_Facebook_Pixel extends Addons_Base {
6
+
7
+ const TRUNK = 'https://plugins.svn.wordpress.org/official-facebook-pixel/trunk/';
8
+
9
+ public function setUp() {
10
+ }
11
+
12
+ public function test_official_facebook_pixel_pageview() {
13
+ $content = $this->curl_get_content( self::TRUNK . 'core/FacebookPixel.php' );
14
+ $snippet = "<!-- Facebook Pixel Code -->
15
+ <script type='text/javascript'>
16
+ !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
17
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
18
+ n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
19
+ t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
20
+ document,'script','https://connect.facebook.net/en_US/fbevents.js');
21
+ </script>
22
+ <!-- End Facebook Pixel Code -->";
23
+
24
+ $this->assertNotFalse( strpos( $content, $snippet) );
25
+ }
26
+
27
+ public function test_official_facebook_pixel_caldera_form() {
28
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressCalderaForm.php' );
29
+ $snippet = "add_action(
30
+ 'caldera_forms_ajax_return',
31
+ array(__CLASS__, 'injectLeadEvent'),
32
+ 10, 2);";
33
+
34
+ $this->assertNotFalse( strpos( $content, $snippet) );
35
+ }
36
+
37
+ public function test_official_facebook_pixel_contact_form_7() {
38
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressContactForm7.php' );
39
+ $snippets[] = "add_action(
40
+ 'wpcf7_submit',
41
+ array(__CLASS__, 'trackServerEvent'),
42
+ 10, 2);";
43
+
44
+ $snippets[] = "add_action(
45
+ 'wpcf7_ajax_json_echo',
46
+ array(__CLASS__, 'injectLeadEvent'),
47
+ 20, 2);";
48
+
49
+ foreach($snippets as $snippet) {
50
+ $this->assertNotFalse( strpos( $content, $snippet) );
51
+ }
52
+ }
53
+
54
+ public function test_official_facebook_pixel_formidable_form() {
55
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressFormidableForm.php' );
56
+ $snippets[] = "add_action(
57
+ 'frm_after_create_entry',
58
+ array(__CLASS__, 'trackServerEvent'),
59
+ 20,
60
+ 2
61
+ );";
62
+ $snippets[] = "add_action(
63
+ 'wp_footer',
64
+ array(__CLASS__, 'injectLeadEvent'),
65
+ 20
66
+ );";
67
+
68
+ foreach($snippets as $snippet) {
69
+ $this->assertNotFalse( strpos( $content, $snippet) );
70
+ }
71
+ }
72
+
73
+ public function test_official_facebook_pixel_easy_digital_downloads() {
74
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressEasyDigitalDownloads.php' );
75
+ $snippets[] = "add_action(
76
+ 'edd_payment_receipt_after',
77
+ array(__CLASS__, 'trackPurchaseEvent'),
78
+ 10, 2);";
79
+ $snippets[] = "add_action(
80
+ 'edd_after_download_content',
81
+ array(__CLASS__, 'injectAddToCartListener')
82
+ );";
83
+ $snippets[] = "self::addPixelFireForHook(array(
84
+ 'hook_name' => 'edd_after_checkout_cart',
85
+ 'classname' => __CLASS__,
86
+ 'inject_function' => 'injectInitiateCheckoutEvent'));";
87
+ $snippets[] = "add_action(
88
+ 'edd_after_download_content',
89
+ array(__CLASS__, 'injectViewContentEvent'),
90
+ 40, 1
91
+ );";
92
+
93
+ foreach($snippets as $snippet) {
94
+ $this->assertNotFalse( strpos( $content, $snippet) );
95
+ }
96
+ }
97
+
98
+ public function test_official_facebook_pixel_gravity_forms() {
99
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressGravityForms.php' );
100
+ $snippet = "add_filter(
101
+ 'gform_confirmation',
102
+ array(__CLASS__, 'injectLeadEvent'),
103
+ 10, 4);";
104
+
105
+ $this->assertNotFalse( strpos( $content, $snippet) );
106
+ }
107
+
108
+ public function test_official_facebook_pixel_mailchimp_for_wp() {
109
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressMailchimpForWp.php' );
110
+ $snippet = "self::addPixelFireForHook(array(
111
+ 'hook_name' => 'mc4wp_form_subscribed',
112
+ 'classname' => __CLASS__,
113
+ 'inject_function' => 'injectLeadEvent'));
114
+ }";
115
+
116
+ $this->assertNotFalse( strpos( $content, $snippet) );
117
+ }
118
+
119
+ public function test_official_facebook_pixel_ninja_forms() {
120
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressNinjaForms.php' );
121
+ $snippet = "add_action(
122
+ 'ninja_forms_submission_actions',
123
+ array(__CLASS__, 'injectLeadEvent'),
124
+ 10, 3);";
125
+
126
+ $this->assertNotFalse( strpos( $content, $snippet) );
127
+ }
128
+
129
+ public function test_official_facebook_pixel_woocommerce() {
130
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressWooCommerce.php' );
131
+ $snippets[] = "add_action('woocommerce_after_checkout_form',
132
+ array(__CLASS__, 'trackInitiateCheckout'),
133
+ 40);";
134
+ $snippets[] = "add_action( 'woocommerce_add_to_cart',
135
+ array(__CLASS__, 'trackAddToCartEvent'),
136
+ 40, 4);";
137
+ $snippets[] = "add_action( 'woocommerce_thankyou',
138
+ array(__CLASS__, 'trackPurchaseEvent'),
139
+ 40);";
140
+ $snippets[] = "add_action( 'woocommerce_payment_complete',
141
+ array(__CLASS__, 'trackPurchaseEvent'),
142
+ 40);";
143
+
144
+ foreach($snippets as $snippet) {
145
+ $this->assertNotFalse( strpos( $content, $snippet) );
146
+ }
147
+ }
148
+
149
+ public function test_official_facebook_pixel_WPECommerce() {
150
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressWPECommerce.php' );
151
+ $snippets[] = "add_action('wpsc_add_to_cart_json_response',
152
+ array(__CLASS__, 'injectAddToCartEvent'), 11);";
153
+ $snippets[] = "self::addPixelFireForHook(array(
154
+ 'hook_name' => 'wpsc_before_shopping_cart_page',
155
+ 'classname' => __CLASS__,
156
+ 'inject_function' => 'injectInitiateCheckoutEvent'));";
157
+ $snippets[] = "add_action(
158
+ 'wpsc_transaction_results_shutdown',
159
+ array(__CLASS__, 'injectPurchaseEvent'), 11, 3);";
160
+
161
+ foreach($snippets as $snippet) {
162
+ $this->assertNotFalse( strpos( $content, $snippet) );
163
+ }
164
+ }
165
+
166
+ public function test_official_facebook_pixel_wp_forms() {
167
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressWPForms.php' );
168
+ $snippets[] = "add_action(
169
+ 'wp_footer',
170
+ array(__CLASS__, 'injectLeadEvent'),
171
+ 20
172
+ );";
173
+ $snippets[] = "add_action(
174
+ 'wpforms_process_before',
175
+ array(__CLASS__, 'trackEvent'),
176
+ 20,
177
+ 2
178
+ );";
179
+
180
+ foreach($snippets as $snippet) {
181
+ $this->assertNotFalse( strpos( $content, $snippet) );
182
+ }
183
+ }
184
+
185
+ public function test_official_facebook_pixel_integration_base() {
186
+ $content = $this->curl_get_content( self::TRUNK . 'integration/FacebookWordpressIntegrationBase.php' );
187
+
188
+ $snippet = 'add_action(
189
+ \'wp_footer\',
190
+ $hook_wp_footer,
191
+ 11);';
192
+
193
+ $this->assertNotFalse( strpos( $content, $snippet) );
194
+ }
195
+ }
addons/tests/integration/addons/test-optinmonster.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Optinmonster extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Optinmonster extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_optinmonster() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/optinmonster/trunk/OMAPI/Output.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', array( $this, \'api_script\' ) );') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Optinmonster extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_optinmonster() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/optinmonster/trunk/OMAPI/Output.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_enqueue_scripts\', array( $this, \'api_script\' ) );') );
20
  }
addons/tests/integration/addons/test-pixel-caffeine.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Pixel_Caffeine extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Pixel_Caffeine extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_pixel_caffeine() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/pixel-caffeine/trunk/includes/class-aepc-pixel-scripts.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( __CLASS__, \'pixel_init\' ), 99 );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', array( __CLASS__, \'pixel_init\' ), 1 );') );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Pixel_Caffeine extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_pixel_caffeine() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/pixel-caffeine/trunk/includes/class-aepc-pixel-scripts.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( __CLASS__, \'pixel_init\' ), 99 );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', array( __CLASS__, \'pixel_init\' ), 1 );') );
addons/tests/integration/addons/test-simple-share-buttons-adder.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Simple_Share_Buttons_Adder extends \WP_UnitTestCase {
6
 
7
  /**
8
  * This will cover the existince of the wp_enqueue_script ssba-sharethis
@@ -12,7 +12,7 @@
12
  * @since 3.6.5
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/simple-share-buttons-adder/trunk/php/class-styles.php' );
16
 
17
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script('ssba-sharethis'" ) );
18
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Simple_Share_Buttons_Adder extends Addons_Base {
6
 
7
  /**
8
  * This will cover the existince of the wp_enqueue_script ssba-sharethis
12
  * @since 3.6.5
13
  */
14
  public function test_script_loader_tag_addtoany() {
15
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/simple-share-buttons-adder/trunk/php/class-styles.php' );
16
 
17
  $this->assertNotFalse( strpos( $content, "wp_enqueue_script('ssba-sharethis'" ) );
18
  }
addons/tests/integration/addons/test-wd-google-analytics.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Wd_Google_Analytics extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Wd_Google_Analytics extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_wd_google_analytics() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/wd-google-analytics/trunk/gawd_class.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_head\', array($this, \'gawd_tracking_code\'), 99);') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Wd_Google_Analytics extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_wd_google_analytics() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/wd-google-analytics/trunk/gawd_class.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_head\', array($this, \'gawd_tracking_code\'), 99);') );
20
  }
addons/tests/integration/addons/test-wp-analytify.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Wp_Analytify extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Wp_Analytify extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_wp_analytify() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/wp-analytify/trunk/wp-analytify.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( $this, \'analytify_add_analytics_code\' ) );') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Wp_Analytify extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_wp_analytify() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/wp-analytify/trunk/wp-analytify.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( $this, \'analytify_add_analytics_code\' ) );') );
20
  }
addons/tests/integration/addons/test-wp-mautic.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Wp_Mautic extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Wp_Mautic extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_wp_mautic() {
17
- $content = file_get_contents( 'https://plugins.svn.wordpress.org/wp-mautic/trunk/wpmautic.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', \'wpmautic_inject_script\' );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', \'wpmautic_inject_script\' );') );
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Wp_Mautic extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_wp_mautic() {
17
+ $content = $this->curl_get_content( 'https://plugins.svn.wordpress.org/wp-mautic/trunk/wpmautic.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', \'wpmautic_inject_script\' );') );
20
  $this->assertNotFalse( strpos( $content, 'add_action( \'wp_footer\', \'wpmautic_inject_script\' );') );
addons/tests/integration/addons/test-wp-piwik.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
- class Test_Wp_Piwik extends \WP_UnitTestCase {
6
 
7
  public function setUp() {
8
 
@@ -14,7 +14,7 @@ class Test_Wp_Piwik extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/wp-piwik/trunk/classes/WP_Piwik.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, '\'disableCookies\' => self::$settings->getGlobalOption ( \'disable_cookies\' ) ? 1 : 0') );
20
  }
2
 
3
  namespace cookiebot_addons\tests\integration\addons;
4
 
5
+ class Test_Wp_Piwik extends Addons_Base {
6
 
7
  public function setUp() {
8
 
14
  * @since 2.1.0
15
  */
16
  public function test_host_analyticsjs_local() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/wp-piwik/trunk/classes/WP_Piwik.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, '\'disableCookies\' => self::$settings->getGlobalOption ( \'disable_cookies\' ) ? 1 : 0') );
20
  }
addons/tests/integration/test-buffer-priorities.php CHANGED
@@ -2,7 +2,9 @@
2
 
3
  namespace cookiebot_addons\tests\integration;
4
 
5
- class Test_Buffer_Priorities extends \WP_UnitTestCase {
 
 
6
 
7
  public function setUp() {
8
 
@@ -12,7 +14,7 @@ class Test_Buffer_Priorities extends \WP_UnitTestCase {
12
  * @covers \cookiebot_addons\controller\addons\custom_facebook_feed\Custom_Facebook_Feed
13
  */
14
  public function test_custom_facebook_feed() {
15
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/custom-facebook-feed/trunk/custom-facebook-feed.php' );
16
 
17
  $this->assertNotFalse( strpos( $content, "add_action( 'wp_footer', 'cff_js' );" ) );
18
  }
@@ -21,18 +23,21 @@ class Test_Buffer_Priorities extends \WP_UnitTestCase {
21
  * @covers \cookiebot_addons\controller\addons\caos_host_analyticsjs_local\CAOS_Host_Analyticsjs_Local
22
  */
23
  public function test_host_analyticsjs_local() {
24
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/trunk/save-ga-local.php' );
25
-
26
- $this->assertNotFalse( strpos( $content, 'add_action(\'wp_footer\', \'add_ga_header_script\', $sgal_enqueue_order);' ) );
27
- $this->assertNotFalse( strpos( $content, 'add_action(\'wp_head\', \'add_ga_header_script\', $sgal_enqueue_order);' ) );
 
 
 
28
  }
29
 
30
  /**
31
  * @covers \cookiebot_addons\controller\addons\ga_google_analytics\Ga_Google_Analytics
32
  */
33
  public function test_ga_google_analytics() {
34
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/ga-google-analytics/trunk/inc/plugin-core.php' );
35
-
36
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_head\', $function);' ) );
37
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_footer\', $function);' ) );
38
  }
2
 
3
  namespace cookiebot_addons\tests\integration;
4
 
5
+ use cookiebot_addons\tests\integration\addons\Addons_Base;
6
+
7
+ class Test_Buffer_Priorities extends Addons_Base {
8
 
9
  public function setUp() {
10
 
14
  * @covers \cookiebot_addons\controller\addons\custom_facebook_feed\Custom_Facebook_Feed
15
  */
16
  public function test_custom_facebook_feed() {
17
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/custom-facebook-feed/trunk/custom-facebook-feed.php' );
18
 
19
  $this->assertNotFalse( strpos( $content, "add_action( 'wp_footer', 'cff_js' );" ) );
20
  }
23
  * @covers \cookiebot_addons\controller\addons\caos_host_analyticsjs_local\CAOS_Host_Analyticsjs_Local
24
  */
25
  public function test_host_analyticsjs_local() {
26
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/host-analyticsjs-local/trunk/includes/frontend/class-tracking.php' );
27
+
28
+ $this->assertNotFalse( strpos( $content,
29
+ 'add_filter(\'woocommerce_google_analytics_script_src\'' ) );
30
+
31
+ $this->assertNotFalse( strpos( $content,
32
+ '\'render_tracking_code\']' ) );
33
  }
34
 
35
  /**
36
  * @covers \cookiebot_addons\controller\addons\ga_google_analytics\Ga_Google_Analytics
37
  */
38
  public function test_ga_google_analytics() {
39
+ $content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/ga-google-analytics/trunk/inc/plugin-core.php' );
40
+
41
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_head\', $function);' ) );
42
  $this->assertNotFalse( strpos( $content, 'add_action(\'wp_footer\', $function);' ) );
43
  }
addons/tests/unit/test-addon-file-name.php CHANGED
@@ -2,10 +2,9 @@
2
 
3
  namespace cookiebot_addons\tests\unit;
4
 
5
- use DI\ContainerBuilder;
6
- use DI;
7
 
8
- class Test_Addon_File_Name extends \WP_UnitTestCase {
9
  /**
10
  * The file path of addons json
11
  *
@@ -18,8 +17,12 @@ class Test_Addon_File_Name extends \WP_UnitTestCase {
18
  * @var string
19
  */
20
  protected $file;
 
 
 
 
21
 
22
- public function setUp() {
23
  $this->get_plugins();
24
  }
25
 
@@ -43,19 +46,27 @@ class Test_Addon_File_Name extends \WP_UnitTestCase {
43
  }
44
 
45
  public function test_get_svn_url() {
46
- $settingsMock = $this->getMockBuilder( 'cookiebot_addons\lib\Settings_Service_Interface' )->getMock();
47
- $scriptLoaderTagMock = $this->getMockBuilder( 'cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface' )->getMock();
48
- $cookieConsentMock = $this->getMockBuilder( 'cookiebot_addons\lib\Cookie_Consent_Interface' )->getMock();
49
- $bufferOutputMock = $this->getMockBuilder( 'cookiebot_addons\lib\buffer\Buffer_Output_Interface' )->getMock();
50
- $result = array();
 
 
 
 
 
 
 
51
 
52
  foreach ( $this->plugins as $plugin ) {
53
  $p = new $plugin->class( $settingsMock, $scriptLoaderTagMock, $cookieConsentMock, $bufferOutputMock );
54
- if ( method_exists( $p, 'get_svn_url' ) && ! $p->get_svn_url() ) {
 
55
  $svn_address = $p->get_svn_url();
56
  if ( ! empty( $svn_address ) ) {
57
- $content = file_get_contents($svn_address);
58
- $this->assertNotFalse( $content, $plugin->class );
59
  }
60
  }
61
  }
2
 
3
  namespace cookiebot_addons\tests\unit;
4
 
5
+ use cookiebot_addons\tests\integration\addons\Addons_Base;
 
6
 
7
+ class Test_Addon_File_Name extends Addons_Base {
8
  /**
9
  * The file path of addons json
10
  *
17
  * @var string
18
  */
19
  protected $file;
20
+ /**
21
+ * @var mixed|void
22
+ */
23
+ private $plugins;
24
 
25
+ public function setUp() {
26
  $this->get_plugins();
27
  }
28
 
46
  }
47
 
48
  public function test_get_svn_url() {
49
+ $settingsMock = $this->getMockBuilder('cookiebot_addons\lib\Settings_Service_Interface')
50
+ ->disableOriginalConstructor()
51
+ ->getMock();
52
+ $scriptLoaderTagMock = $this->getMockBuilder('cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface')
53
+ ->disableOriginalConstructor()
54
+ ->getMock();
55
+ $cookieConsentMock = $this->getMockBuilder('cookiebot_addons\lib\Cookie_Consent_Interface')
56
+ ->disableOriginalConstructor()
57
+ ->getMock();
58
+ $bufferOutputMock = $this->getMockBuilder('cookiebot_addons\lib\buffer\Buffer_Output_Interface')
59
+ ->disableOriginalConstructor()
60
+ ->getMock();
61
 
62
  foreach ( $this->plugins as $plugin ) {
63
  $p = new $plugin->class( $settingsMock, $scriptLoaderTagMock, $cookieConsentMock, $bufferOutputMock );
64
+
65
+ if ( method_exists( $p, 'get_svn_url' ) ) {
66
  $svn_address = $p->get_svn_url();
67
  if ( ! empty( $svn_address ) ) {
68
+ $content = $this->curl_get_content($svn_address);
69
+ $this->assertNotFalse( $content );
70
  }
71
  }
72
  }
addons/tests/unit/test-get-option-name.php CHANGED
@@ -17,8 +17,12 @@ class Test_Get_Option_Name extends \WP_UnitTestCase {
17
  * @var string
18
  */
19
  protected $file;
 
 
 
 
20
 
21
- /**
22
  * Get the plugins
23
  *
24
  * @since 1.8.0
@@ -63,10 +67,18 @@ class Test_Get_Option_Name extends \WP_UnitTestCase {
63
  public function test_get_option_name_unique() {
64
  $options = array();
65
 
66
- $settingsMock = $this->getMockBuilder( 'cookiebot_addons\lib\Settings_Service_Interface' )->getMock();
67
- $scriptLoaderTagMock = $this->getMockBuilder( 'cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface' )->getMock();
68
- $cookieConsentMock = $this->getMockBuilder( 'cookiebot_addons\lib\Cookie_Consent_Interface' )->getMock();
69
- $bufferOutputMock = $this->getMockBuilder( 'cookiebot_addons\lib\buffer\Buffer_Output_Interface' )->getMock();
 
 
 
 
 
 
 
 
70
 
71
  foreach ( $this->plugins as $plugin ) {
72
  $p = new $plugin->class( $settingsMock, $scriptLoaderTagMock, $cookieConsentMock, $bufferOutputMock );
17
  * @var string
18
  */
19
  protected $file;
20
+ /**
21
+ * @var mixed|void
22
+ */
23
+ private $plugins;
24
 
25
+ /**
26
  * Get the plugins
27
  *
28
  * @since 1.8.0
67
  public function test_get_option_name_unique() {
68
  $options = array();
69
 
70
+ $settingsMock = $this->getMockBuilder( 'cookiebot_addons\lib\Settings_Service_Interface' )
71
+ ->disableOriginalConstructor()
72
+ ->getMock();
73
+ $scriptLoaderTagMock = $this->getMockBuilder( 'cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface' )
74
+ ->disableOriginalConstructor()
75
+ ->getMock();
76
+ $cookieConsentMock = $this->getMockBuilder( 'cookiebot_addons\lib\Cookie_Consent_Interface' )
77
+ ->disableOriginalConstructor()
78
+ ->getMock();
79
+ $bufferOutputMock = $this->getMockBuilder( 'cookiebot_addons\lib\buffer\Buffer_Output_Interface' )
80
+ ->disableOriginalConstructor()
81
+ ->getMock();
82
 
83
  foreach ( $this->plugins as $plugin ) {
84
  $p = new $plugin->class( $settingsMock, $scriptLoaderTagMock, $cookieConsentMock, $bufferOutputMock );
addons/tests/unit/test-manipulate-script.php CHANGED
@@ -221,7 +221,8 @@ var ywot = {'p':''};
221
  <noscript><style>.woocommerce-product-gallery{ opacity: 1 !important; }</style></noscript>
222
  <meta name='onesignal' content='wordpress-plugin'>
223
  <link rel='manifest' href='https://www.ursula-sandner.com/wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/manifest.json.php?gcm_sender_id='>
224
- <script src='https://cdn.onesignal.com/sdks/OneSignalSDK.js' async=''></script> <script>
 
225
 
226
  window.OneSignal = window.OneSignal || [];
227
 
@@ -293,7 +294,27 @@ oneSignal_options['notifyButton']['text']['dialog.blocked.message'] = 'Urmează
293
  );
294
 
295
  $changed_header = cookiebot_addons_manipulate_script( $buffer, $keywords );
296
-
297
- $this->assertNotFalse( strpos( $changed_header, 'data-cookieconsent="statistics" src=\'https://cdn.onesignal.com/sdks/OneSignalSDK.js\'' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
  }
221
  <noscript><style>.woocommerce-product-gallery{ opacity: 1 !important; }</style></noscript>
222
  <meta name='onesignal' content='wordpress-plugin'>
223
  <link rel='manifest' href='https://www.ursula-sandner.com/wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/manifest.json.php?gcm_sender_id='>
224
+ <script src='https://cdn.onesignal.com/sdks/OneSignalSDK.js' async=''/>
225
+ <script>
226
 
227
  window.OneSignal = window.OneSignal || [];
228
 
294
  );
295
 
296
  $changed_header = cookiebot_addons_manipulate_script( $buffer, $keywords );
297
+
298
+ $expected_replacements = array();
299
+
300
+ ob_start(); // first match
301
+ ?><script type="text/plain" data-cookieconsent="marketing">{'@context':'https:\/\/schema.org','@type':'Person','url':'https:\/\/www.ursula-sandner.com\/','sameAs':['https:\/\/www.facebook.com\/SandnerMindConsulting','https:\/\/instagram.com\/ursula.sandner','https:\/\/twitter.com\/psihotimisoara'],'@id':'#person','name':'Ursula Yvonne Sandner'}</script><?php
302
+ $expected_replacements[] = ob_get_clean();
303
+
304
+ ob_start(); // second match
305
+ ?><script type='text/plain' data-cfasync='false' data-cookieconsent='statistics'><?php
306
+ $expected_replacements[] = ob_get_clean();
307
+
308
+ ob_start(); // third match
309
+ ?><script type="text/plain" data-cookieconsent="statistics" src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script><?php
310
+ $expected_replacements[] = ob_get_clean();
311
+
312
+ ob_start(); // fourth match
313
+ ?><script type="text/plain" data-cookieconsent="statistics"><?php
314
+ $expected_replacements[] = ob_get_clean();
315
+
316
+ foreach($expected_replacements as $expected_replacement) {
317
+ $this->assertNotFalse( strpos( $changed_header, $expected_replacement ) );
318
+ }
319
  }
320
  }
cookiebot.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
4
  Plugin URI: https://cookiebot.com/
5
  Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
6
  Author: Cybot A/S
7
- Version: 3.7.1
8
  Author URI: http://cookiebot.com
9
  Text Domain: cookiebot
10
  Domain Path: /langs
@@ -21,7 +21,7 @@ final class Cookiebot_WP {
21
  * @var string
22
  * @since 1.0.0
23
  */
24
- public $version = '3.7.1';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
@@ -1206,7 +1206,7 @@ final class Cookiebot_WP {
1206
  <table class="form-table">
1207
  <tbody>
1208
  <tr valign="top">
1209
- <th scope="row"><label>Enable CCPA banner for visitors from California</label></th>
1210
  <td>
1211
  <input type="checkbox" name="cookiebot-ccpa" value="1" <?php checked(1,get_option('cookiebot-ccpa'), true); ?>>
1212
  </td>
4
  Plugin URI: https://cookiebot.com/
5
  Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
6
  Author: Cybot A/S
7
+ Version: 3.8.0
8
  Author URI: http://cookiebot.com
9
  Text Domain: cookiebot
10
  Domain Path: /langs
21
  * @var string
22
  * @since 1.0.0
23
  */
24
+ public $version = '3.8.0';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
1206
  <table class="form-table">
1207
  <tbody>
1208
  <tr valign="top">
1209
+ <th scope="row"><label>Enable CCPA configuration for visitors from California</label></th>
1210
  <td>
1211
  <input type="checkbox" name="cookiebot-ccpa" value="1" <?php checked(1,get_option('cookiebot-ccpa'), true); ?>>
1212
  </td>
phpunit.xml CHANGED
@@ -5,10 +5,9 @@
5
  convertErrorsToExceptions="true"
6
  convertNoticesToExceptions="true"
7
  convertWarningsToExceptions="true"
8
- strict="true"
9
  >
10
  <testsuites>
11
- <testsuite>
12
  <directory prefix="test" suffix=".php">./addons/tests/</directory>
13
  </testsuite>
14
  </testsuites>
5
  convertErrorsToExceptions="true"
6
  convertNoticesToExceptions="true"
7
  convertWarningsToExceptions="true"
 
8
  >
9
  <testsuites>
10
+ <testsuite name="addons">
11
  <directory prefix="test" suffix=".php">./addons/tests/</directory>
12
  </testsuite>
13
  </testsuites>
readme.txt CHANGED
@@ -3,7 +3,7 @@
3
  * Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
4
  * Requires at least: 4.4
5
  * Tested up to: 5.4.2
6
- * Stable tag: 3.7.1
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
@@ -190,6 +190,10 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
190
 
191
  ## Changelog ##
192
 
 
 
 
 
193
  ### 3.7.1 - 2020-07-08 ###
194
  * Fix "wp_enqueue_script was called incorrectly" notice
195
 
3
  * Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
4
  * Requires at least: 4.4
5
  * Tested up to: 5.4.2
6
+ * Stable tag: 3.8.0
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
190
 
191
  ## Changelog ##
192
 
193
+ ### 3.8.0 - 2020-09-07 ###
194
+ * New addon for Official Facebook Pixel plugin
195
+ * Fixes and improvements
196
+
197
  ### 3.7.1 - 2020-07-08 ###
198
  * Fix "wp_enqueue_script was called incorrectly" notice
199
 
widgets/cookiebot-declaration-widget.php CHANGED
@@ -18,6 +18,7 @@ class Cookiebot_Declaration_Widget extends WP_Widget {
18
  public function form( $instance ) {
19
  $defaults = array('lang'=>'');
20
  extract( wp_parse_args( ( array ) $instance, $defaults ) );
 
21
  ?>
22
  <p>
23
  <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'Cookiebot' ); ?></label>
18
  public function form( $instance ) {
19
  $defaults = array('lang'=>'');
20
  extract( wp_parse_args( ( array ) $instance, $defaults ) );
21
+ $title = (isset($title) ? $title : '');
22
  ?>
23
  <p>
24
  <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'Cookiebot' ); ?></label>