tracking-code-manager
Last commit date
assets
3 years ago
includes
3 years ago
languages
3 years ago
.gitattributes
3 years ago
.gitignore
3 years ago
autoload.php
3 years ago
index.php
3 years ago
readme.txt
3 years ago
screenshot-1.png
11 years ago
screenshot-2.png
11 years ago
screenshot-3.png
11 years ago
screenshot-4.png
11 years ago
screenshot-5.png
11 years ago
index.php
273 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Tracking Code Manager |
| 4 | Plugin URI: http://intellywp.com/tracking-code-manager/ |
| 5 | Description: A plugin to manage ALL your tracking code and conversion pixels, simply. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads, WP eCommerce. |
| 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 | */ |
| 13 | if ( defined( 'TCMP_PLUGIN_NAME' ) ) { |
| 14 | function tcmp_admin_notices() { |
| 15 | global $tcmp; ?> |
| 16 | <div style="clear:both"></div> |
| 17 | <div class="error iwp" style="padding:10px;"> |
| 18 | <?php $tcmp->lang->P( 'PluginProAlreadyInstalled' ); ?> |
| 19 | </div> |
| 20 | <div style="clear:both"></div> |
| 21 | <?php |
| 22 | } |
| 23 | add_action( 'admin_notices', 'tcmp_admin_notices' ); |
| 24 | return; |
| 25 | } |
| 26 | 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__ ) . '/' ); |
| 34 | define( 'TCMP_PLUGIN_ASSETS_URI', plugins_url( 'assets/', __FILE__ ) ); |
| 35 | define( 'TCMP_PLUGIN_IMAGES_URI', plugins_url( 'assets/images/', __FILE__ ) ); |
| 36 | define( 'TCMP_PLUGIN_ACE', plugins_url( 'assets/js/ace/ace.js', __FILE__ ) ); |
| 37 | |
| 38 | define( 'TCMP_LOGGER', false ); |
| 39 | define( 'TCMP_AUTOSAVE_LANG', false ); |
| 40 | |
| 41 | define( 'TCMP_QUERY_POSTS_OF_TYPE', 1 ); |
| 42 | define( 'TCMP_QUERY_POST_TYPES', 2 ); |
| 43 | define( 'TCMP_QUERY_CATEGORIES', 3 ); |
| 44 | define( 'TCMP_QUERY_TAGS', 4 ); |
| 45 | define( 'TCMP_QUERY_CONVERSION_PLUGINS', 5 ); |
| 46 | define( 'TCMP_QUERY_TAXONOMY_TYPES', 6 ); |
| 47 | define( 'TCMP_QUERY_TAXONOMIES_OF_TYPE', 7 ); |
| 48 | |
| 49 | define( 'TCMP_INTELLYWP_ENDPOINT', 'http://www.intellywp.com/wp-content/plugins/intellywp-manager/data.php' ); |
| 50 | define( 'TCMP_PAGE_FAQ', 'http://www.intellywp.com/tracking-code-manager' ); |
| 51 | define( 'TCMP_PAGE_PREMIUM', 'http://www.intellywp.com/tracking-code-manager' ); |
| 52 | define( 'TCMP_PAGE_MANAGER', admin_url() . 'options-general.php?page=' . TCMP_PLUGIN_SLUG ); |
| 53 | define( 'TCMP_PLUGIN_URI', plugins_url( '/', __FILE__ ) ); |
| 54 | |
| 55 | define( 'TCMP_POSITION_HEAD', 0 ); |
| 56 | define( 'TCMP_POSITION_BODY', 1 ); |
| 57 | define( 'TCMP_POSITION_FOOTER', 2 ); |
| 58 | define( 'TCMP_POSITION_CONVERSION', 3 ); |
| 59 | |
| 60 | define( 'TCMP_TRACK_MODE_CODE', 0 ); |
| 61 | define( 'TCMP_TRACK_PAGE_ALL', 0 ); |
| 62 | define( 'TCMP_TRACK_PAGE_SPECIFIC', 1 ); |
| 63 | |
| 64 | define( 'TCMP_DEVICE_TYPE_MOBILE', 'mobile' ); |
| 65 | define( 'TCMP_DEVICE_TYPE_TABLET', 'tablet' ); |
| 66 | define( 'TCMP_DEVICE_TYPE_DESKTOP', 'desktop' ); |
| 67 | define( 'TCMP_DEVICE_TYPE_ALL', 'all' ); |
| 68 | |
| 69 | define( 'TCMP_HOOK_PRIORITY_DEFAULT', 10 ); |
| 70 | |
| 71 | define( 'TCMP_TAB_EDITOR', 'editor' ); |
| 72 | define( 'TCMP_TAB_EDITOR_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_EDITOR ); |
| 73 | define( 'TCMP_TAB_MANAGER', 'manager' ); |
| 74 | define( 'TCMP_TAB_MANAGER_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_MANAGER ); |
| 75 | define( 'TCMP_TAB_ADMIN_OPTIONS', 'admin options' ); |
| 76 | define( 'TCMP_TAB_ADMIN_OPTIONS_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_ADMIN_OPTIONS ); |
| 77 | define( 'TCMP_TAB_SETTINGS', 'settings' ); |
| 78 | define( 'TCMP_TAB_SETTINGS_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_SETTINGS ); |
| 79 | define( 'TCMP_TAB_DOCS', 'docs' ); |
| 80 | define( 'TCMP_TAB_DOCS_URI', 'http://intellywp.com/docs/category/tracking-code-manager/' ); |
| 81 | define( 'TCMP_TAB_DOCS_DCV_URI', 'https://data443.atlassian.net/servicedesk/customer/kb/view/947486813' ); |
| 82 | define( 'TCMP_TAB_ABOUT', 'about' ); |
| 83 | define( 'TCMP_TAB_ABOUT_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_ABOUT ); |
| 84 | define( 'TCMP_TAB_WHATS_NEW', 'whatsnew' ); |
| 85 | define( 'TCMP_TAB_WHATS_NEW_URI', TCMP_PAGE_MANAGER . '&tab=' . TCMP_TAB_WHATS_NEW ); |
| 86 | |
| 87 | define( 'TCMP_SNIPPETS_LIMIT', 6 ); |
| 88 | |
| 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; |
| 243 | $result = $tcmp->utils->qs( $name, $default ); |
| 244 | return $result; |
| 245 | } |
| 246 | //SANITIZED METHODS |
| 247 | function tcmp_sqs( $name, $default = '' ) { |
| 248 | $result = tcmp_qs( $name, $default ); |
| 249 | $result = sanitize_text_field( $result ); |
| 250 | return $result; |
| 251 | } |
| 252 | function tcmp_isqs( $name, $default = 0 ) { |
| 253 | $result = tcmp_sqs( $name, $default ); |
| 254 | $result = floatval( $result ); |
| 255 | return $result; |
| 256 | } |
| 257 | function tcmp_bsqs( $name, $default = 0 ) { |
| 258 | global $tcmp; |
| 259 | $result = $tcmp->utils->bqs( $name, $default ); |
| 260 | return $result; |
| 261 | } |
| 262 | function tcmp_asqs( $name, $default = array() ) { |
| 263 | $result = tcmp_qs( $name, $default ); |
| 264 | if ( is_array( $result ) ) { |
| 265 | foreach ( $result as $k => $v ) { |
| 266 | $result[ $k ] = sanitize_text_field( $v ); |
| 267 | } |
| 268 | } else { |
| 269 | $result = sanitize_text_field( $result ); |
| 270 | } |
| 271 | return $result; |
| 272 | } |
| 273 |