Tracking Code Manager - Version 2.0.15

Version Description

Release Date - 2022-8-25

  • IWP-499 Fix conflict with Jetpack
Download this release

Release Info

Developer data443
Plugin Icon 128x128 Tracking Code Manager
Version 2.0.15
Comparing to
See all releases

Code changes from version 2.0.14 to 2.0.15

includes/admin/AdminOptions.php CHANGED
@@ -11,10 +11,11 @@ function tcmp_ui_admin_options() {
11
  $tcmp->form->form_starts();
12
 
13
  if ( $tcmp->check->nonce( 'tcmp_admin_options' ) ) {
 
14
  $tcmp->options->setModifySuperglobalVariable( $tcmp->utils->iqs( 'checkbox' ) );
15
  $tcmp->options->setAdditionalRecognizedTags( $tcmp->utils->qs( 'tags' ) );
16
  $tcmp->options->setAdditionalRecognizedAttributes( $tcmp->utils->qs( 'attributes' ) );
17
- tcmp_add_additional_tags_atts();
18
  $tcmp->options->writeMessages();
19
  }
20
 
@@ -23,8 +24,14 @@ function tcmp_ui_admin_options() {
23
  $tags = $tcmp->options->getAdditionalRecognizedTags();
24
  $attributes = $tcmp->options->getAdditionalRecognizedAttributes();
25
 
26
- $tcmp->form->textarea('tags', $tags, array('rows' => 2,));
27
- $tcmp->form->textarea('attributes', $attributes, array('rows' => 2,));
 
 
 
 
 
 
28
 
29
  $tcmp->form->p( __( 'Enable option to change cache behavior' ) );
30
 
11
  $tcmp->form->form_starts();
12
 
13
  if ( $tcmp->check->nonce( 'tcmp_admin_options' ) ) {
14
+ $tcmp->options->setSkipCodeSanitization( $tcmp->utils->iqs( 'skipCodeSanitization' ) );
15
  $tcmp->options->setModifySuperglobalVariable( $tcmp->utils->iqs( 'checkbox' ) );
16
  $tcmp->options->setAdditionalRecognizedTags( $tcmp->utils->qs( 'tags' ) );
17
  $tcmp->options->setAdditionalRecognizedAttributes( $tcmp->utils->qs( 'attributes' ) );
18
+ tcmp_free_add_additional_tags_atts();
19
  $tcmp->options->writeMessages();
20
  }
21
 
24
  $tags = $tcmp->options->getAdditionalRecognizedTags();
25
  $attributes = $tcmp->options->getAdditionalRecognizedAttributes();
26
 
27
+ $tcmp->form->textarea( 'tags', $tags, array('rows' => 2) );
28
+ $tcmp->form->textarea( 'attributes', $attributes, array('rows' => 2) );
29
+
30
+ $tcmp->form->p( __( 'Skip the Sanitization of all Tracking Codes' ) );
31
+
32
+ $skip = $tcmp->options->getSkipCodeSanitization();
33
+
34
+ $tcmp->form->checkbox( 'skipCodeSanitization', $skip );
35
 
36
  $tcmp->form->p( __( 'Enable option to change cache behavior' ) );
37
 
includes/classes/core/Manager.php CHANGED
@@ -330,14 +330,9 @@ class TCMP_Manager {
330
  $codes = $tcmp->manager->get_codes( $position, $post, $args );
331
  if ( is_array( $codes ) && count( $codes ) > 0 ) {
332
  $version = TCMP_PLUGIN_VERSION;
333
- $text = "\n<!--BEGIN: TRACKING CODE (v$version) MANAGER BY INTELLYWP.COM IN $position_text//-->";
334
  foreach ( $codes as $v ) {
335
- $fixed = $this->fix_google_tag_corruption( $v );
336
- if ( strlen( $fixed ) > 0 ) {
337
- $text .= "\n$fixed";
338
- } else {
339
- $text .= "\n$v";
340
- }
341
  }
342
  $text .= "\n<!--END: https://wordpress.org/plugins/tracking-code-manager IN $position_text//-->";
343
 
@@ -350,8 +345,12 @@ class TCMP_Manager {
350
  }
351
 
352
  private function esc_js_code( $text ) {
 
353
  global $tcmp_allowed_html_tags;
354
- $text = wp_kses( $text, $tcmp_allowed_html_tags );
 
 
 
355
  $text = str_replace( '&lt;', '<', $text );
356
  $text = str_replace( '&gt;', '>', $text );
357
  $text = str_replace( '&amp;', '&', $text );
@@ -360,24 +359,6 @@ class TCMP_Manager {
360
  return $text;
361
  }
362
 
363
- private function fix_google_tag_corruption( $text ) {
364
- // confirm that we're not corrupting the google tag manger script, but if it's bad, fix it and update the db
365
- $pattern = "/<a href=(?:'|\")(https:\\/\\/www\\.googletagmanager\\.com\\/gtag\\/js\\?id=[a-zA-Z0-9\\-]+)(?:'|\")>(https:\\/\\/www\\.googletagmanager\\.com\\/gtag\\/js\\?id=[a-zA-Z0-9\\-]+)<\\/a>/";
366
- $matches = null;
367
- preg_match( $pattern, $text, $matches );
368
- if ( isset( $matches[1] ) && isset( $matches[2] ) && strlen( $matches[1] ) > 0 && $matches[1] === $matches[2] ) {
369
- $new = preg_replace( $pattern, '<script async src="$1"></script>', $text );
370
- $key = 'TCM_google_tag_fix';
371
- $count = get_option( $key, 0 );
372
- if ( 0 == $count ) {
373
- update_option( $key, ++$count );
374
- }
375
- $new .= "\n<!-- tag fix: ".$count." -->";
376
- return $new;
377
- }
378
- return '';
379
- }
380
-
381
  private function insert_dynamic_conversion_values( $purchase, $text ) {
382
  global $tcmp;
383
  $purchase->user_id = intval( $purchase->user_id );
330
  $codes = $tcmp->manager->get_codes( $position, $post, $args );
331
  if ( is_array( $codes ) && count( $codes ) > 0 ) {
332
  $version = TCMP_PLUGIN_VERSION;
333
+ $text = "\n<!--BEGIN: TRACKING CODE MANAGER (v$version) BY INTELLYWP.COM IN $position_text//-->";
334
  foreach ( $codes as $v ) {
335
+ $text .= "\n$v";
 
 
 
 
 
336
  }
337
  $text .= "\n<!--END: https://wordpress.org/plugins/tracking-code-manager IN $position_text//-->";
338
 
345
  }
346
 
347
  private function esc_js_code( $text ) {
348
+ global $tcmp;
349
  global $tcmp_allowed_html_tags;
350
+
351
+ if ( ! $tcmp->options->getSkipCodeSanitization() ) {
352
+ $text = wp_kses( $text, $tcmp_allowed_html_tags );
353
+ }
354
  $text = str_replace( '&lt;', '<', $text );
355
  $text = str_replace( '&gt;', '>', $text );
356
  $text = str_replace( '&amp;', '&', $text );
359
  return $text;
360
  }
361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  private function insert_dynamic_conversion_values( $purchase, $text ) {
363
  global $tcmp;
364
  $purchase->user_id = intval( $purchase->user_id );
includes/classes/utils/Options.php CHANGED
@@ -118,11 +118,15 @@ class TCMP_Options {
118
  }
119
 
120
  public function recursive_wp_kses( $array ) {
 
121
  foreach ( $array as $key => &$value ) {
122
  if ( is_array( $value ) ) {
123
  $value = $this->recursive_wp_kses( $value );
 
 
 
 
124
  } elseif ( is_string( $value ) ) {
125
- global $tcmp_allowed_html_tags;
126
  $value = wp_kses( $value, $tcmp_allowed_html_tags );
127
  } else {
128
  // do nothing ... could be a video or graphics object
@@ -494,4 +498,18 @@ class TCMP_Options {
494
  public function setHookPriority( $value ) {
495
  $this->setOption( 'HookPriority', $value );
496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  }
118
  }
119
 
120
  public function recursive_wp_kses( $array ) {
121
+ global $tcmp_allowed_html_tags;
122
  foreach ( $array as $key => &$value ) {
123
  if ( is_array( $value ) ) {
124
  $value = $this->recursive_wp_kses( $value );
125
+ } elseif ( 'code' == $key ) {
126
+ if ( ! $this->getSkipCodeSanitization() ) {
127
+ $value = wp_kses( $value, $tcmp_allowed_html_tags );
128
+ }
129
  } elseif ( is_string( $value ) ) {
 
130
  $value = wp_kses( $value, $tcmp_allowed_html_tags );
131
  } else {
132
  // do nothing ... could be a video or graphics object
498
  public function setHookPriority( $value ) {
499
  $this->setOption( 'HookPriority', $value );
500
  }
501
+
502
+ // Skip Code Sanitization
503
+ public function getSkipCodeSanitization() {
504
+ return $this->getOption( 'SkipCodeSanitization', false );
505
+ }
506
+
507
+ public function setSkipCodeSanitization( $value ) {
508
+ global $tcmp;
509
+ if ( $tcmp->utils->isTrue( $value ) ) {
510
+ $this->setOption( 'SkipCodeSanitization', true );
511
+ } else {
512
+ $this->setOption( 'SkipCodeSanitization', false );
513
+ }
514
+ }
515
  }
index.php CHANGED
@@ -6,7 +6,7 @@ Description: A plugin to manage ALL your tracking code and conversion pixels, si
6
  Author: Data443
7
  Author URI: https://data443.com/
8
  Email: support@data443.com
9
- Version: 2.0.14
10
  Requires at least: 3.6.0
11
  Requires PHP: 5.6
12
  */
@@ -27,7 +27,7 @@ define( 'TCMP_PLUGIN_PREFIX', 'TCMP_' );
27
  define( 'TCMP_PLUGIN_FILE', __FILE__ );
28
  define( 'TCMP_PLUGIN_SLUG', 'tracking-code-manager' );
29
  define( 'TCMP_PLUGIN_NAME', 'Tracking Code Manager' );
30
- define( 'TCMP_PLUGIN_VERSION', '2.0.14' );
31
  define( 'TCMP_PLUGIN_AUTHOR', 'IntellyWP' );
32
 
33
  define( 'TCMP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
@@ -89,154 +89,13 @@ define( 'TCMP_SNIPPETS_LIMIT', 6 );
89
  include_once( dirname( __FILE__ ) . '/autoload.php' );
90
  tcmp_include_php( dirname( __FILE__ ) . '/includes/' );
91
 
92
- global $tcmp_allowed_html_tags;
93
- $tcmp_allowed_atts = array(
94
- 'action' => array(),
95
- 'align' => array(),
96
- 'alt' => array(),
97
- 'async' => array(),
98
- 'class' => array(),
99
- 'content' => array(),
100
- 'crossorigin' => array(),
101
- 'data-blockingmode' => array(),
102
- 'data-cbid' => array(),
103
- 'data-form-block-id' => array(),
104
- 'data-hostname' => array(),
105
- 'data-website-id' => array(),
106
- 'data' => array(),
107
- 'defer' => array(),
108
- 'dir' => array(),
109
- 'for' => array(),
110
- 'height' => array(),
111
- 'href' => array(),
112
- 'id' => array(),
113
- 'integrity' => array(),
114
- 'lang' => array(),
115
- 'loading' => array(),
116
- 'method' => array(),
117
- 'name' => array(),
118
- 'nomodule' => array(),
119
- 'novalidate' => array(),
120
- 'onload' => array(),
121
- 'referrerpolicy' => array(),
122
- 'rel' => array(),
123
- 'rev' => array(),
124
- 'sandbox' => array(),
125
- 'src' => array(),
126
- 'style' => array(),
127
- 'tabindex' => array(),
128
- 'target' => array(),
129
- 'title' => array(),
130
- 'type' => array(),
131
- 'uetq' => array(),
132
- 'value' => array(),
133
- 'width' => array(),
134
- 'xml:lang' => array(),
135
- );
136
- $tcmp_allowed_html_tags['a'] = $tcmp_allowed_atts;
137
- $tcmp_allowed_html_tags['abbr'] = $tcmp_allowed_atts;
138
- $tcmp_allowed_html_tags['b'] = $tcmp_allowed_atts;
139
- $tcmp_allowed_html_tags['body'] = $tcmp_allowed_atts;
140
- $tcmp_allowed_html_tags['br'] = $tcmp_allowed_atts;
141
- $tcmp_allowed_html_tags['code'] = $tcmp_allowed_atts;
142
- $tcmp_allowed_html_tags['div'] = $tcmp_allowed_atts;
143
- $tcmp_allowed_html_tags['em'] = $tcmp_allowed_atts;
144
- $tcmp_allowed_html_tags['form'] = $tcmp_allowed_atts;
145
- $tcmp_allowed_html_tags['h1'] = $tcmp_allowed_atts;
146
- $tcmp_allowed_html_tags['h2'] = $tcmp_allowed_atts;
147
- $tcmp_allowed_html_tags['h3'] = $tcmp_allowed_atts;
148
- $tcmp_allowed_html_tags['h4'] = $tcmp_allowed_atts;
149
- $tcmp_allowed_html_tags['h5'] = $tcmp_allowed_atts;
150
- $tcmp_allowed_html_tags['h6'] = $tcmp_allowed_atts;
151
- $tcmp_allowed_html_tags['hr'] = $tcmp_allowed_atts;
152
- $tcmp_allowed_html_tags['i'] = $tcmp_allowed_atts;
153
- $tcmp_allowed_html_tags['iframe'] = $tcmp_allowed_atts;
154
- $tcmp_allowed_html_tags['img'] = $tcmp_allowed_atts;
155
- $tcmp_allowed_html_tags['input'] = $tcmp_allowed_atts;
156
- $tcmp_allowed_html_tags['label'] = $tcmp_allowed_atts;
157
- $tcmp_allowed_html_tags['li'] = $tcmp_allowed_atts;
158
- $tcmp_allowed_html_tags['meta'] = $tcmp_allowed_atts;
159
- $tcmp_allowed_html_tags['noscript'] = $tcmp_allowed_atts;
160
- $tcmp_allowed_html_tags['ol'] = $tcmp_allowed_atts;
161
- $tcmp_allowed_html_tags['p'] = $tcmp_allowed_atts;
162
- $tcmp_allowed_html_tags['pre'] = $tcmp_allowed_atts;
163
- $tcmp_allowed_html_tags['script'] = $tcmp_allowed_atts;
164
- $tcmp_allowed_html_tags['small'] = $tcmp_allowed_atts;
165
- $tcmp_allowed_html_tags['span'] = $tcmp_allowed_atts;
166
- $tcmp_allowed_html_tags['strong'] = $tcmp_allowed_atts;
167
- $tcmp_allowed_html_tags['style'] = $tcmp_allowed_atts;
168
- $tcmp_allowed_html_tags['table'] = $tcmp_allowed_atts;
169
- $tcmp_allowed_html_tags['td'] = $tcmp_allowed_atts;
170
- $tcmp_allowed_html_tags['textarea'] = $tcmp_allowed_atts;
171
- $tcmp_allowed_html_tags['tr'] = $tcmp_allowed_atts;
172
- $tcmp_allowed_html_tags['ul'] = $tcmp_allowed_atts;
173
- global $tcmp_default_tags;
174
- global $tcmp_default_attrs;
175
- $tcmp_default_tags = $tcmp_allowed_html_tags;
176
- $tcmp_default_attrs = $tcmp_allowed_atts;
177
-
178
  global $tcmp;
179
  $tcmp = new TCMP_Singleton();
180
  $tcmp->init();
181
 
182
- function tcmp_add_additional_tags_atts() {
183
- global $tcmp;
184
- global $tcmp_allowed_html_tags;
185
- global $tcmp_allowed_atts;
186
- global $tcmp_default_tags;
187
- global $tcmp_default_attrs;
188
-
189
- $tags = explode( ',', sanitize_text_field( $tcmp->options->getAdditionalRecognizedTags() ) );
190
- $attrs = explode( ',', sanitize_text_field( $tcmp->options->getAdditionalRecognizedAttributes() ) );
191
-
192
- $remove = false;
193
- $update_attrs = array();
194
- foreach ( $attrs as $a ) {
195
- $a = trim( $a );
196
- if ( strlen( $a ) > 0 ) {
197
- if ( ! isset( $tcmp_allowed_atts[ $a ] ) ) {
198
- $tcmp_allowed_atts[ $a ] = array();
199
- $update_attrs[] = $a;
200
- } else {
201
- if ( isset( $tcmp_default_attrs[ $a ] ) ) {
202
- $tcmp->options->pushInfoMessage( '<span style="text-transform:uppercase"><strong>' . $a . '</strong></span> is already in the attribute whitelist' );
203
- $remove = true;
204
- }
205
- }
206
- }
207
- }
208
- if ( $remove ) {
209
- $new = implode( ',', $update_attrs );
210
- $tcmp->options->setAdditionalRecognizedAttributes( $new );
211
- }
212
-
213
- $remove = false;
214
- $update_tags = array();
215
- foreach ( $tags as $t ) {
216
- $t = trim( $t );
217
- if ( strlen( $t ) > 0 ) {
218
- if ( ! isset( $tcmp_allowed_html_tags[ $t ] ) ) {
219
- $tcmp_allowed_html_tags[ $t ] = array();
220
- $update_tags[] = $t;
221
- } else {
222
- if ( isset( $tcmp_default_tags[ $t ] ) ) {
223
- $tcmp->options->pushInfoMessage( '<span style="text-transform:uppercase"><strong>' . $t . '</strong></span> is already in the tag whitelist' );
224
- $remove = true;
225
- }
226
- }
227
- }
228
- }
229
- if ( $remove ) {
230
- $new = implode( ',', $update_tags );
231
- $tcmp->options->setAdditionalRecognizedTags( $new );
232
- }
233
-
234
- foreach ( $tcmp_allowed_html_tags as $key => $value ) {
235
- $tcmp_allowed_html_tags[ $key ] = $tcmp_allowed_atts;
236
- }
237
- }
238
 
239
- tcmp_add_additional_tags_atts();
240
 
241
  function tcmp_qs( $name, $default = '' ) {
242
  global $tcmp;
6
  Author: Data443
7
  Author URI: https://data443.com/
8
  Email: support@data443.com
9
+ Version: 2.0.15
10
  Requires at least: 3.6.0
11
  Requires PHP: 5.6
12
  */
27
  define( 'TCMP_PLUGIN_FILE', __FILE__ );
28
  define( 'TCMP_PLUGIN_SLUG', 'tracking-code-manager' );
29
  define( 'TCMP_PLUGIN_NAME', 'Tracking Code Manager' );
30
+ define( 'TCMP_PLUGIN_VERSION', '2.0.15' );
31
  define( 'TCMP_PLUGIN_AUTHOR', 'IntellyWP' );
32
 
33
  define( 'TCMP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
89
  include_once( dirname( __FILE__ ) . '/autoload.php' );
90
  tcmp_include_php( dirname( __FILE__ ) . '/includes/' );
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  global $tcmp;
93
  $tcmp = new TCMP_Singleton();
94
  $tcmp->init();
95
 
96
+ include_once( dirname( __FILE__ ) . '/tcmp_free_wp_kses_tags_attrs.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
+ tcmp_free_add_additional_tags_atts();
99
 
100
  function tcmp_qs( $name, $default = '' ) {
101
  global $tcmp;
languages/Lang.txt CHANGED
@@ -3,6 +3,7 @@ AboutText1=We are Stefan and Alex, two guys in love with Wordpress, coding and m
3
  AboutText2=Feel free to reach us by the feedback form below.
4
  AboutTitle=We make Intelly plugins for your Intelly site
5
  AdminOptions.checkbox=Modify Superglobal Variable
 
6
  AdminOptions.tags=Tags <small>(separate multiple values with a comma)</small>
7
  AdminOptions.attributes=Attributes <small>(separate multiple values with a comma)</small>
8
  Actions=
3
  AboutText2=Feel free to reach us by the feedback form below.
4
  AboutTitle=We make Intelly plugins for your Intelly site
5
  AdminOptions.checkbox=Modify Superglobal Variable
6
+ AdminOptions.skipCodeSanitization=Skip code sanitization (check this if the code is not inserted correctly)
7
  AdminOptions.tags=Tags <small>(separate multiple values with a comma)</small>
8
  AdminOptions.attributes=Attributes <small>(separate multiple values with a comma)</small>
9
  Actions=
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: IntellyWP, Data443
3
  Tags: adwords remarketing, analytics conversion tracking, conversion pixel, conversion tracking, conversion tracking adwords, conversion tracking pixel, conversion tracking script,Facebook Ads, facebook conversion pixel, facebook custom audience, facebook retargeting, google adwords, google analytics web tracking code, google tag manager, html snippet, html snippets, html tracking code, javascript snippet, javascript snippets, header and footer, pay per click tracking, pixel tracking code, remarketing, retargeting, snippets, Tag Management, track conversion, track conversions, tracking code, tracking codes, tracking script, woocommerce, edd, easy digital downloads, wp ecommerce, wp e-commerce, gdpr, tracking gdpr, privacy
4
  Requires at least: 2.7
5
  Tested up to: 6.0
6
- Stable tag: 2.0.14
7
  Requires PHP: 5.6
8
 
9
  A plugin to manage ALL of your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads, ..
@@ -112,6 +112,11 @@ Have a look at the source code of your page (search for: Tracking Code Manager)
112
 
113
  For detailed release notes, see our documentation here: [https://intellywp.com/docs/category/tracking-code-manager/](https://intellywp.com/docs/category/tracking-code-manager/).
114
 
 
 
 
 
 
115
  = 2.0.14 =
116
  *Release Date - 2022-8-18*
117
 
3
  Tags: adwords remarketing, analytics conversion tracking, conversion pixel, conversion tracking, conversion tracking adwords, conversion tracking pixel, conversion tracking script,Facebook Ads, facebook conversion pixel, facebook custom audience, facebook retargeting, google adwords, google analytics web tracking code, google tag manager, html snippet, html snippets, html tracking code, javascript snippet, javascript snippets, header and footer, pay per click tracking, pixel tracking code, remarketing, retargeting, snippets, Tag Management, track conversion, track conversions, tracking code, tracking codes, tracking script, woocommerce, edd, easy digital downloads, wp ecommerce, wp e-commerce, gdpr, tracking gdpr, privacy
4
  Requires at least: 2.7
5
  Tested up to: 6.0
6
+ Stable tag: 2.0.15
7
  Requires PHP: 5.6
8
 
9
  A plugin to manage ALL of your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads, ..
112
 
113
  For detailed release notes, see our documentation here: [https://intellywp.com/docs/category/tracking-code-manager/](https://intellywp.com/docs/category/tracking-code-manager/).
114
 
115
+ = 2.0.15 =
116
+ *Release Date - 2022-8-25*
117
+
118
+ * IWP-499 Fix conflict with Jetpack
119
+
120
  = 2.0.14 =
121
  *Release Date - 2022-8-18*
122
 
tcmp_free_wp_kses_tags_attrs.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ global $tcmp_allowed_html_tags;
7
+ $tcmp_allowed_atts = array(
8
+ 'action' => array(),
9
+ 'align' => array(),
10
+ 'alt' => array(),
11
+ 'async' => array(),
12
+ 'class' => array(),
13
+ 'content' => array(),
14
+ 'crossorigin' => array(),
15
+ 'data-blockingmode' => array(),
16
+ 'data-cbid' => array(),
17
+ 'data-form-block-id' => array(),
18
+ 'data-hostname' => array(),
19
+ 'data-website-id' => array(),
20
+ 'data' => array(),
21
+ 'defer' => array(),
22
+ 'dir' => array(),
23
+ 'for' => array(),
24
+ 'height' => array(),
25
+ 'href' => array(),
26
+ 'id' => array(),
27
+ 'integrity' => array(),
28
+ 'lang' => array(),
29
+ 'loading' => array(),
30
+ 'method' => array(),
31
+ 'name' => array(),
32
+ 'nomodule' => array(),
33
+ 'novalidate' => array(),
34
+ 'onload' => array(),
35
+ 'referrerpolicy' => array(),
36
+ 'rel' => array(),
37
+ 'rev' => array(),
38
+ 'sandbox' => array(),
39
+ 'src' => array(),
40
+ 'style' => array(),
41
+ 'tabindex' => array(),
42
+ 'target' => array(),
43
+ 'title' => array(),
44
+ 'type' => array(),
45
+ 'uetq' => array(),
46
+ 'value' => array(),
47
+ 'width' => array(),
48
+ 'xml:lang' => array(),
49
+ );
50
+ $tcmp_allowed_html_tags['a'] = $tcmp_allowed_atts;
51
+ $tcmp_allowed_html_tags['abbr'] = $tcmp_allowed_atts;
52
+ $tcmp_allowed_html_tags['b'] = $tcmp_allowed_atts;
53
+ $tcmp_allowed_html_tags['body'] = $tcmp_allowed_atts;
54
+ $tcmp_allowed_html_tags['br'] = $tcmp_allowed_atts;
55
+ $tcmp_allowed_html_tags['code'] = $tcmp_allowed_atts;
56
+ $tcmp_allowed_html_tags['div'] = $tcmp_allowed_atts;
57
+ $tcmp_allowed_html_tags['em'] = $tcmp_allowed_atts;
58
+ $tcmp_allowed_html_tags['form'] = $tcmp_allowed_atts;
59
+ $tcmp_allowed_html_tags['h1'] = $tcmp_allowed_atts;
60
+ $tcmp_allowed_html_tags['h2'] = $tcmp_allowed_atts;
61
+ $tcmp_allowed_html_tags['h3'] = $tcmp_allowed_atts;
62
+ $tcmp_allowed_html_tags['h4'] = $tcmp_allowed_atts;
63
+ $tcmp_allowed_html_tags['h5'] = $tcmp_allowed_atts;
64
+ $tcmp_allowed_html_tags['h6'] = $tcmp_allowed_atts;
65
+ $tcmp_allowed_html_tags['hr'] = $tcmp_allowed_atts;
66
+ $tcmp_allowed_html_tags['i'] = $tcmp_allowed_atts;
67
+ $tcmp_allowed_html_tags['iframe'] = $tcmp_allowed_atts;
68
+ $tcmp_allowed_html_tags['img'] = $tcmp_allowed_atts;
69
+ $tcmp_allowed_html_tags['input'] = $tcmp_allowed_atts;
70
+ $tcmp_allowed_html_tags['label'] = $tcmp_allowed_atts;
71
+ $tcmp_allowed_html_tags['li'] = $tcmp_allowed_atts;
72
+ $tcmp_allowed_html_tags['meta'] = $tcmp_allowed_atts;
73
+ $tcmp_allowed_html_tags['noscript'] = $tcmp_allowed_atts;
74
+ $tcmp_allowed_html_tags['ol'] = $tcmp_allowed_atts;
75
+ $tcmp_allowed_html_tags['p'] = $tcmp_allowed_atts;
76
+ $tcmp_allowed_html_tags['pre'] = $tcmp_allowed_atts;
77
+ $tcmp_allowed_html_tags['script'] = $tcmp_allowed_atts;
78
+ $tcmp_allowed_html_tags['small'] = $tcmp_allowed_atts;
79
+ $tcmp_allowed_html_tags['span'] = $tcmp_allowed_atts;
80
+ $tcmp_allowed_html_tags['strong'] = $tcmp_allowed_atts;
81
+ $tcmp_allowed_html_tags['style'] = $tcmp_allowed_atts;
82
+ $tcmp_allowed_html_tags['table'] = $tcmp_allowed_atts;
83
+ $tcmp_allowed_html_tags['td'] = $tcmp_allowed_atts;
84
+ $tcmp_allowed_html_tags['textarea'] = $tcmp_allowed_atts;
85
+ $tcmp_allowed_html_tags['tr'] = $tcmp_allowed_atts;
86
+ $tcmp_allowed_html_tags['ul'] = $tcmp_allowed_atts;
87
+ global $tcmp_default_tags;
88
+ global $tcmp_default_attrs;
89
+ $tcmp_default_tags = $tcmp_allowed_html_tags;
90
+ $tcmp_default_attrs = $tcmp_allowed_atts;
91
+
92
+ function tcmp_free_add_additional_tags_atts() {
93
+ global $tcmp;
94
+ global $tcmp_allowed_html_tags;
95
+ global $tcmp_allowed_atts;
96
+ global $tcmp_default_tags;
97
+ global $tcmp_default_attrs;
98
+
99
+ $tags = explode( ',', sanitize_text_field( $tcmp->options->getAdditionalRecognizedTags() ) );
100
+ $attrs = explode( ',', sanitize_text_field( $tcmp->options->getAdditionalRecognizedAttributes() ) );
101
+
102
+ $remove = false;
103
+ $update_attrs = array();
104
+ foreach ( $attrs as $a ) {
105
+ $a = trim( $a );
106
+ if ( strlen( $a ) > 0 ) {
107
+ if ( ! isset( $tcmp_allowed_atts[ $a ] ) ) {
108
+ $tcmp_allowed_atts[ $a ] = array();
109
+ $update_attrs[] = $a;
110
+ } else {
111
+ if ( isset( $tcmp_default_attrs[ $a ] ) ) {
112
+ $tcmp->options->pushInfoMessage( '<span style="text-transform:uppercase"><strong>' . $a . '</strong></span> is already in the attribute whitelist' );
113
+ $remove = true;
114
+ }
115
+ }
116
+ }
117
+ }
118
+ if ( $remove ) {
119
+ $new = implode( ',', $update_attrs );
120
+ $tcmp->options->setAdditionalRecognizedAttributes( $new );
121
+ }
122
+
123
+ $remove = false;
124
+ $update_tags = array();
125
+ foreach ( $tags as $t ) {
126
+ $t = trim( $t );
127
+ if ( strlen( $t ) > 0 ) {
128
+ if ( ! isset( $tcmp_allowed_html_tags[ $t ] ) ) {
129
+ $tcmp_allowed_html_tags[ $t ] = array();
130
+ $update_tags[] = $t;
131
+ } else {
132
+ if ( isset( $tcmp_default_tags[ $t ] ) ) {
133
+ $tcmp->options->pushInfoMessage( '<span style="text-transform:uppercase"><strong>' . $t . '</strong></span> is already in the tag whitelist' );
134
+ $remove = true;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ if ( $remove ) {
140
+ $new = implode( ',', $update_tags );
141
+ $tcmp->options->setAdditionalRecognizedTags( $new );
142
+ }
143
+
144
+ foreach ( $tcmp_allowed_html_tags as $key => $value ) {
145
+ $tcmp_allowed_html_tags[ $key ] = $tcmp_allowed_atts;
146
+ }
147
+ }
148
+
149
+ function tcmp_free_jetpack_shortcode_callback( $shortcode_includes ) {
150
+ unset( $shortcode_includes['class.filter-embedded-html-objects'] );
151
+ return $shortcode_includes;
152
+ }
153
+
154
+ add_filter( 'jetpack_shortcodes_to_include', 'tcmp_free_jetpack_shortcode_callback' );