Changeset 3067755
- Timestamp:
- 04/09/2024 03:04:04 PM (2 years ago)
- Location:
- opt-out-for-google-analytics/trunk
- Files:
-
- 5 edited
-
inc/utils.class.php (modified) (1 diff)
-
lib/csstidy/class.csstidy.php (modified) (6 diffs)
-
lib/csstidy/class.csstidy_optimise.php (modified) (5 diffs)
-
lib/csstidy/class.csstidy_print.php (modified) (1 diff)
-
readme.txt (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
opt-out-for-google-analytics/trunk/inc/utils.class.php
r2896199 r3067755 411 411 elseif ( $data[ 'ga_plugin' ] == 'analytify' && class_exists( 'WP_Analytify' ) ) { 412 412 $analytify = WP_Analytify::get_instance(); 413 $anonymip_enabled = $analytify->settings->get_option( 'anonymize_ip', 'wp-analytify-advanced');413 $anonymip_enabled = ( 'on' == $analytify->settings->get_option( 'anonymize_ip', 'wp-analytify-advanced' ) ); 414 414 $anonymip_url = admin_url( 'admin.php?page=analytify-settings#wp-analytify-advanced' ); 415 415 $uacode_url = admin_url( 'admin.php?page=analytify-settings#wp-analytify-authentication' ); -
opt-out-for-google-analytics/trunk/lib/csstidy/class.csstidy.php
r2787042 r3067755 52 52 * @version 1.1.0 53 53 */ 54 require( 'class.csstidy_print.php');54 require(__DIR__ . DIRECTORY_SEPARATOR . 'class.csstidy_print.php'); 55 55 56 56 /** … … 59 59 * @version 1.0 60 60 */ 61 require( 'class.csstidy_optimise.php');61 require(__DIR__ . DIRECTORY_SEPARATOR . 'class.csstidy_optimise.php'); 62 62 63 63 /** … … 71 71 * @package csstidy 72 72 * @author Florian Schmitz (floele at gmail dot com) 2005-2006 73 * @version 2. 0.073 * @version 2.1.0 74 74 */ 75 75 class csstidy { … … 124 124 * @access private 125 125 */ 126 public $version = ' 1.7.3';126 public $version = '2.0.3'; 127 127 /** 128 128 * Stores the settings … … 258 258 public $data = array(); 259 259 260 public $template; 261 260 262 /** 261 263 * Loads standard template and sets default settings … … 265 267 public function __construct() { 266 268 $data = array(); 267 include( 'data.inc.php');269 include(__DIR__ . DIRECTORY_SEPARATOR . 'data.inc.php'); 268 270 $this->data = $data; 269 271 -
opt-out-for-google-analytics/trunk/lib/csstidy/class.csstidy_optimise.php
r2787042 r3067755 48 48 */ 49 49 public $parser; 50 public $css; 51 public $sub_value; 52 public $at; 53 public $selector; 54 public $property; 55 public $value; 50 56 51 57 /** … … 310 316 311 317 /* expressions complexes de type gradient */ 312 if (strpos($color, '(') !== false && strncmp($color, 'rgb(' ,4) != 0) { 318 if (strpos($color, '(') !== false 319 && (strncasecmp($color, 'rgb(' ,4) !== 0 and strncasecmp($color, 'rgba(' ,5) !== 0)) { 313 320 // on ne touche pas aux couleurs dans les expression ms, c'est trop sensible 314 321 if (stripos($color, 'progid:') !== false) 315 322 return $color; 316 preg_match_all(",rgb \([^)]+\),i", $color, $matches, PREG_SET_ORDER);323 preg_match_all(",rgba?\([^)]+\),i", $color, $matches, PREG_SET_ORDER); 317 324 if (count($matches)) { 318 325 foreach ($matches as $m) { … … 330 337 331 338 // rgb(0,0,0) -> #000000 (or #000 in this case later) 332 if (strncasecmp($color, 'rgb(', 4)==0) { 333 $color_tmp = substr($color, 4, strlen($color) - 5); 334 $color_tmp = explode(',', $color_tmp); 335 for ($i = 0; $i < count($color_tmp); $i++) { 336 $color_tmp[$i] = trim($color_tmp[$i]); 337 if (substr($color_tmp[$i], -1) === '%') { 338 $color_tmp[$i] = round((255 * $color_tmp[$i]) / 100); 339 } 340 if ($color_tmp[$i] > 255) 341 $color_tmp[$i] = 255; 339 if ( 340 // be sure to not corrupt a rgb with calc() value 341 (strncasecmp($color, 'rgb(', 4)==0 and strpos($color, '(', 4) === false) 342 or (strncasecmp($color, 'rgba(', 5)==0 and strpos($color, '(', 5) === false) 343 ){ 344 $color_tmp = explode('(', $color, 2); 345 $color_tmp = rtrim(end($color_tmp), ')'); 346 if (strpos($color_tmp, '/') !== false) { 347 $color_tmp = explode('/', $color_tmp, 2); 348 $color_parts = explode(' ', trim(reset($color_tmp)), 3); 349 while (count($color_parts) < 3) { 350 $color_parts[] = 0; 351 } 352 $color_parts[] = end($color_tmp); 353 } 354 else { 355 $color_parts = explode(',', $color_tmp, 4); 356 } 357 for ($i = 0; $i < count($color_parts); $i++) { 358 $color_parts[$i] = trim($color_parts[$i]); 359 if (substr($color_parts[$i], -1) === '%') { 360 $color_parts[$i] = round((255 * intval($color_parts[$i])) / 100); 361 } elseif ($i>2) { 362 // 4th argument is alpga layer between 0 and 1 (if not %) 363 $color_parts[$i] = round((255 * floatval($color_parts[$i]))); 364 } 365 $color_parts[$i] = intval($color_parts[$i]); 366 if ($color_parts[$i] > 255){ 367 $color_parts[$i] = 255; 368 } 342 369 } 343 370 $color = '#'; 344 for ($i = 0; $i < 3; $i++) { 345 if ($color_tmp[$i] < 16) { 346 $color .= '0' . dechex($color_tmp[$i]); 371 // 3 or 4 parts depending on alpha layer 372 $nb = min(max(count($color_parts), 3),4); 373 for ($i = 0; $i < $nb; $i++) { 374 if (!isset($color_parts[$i])) { 375 $color_parts[$i] = 0; 376 } 377 if ($color_parts[$i] < 16) { 378 $color .= '0' . dechex($color_parts[$i]); 347 379 } else { 348 $color .= dechex($color_ tmp[$i]);380 $color .= dechex($color_parts[$i]); 349 381 } 350 382 } … … 361 393 if ($color_temp[0] === '#' && $color_temp[1] == $color_temp[2] && $color_temp[3] == $color_temp[4] && $color_temp[5] == $color_temp[6]) { 362 394 $color = '#' . $color[1] . $color[3] . $color[5]; 395 } 396 } 397 // #aabbccdd -> #abcd 398 elseif (strlen($color) == 9) { 399 $color_temp = strtolower($color); 400 if ($color_temp[0] === '#' && $color_temp[1] == $color_temp[2] && $color_temp[3] == $color_temp[4] && $color_temp[5] == $color_temp[6] && $color_temp[7] == $color_temp[8]) { 401 $color = '#' . $color[1] . $color[3] . $color[5] . $color[7]; 363 402 } 364 403 } … … 421 460 $number[1] = 'px'; 422 461 } 423 } elseif ($number[1] != 's' && $number[1] != 'ms') {424 $number[1] = '';425 }462 } elseif ($number[1] != 's' && $number[1] != 'ms') { 463 $number[1] = ''; 464 } 426 465 427 466 $temp[$l] = $number[0] . $number[1]; -
opt-out-for-google-analytics/trunk/lib/csstidy/class.csstidy_print.php
r2787042 r3067755 66 66 */ 67 67 public $output_css_plain = ''; 68 69 public $css; 70 public $template; 71 public $tokens; 72 public $charset; 73 public $import; 74 public $namespace; 68 75 69 76 /** -
opt-out-for-google-analytics/trunk/readme.txt
r2896199 r3067755 3 3 Tags: google analytics, opt-out, dsgvo, gdpr, analytics 4 4 Requires at least: 3.5 5 Tested up to: 6. 25 Tested up to: 6.5 6 6 Requires PHP: 7.0 7 Stable tag: 2. 27 Stable tag: 2.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 25 25 * Compatible with Google Tag Manager. 26 26 * **NO other plugin needed** to use the Google Analytics code on the website. This can be integrated directly by this plugin. 27 * Site visitors can deactivate the Google Analytics tracking for themselves and also activate it again afterward s.27 * Site visitors can deactivate the Google Analytics tracking for themselves and also activate it again afterward. 28 28 * Link text for the activation and deactivation link can be changed individually. 29 29 * A popup can be set up, which appears after clicking the link. 30 * The UA-Code can be entered manually or read out automatically by a Google Analytics tracking plugin (see compatible plugins).30 * The UA-Code or GA4-Code can be entered manually or read out automatically by a Google Analytics tracking plugin (see compatible plugins). 31 31 * HTML5 Local Storage Fallback: If a user deletes his cookies, the opt-out cookie can be restored if the local storage was not additionally deleted by the browser. 32 32 * WordPress Multisite compatible. … … 60 60 * [MonsterInsights Pro](https://www.monsterinsights.com/?utm_source=wordpressorg&utm_medium=opt-out-for-google-analytics) 61 61 * [MonsterInsights – Google Analytics Dashboard for WordPress (Website Stats Made Easy)](https://wordpress.org/plugins/google-analytics-for-wordpress/) 62 * [ ExactMetrics – Google Analytics Dashboard for WordPress (Website Stats Plugin)](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/)62 * [Google Analytics Dashboard for WP (GADWP)](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/) 63 63 * [Analytify – Google Analytics Dashboard Plugin For WordPress](https://wordpress.org/plugins/wp-analytify/) 64 64 * [GA Google Analytics](https://wordpress.org/plugins/ga-google-analytics/) … … 100 100 4. Save changes, done! 101 101 102 **Note on UA-Code :**103 104 If you have entered the Google Analytics tracking code manually, e.g. with a WordPress theme, then you must enter the UA-Code in the input field.105 If you have activated one of the three compatible plugins, then this item is also selectable. This will automatically read the current UA-Code from this pluginand you do not have to enter it in the input field.102 **Note on UA-Code & GA4-Code:** 103 104 If you have entered the Google Analytics tracking code manually, e.g. with a WordPress theme, then you must enter the tracking code in the input field. 105 If you have activated one of the compatible Google Analytics plugins, then this item is also selectable. This will automatically read the current tracking code from this plugin, and you do not have to enter it in the input field. 106 106 107 107 == Frequently Asked Questions == … … 156 156 add_action( 'gaoo_before_shortcode', 'my_before_shortcode', 10, 2); 157 157 158 function my_before_shortcode( $ ua_code, $current_status ) {159 // $ ua_code - Der verwendete UA-Code "UA-XXXXX-Y"160 // $current_status - Der aktuelle Status vom Seitenbesucher: activate oder deactivate158 function my_before_shortcode( $tracking_code, $current_status ) { 159 // $tracking_code - The current used tracking code "UA-XXXXX-Y" OR "G-XXXXXXXXXX" 160 // $current_status - The current status of the page visitor: activate or deactivate 161 161 } 162 162 … … 164 164 add_action( 'gaoo_after_shortcode', 'my_after_shortcode', 10, 2); 165 165 166 function my_after_shortcode( $ ua_code, $current_status ) {167 // $ ua_code - The used UA-Code "UA-XXXXX-Y"166 function my_after_shortcode( $tracking_code, $current_status ) { 167 // $tracking_code - The current used tracking code "UA-XXXXX-Y" OR "G-XXXXXXXXXX" 168 168 // $current_status - The current status of the page visitor: activate or deactivate 169 169 } … … 172 172 add_action( 'gaoo_before_head_script', 'my_before_script', 10, 1); 173 173 174 function my_before_script( $ ua_code ) {175 // $ ua_code - The used UA-Code "UA-XXXXX-Y"174 function my_before_script( $tracking_code ) { 175 // $tracking_code - The current used tracking code "UA-XXXXX-Y" OR "G-XXXXXXXXXX" 176 176 } 177 177 … … 179 179 add_action( 'gaoo_after_head_script', 'my_after_script', 10, 1); 180 180 181 function my_after_script( $ ua_code ) {182 // $ ua_code - The used UA-Code "UA-XXXXX-Y"181 function my_after_script( $tracking_code ) { 182 // $tracking_code - The current used tracking code "UA-XXXXX-Y" OR "G-XXXXXXXXXX" 183 183 } 184 184 185 185 // The UA-Code used 186 add_filter( 'gaoo_get_ua_code', 'my_ ua_code', 10, 2 );187 188 function my_ ua_code( $ua_code, $ga_plugin ) {189 // $ ua_code - The used UA-Code "UA-XXXXX-Y"190 // $ga_plugin - Selected source for the UA-Code186 add_filter( 'gaoo_get_ua_code', 'my_ga_tracking_code', 10, 2 ); 187 188 function my_ga_tracking_code( $tracking_code, $ga_plugin ) { 189 // $tracking_code - The current used tracking code "UA-XXXXX-Y" OR "G-XXXXXXXXXX" 190 // $ga_plugin - Selected source for the tracking code 191 191 } 192 192 … … 265 265 The opt-out has only taken place if the value "true" is returned. 266 266 267 Specific cookie, with the corresponding UA-Code: ga-disable-UA-XXXXX-YY267 Specific cookie, with the corresponding tracking code: ga-disable-UA-XXXXX-YY or ga-disable-G-XXXXXXXXX 268 268 Generic Cookie: ga-opt-out 269 269 270 Specific entry in the HTML5 Local Storage: ga-disable-UA-XXXXX-YY 270 Specific entry in the HTML5 Local Storage: ga-disable-UA-XXXXX-YY or ga-disable-G-XXXXXXXXX 271 271 Generic entry in the HTML5 Local Storage: ga-opt-out 272 272 … … 287 287 288 288 == Changelog == 289 290 = 2.3 = 291 * Fixed: Analytify - Detection of whether IP anonymization is activated 292 * Updated: CSStidy library to v2.1.0 293 * Updated: Support for WordPress 6.5 294 * Updated: readme.txt 289 295 290 296 = 2.2 =
Note: See TracChangeset
for help on using the changeset viewer.