Plugin Directory

Changeset 3340098


Ignore:
Timestamp:
08/06/2025 06:59:10 AM (5 months ago)
Author:
simpleanalytics
Message:

Update to version 1.68 from GitHub

Location:
simpleanalytics
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simpleanalytics/tags/1.68/readme.txt

    r3338800 r3340098  
    77Tested up to: 6.8.2
    88Requires PHP: 7.2.0
    9 Stable tag: 1.67
     9Stable tag: 1.68
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    137137
    138138== Changelog ==
     139
     140= 1.68 =
     141* 2025-08-06
     142* Changes:
     143* fix: Handle IP address absence
     144* Release 1.67: Code updates
     145
    139146
    140147= 1.67 =
  • simpleanalytics/tags/1.68/src/TrackingPolicy.php

    r3279384 r3340098  
    77    public function shouldCollectAnalytics(): bool
    88    {
    9         if ($this->clientIpExcluded($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'])) {
     9        if ($this->isClientIpExcluded()) {
    1010            return false;
    1111        }
     
    1515        }
    1616
    17         return ! $this->containsExcludedRole(wp_get_current_user()->roles);
     17        return ! $this->containsExcludedRole();
    1818    }
    1919
    20     protected function clientIpExcluded(string $ip): bool
     20    protected function isClientIpExcluded(): bool
    2121    {
     22        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'];
     23
     24        if (empty($ip)) return false;
     25
    2226        return in_array($ip, Setting::array(SettingName::EXCLUDED_IP_ADDRESSES));
    2327    }
    2428
    25     protected function containsExcludedRole(array $roles): bool
     29    protected function containsExcludedRole(): bool
    2630    {
    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) !== [];
    2835    }
    2936}
  • simpleanalytics/trunk/readme.txt

    r3338800 r3340098  
    77Tested up to: 6.8.2
    88Requires PHP: 7.2.0
    9 Stable tag: 1.67
     9Stable tag: 1.68
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    137137
    138138== Changelog ==
     139
     140= 1.68 =
     141* 2025-08-06
     142* Changes:
     143* fix: Handle IP address absence
     144* Release 1.67: Code updates
     145
    139146
    140147= 1.67 =
  • simpleanalytics/trunk/src/TrackingPolicy.php

    r3279384 r3340098  
    77    public function shouldCollectAnalytics(): bool
    88    {
    9         if ($this->clientIpExcluded($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'])) {
     9        if ($this->isClientIpExcluded()) {
    1010            return false;
    1111        }
     
    1515        }
    1616
    17         return ! $this->containsExcludedRole(wp_get_current_user()->roles);
     17        return ! $this->containsExcludedRole();
    1818    }
    1919
    20     protected function clientIpExcluded(string $ip): bool
     20    protected function isClientIpExcluded(): bool
    2121    {
     22        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'];
     23
     24        if (empty($ip)) return false;
     25
    2226        return in_array($ip, Setting::array(SettingName::EXCLUDED_IP_ADDRESSES));
    2327    }
    2428
    25     protected function containsExcludedRole(array $roles): bool
     29    protected function containsExcludedRole(): bool
    2630    {
    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) !== [];
    2835    }
    2936}
Note: See TracChangeset for help on using the changeset viewer.