Piwik\Plugins\UserCountry\LocationProvider::getCurrentProviderId PHP Method

getCurrentProviderId() public static method

The used provider is stored in the 'usercountry.location_provider' option. This function should not be called by the Tracker.
public static getCurrentProviderId ( ) : string
return string
    public static function getCurrentProviderId()
    {
        $optionValue = Option::get(self::CURRENT_PROVIDER_OPTION_NAME);
        return $optionValue === false ? DefaultProvider::ID : $optionValue;
    }

Usage Example

Example #1
0
 public function adminIndex()
 {
     $this->dieIfGeolocationAdminIsDisabled();
     Piwik::checkUserHasSuperUserAccess();
     $view = new View('@UserCountry/adminIndex');
     $allProviderInfo = LocationProvider::getAllProviderInfo($newline = '<br/>', $includeExtra = true);
     $view->locationProviders = $allProviderInfo;
     $view->currentProviderId = LocationProvider::getCurrentProviderId();
     $view->thisIP = IP::getIpFromHeader();
     $geoIPDatabasesInstalled = GeoIp::isDatabaseInstalled();
     $view->geoIPDatabasesInstalled = $geoIPDatabasesInstalled;
     $view->updatePeriodOptions = $this->getPeriodUpdateOptions();
     // check if there is a working provider (that isn't the default one)
     $isThereWorkingProvider = false;
     foreach ($allProviderInfo as $id => $provider) {
         if ($id != DefaultProvider::ID && $provider['status'] == LocationProvider::INSTALLED) {
             $isThereWorkingProvider = true;
             break;
         }
     }
     $view->isThereWorkingProvider = $isThereWorkingProvider;
     // if using either the Apache or PECL module, they are working and there are no databases
     // in misc, then the databases are located outside of Piwik, so we cannot update them
     $view->showGeoIPUpdateSection = true;
     $currentProviderId = LocationProvider::getCurrentProviderId();
     if (!$geoIPDatabasesInstalled && ($currentProviderId == ServerBased::ID || $currentProviderId == Pecl::ID) && $allProviderInfo[$currentProviderId]['status'] == LocationProvider::INSTALLED) {
         $view->showGeoIPUpdateSection = false;
     }
     $this->setUpdaterManageVars($view);
     $this->setBasicVariablesView($view);
     $this->setBasicVariablesAdminView($view);
     return $view->render();
 }
All Usage Examples Of Piwik\Plugins\UserCountry\LocationProvider::getCurrentProviderId