Changeset 3340098
- Timestamp:
- 08/06/2025 06:59:10 AM (5 months ago)
- Location:
- simpleanalytics
- Files:
-
- 4 edited
- 1 copied
-
tags/1.68 (copied) (copied from simpleanalytics/trunk)
-
tags/1.68/readme.txt (modified) (2 diffs)
-
tags/1.68/src/TrackingPolicy.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/TrackingPolicy.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simpleanalytics/tags/1.68/readme.txt
r3338800 r3340098 7 7 Tested up to: 6.8.2 8 8 Requires PHP: 7.2.0 9 Stable tag: 1.6 79 Stable tag: 1.68 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 137 137 138 138 == Changelog == 139 140 = 1.68 = 141 * 2025-08-06 142 * Changes: 143 * fix: Handle IP address absence 144 * Release 1.67: Code updates 145 139 146 140 147 = 1.67 = -
simpleanalytics/tags/1.68/src/TrackingPolicy.php
r3279384 r3340098 7 7 public function shouldCollectAnalytics(): bool 8 8 { 9 if ($this-> clientIpExcluded($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'])) {9 if ($this->isClientIpExcluded()) { 10 10 return false; 11 11 } … … 15 15 } 16 16 17 return ! $this->containsExcludedRole( wp_get_current_user()->roles);17 return ! $this->containsExcludedRole(); 18 18 } 19 19 20 protected function clientIpExcluded(string $ip): bool20 protected function isClientIpExcluded(): bool 21 21 { 22 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR']; 23 24 if (empty($ip)) return false; 25 22 26 return in_array($ip, Setting::array(SettingName::EXCLUDED_IP_ADDRESSES)); 23 27 } 24 28 25 protected function containsExcludedRole( array $roles): bool29 protected function containsExcludedRole(): bool 26 30 { 27 return array_intersect(Setting::array(SettingName::EXCLUDED_ROLES), $roles) !== []; 31 $currentRoles = wp_get_current_user()->roles; 32 $excludedRoles = Setting::array(SettingName::EXCLUDED_ROLES); 33 34 return array_intersect($excludedRoles, $currentRoles) !== []; 28 35 } 29 36 } -
simpleanalytics/trunk/readme.txt
r3338800 r3340098 7 7 Tested up to: 6.8.2 8 8 Requires PHP: 7.2.0 9 Stable tag: 1.6 79 Stable tag: 1.68 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 137 137 138 138 == Changelog == 139 140 = 1.68 = 141 * 2025-08-06 142 * Changes: 143 * fix: Handle IP address absence 144 * Release 1.67: Code updates 145 139 146 140 147 = 1.67 = -
simpleanalytics/trunk/src/TrackingPolicy.php
r3279384 r3340098 7 7 public function shouldCollectAnalytics(): bool 8 8 { 9 if ($this-> clientIpExcluded($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'])) {9 if ($this->isClientIpExcluded()) { 10 10 return false; 11 11 } … … 15 15 } 16 16 17 return ! $this->containsExcludedRole( wp_get_current_user()->roles);17 return ! $this->containsExcludedRole(); 18 18 } 19 19 20 protected function clientIpExcluded(string $ip): bool20 protected function isClientIpExcluded(): bool 21 21 { 22 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR']; 23 24 if (empty($ip)) return false; 25 22 26 return in_array($ip, Setting::array(SettingName::EXCLUDED_IP_ADDRESSES)); 23 27 } 24 28 25 protected function containsExcludedRole( array $roles): bool29 protected function containsExcludedRole(): bool 26 30 { 27 return array_intersect(Setting::array(SettingName::EXCLUDED_ROLES), $roles) !== []; 31 $currentRoles = wp_get_current_user()->roles; 32 $excludedRoles = Setting::array(SettingName::EXCLUDED_ROLES); 33 34 return array_intersect($excludedRoles, $currentRoles) !== []; 28 35 } 29 36 }
Note: See TracChangeset
for help on using the changeset viewer.