__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php

namespace WP_Statistics\Service\Geolocation;

use Exception;
use WP_Error;
use WP_STATISTICS\IP;

/**
 * GeolocationService Class
 *
 * This service class handles geolocation data, providing methods to fetch location data
 * based on IP addresses or other identifying information.
 *
 * @package   GeoLocationService
 * @version   1.0.0
 * @since     14.10.1
 * @author    Mostafa
 */
class GeolocationService
{
    /**
     * @var GeoServiceProviderInterface
     */
    protected $provider;

    /**
     * GeolocationService constructor.
     *
     * @param GeoServiceProviderInterface $provider
     */
    public function __construct(GeoServiceProviderInterface $provider)
    {
        $this->provider = $provider;
    }

    /**
     * Get geolocation data for a given IP address.
     *
     * @param string $ipAddress
     * @return array
     */
    public function getGeolocation(string $ipAddress)
    {
        /**
         * Check if the IP address is not valid (or is hashed), return default location
         */
        if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) {
            return $this->provider->getDefaultLocation();
        }

        /**
         * Check if the IP address is in a private range.
         * @review: If this is not necessary, remove it.
         */
        try {
            if (IP::checkIPRange(IP::$private_SubNets, $ipAddress)) {
                $location            = $this->provider->getDefaultLocation();
                $location['country'] = $this->provider->getPrivateCountryCode();

                return $location;
            }

        } catch (Exception $e) {
            return $this->provider->getDefaultLocation();
        }

        return $this->provider->fetchGeolocationData($ipAddress);
    }

    /**
     * Download the geolocation database.
     *
     * @return bool|WP_Error
     */
    public function downloadDatabase()
    {
        return $this->provider->downloadDatabase();
    }
}

Filemanager

Name Type Size Permission Actions
Provider Folder 0755
AbstractGeoIPProvider.php File 5.84 KB 0644
GeoServiceProviderInterface.php File 918 B 0644
GeolocationFactory.php File 2.58 KB 0644
GeolocationService.php File 1.92 KB 0644
Filemanager