![]() Server : LiteSpeed System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : claqxcrl ( 523) PHP Version : 8.1.32 Disable Function : NONE Directory : /home/claqxcrl/anfangola.com/wp-content/plugins/matomo/app/plugins/UserCountry/ |
<?php /** * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ namespace Piwik\Plugins\UserCountry; use Piwik\Config; use Piwik\Container\StaticContainer; use Piwik\Intl\Data\Provider\RegionDataProvider; use Piwik\Plugins\GeoIp2\LocationProvider\GeoIp2; /** * */ class UserCountry extends \Piwik\Plugin { /** * @see \Piwik\Plugin::registerEvents */ public function registerEvents() { return array('Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Tracker.setTrackerCacheGeneral' => 'setTrackerCacheGeneral', 'Insights.addReportToOverview' => 'addReportToInsightsOverview'); } public function getClientSideTranslationKeys(&$translations) { $translations[] = 'General_InfoFor'; $translations[] = 'General_NotInstalled'; $translations[] = 'General_Installed'; $translations[] = 'General_Broken'; $translations[] = 'UserCountry_CurrentLocationIntro'; $translations[] = 'General_Refresh'; $translations[] = 'UserCountry_CannotLocalizeLocalIP'; $translations[] = 'UserCountry_NoProviders'; $translations[] = 'General_Disabled'; $translations[] = 'UserCountry_GeolocationPageDesc'; $translations[] = 'UserCountry_LocationProvider'; $translations[] = 'UserCountry_Geolocation'; $translations[] = 'UserCountry_DistinctCountries'; } public function addReportToInsightsOverview(&$reports) { $reports['UserCountry_getCountry'] = array(); } public function setTrackerCacheGeneral(&$cache) { $cache['currentLocationProviderId'] = \Piwik\Plugins\UserCountry\LocationProvider::getCurrentProviderId(); } public function getStylesheetFiles(&$stylesheets) { $stylesheets[] = "plugins/UserCountry/stylesheets/userCountry.less"; } public function getJsFiles(&$jsFiles) { } /** * Returns a list of country codes for a given continent code. * * @param string $continent The continent code. * @return array */ public static function getCountriesForContinent($continent) { /** @var RegionDataProvider $regionDataProvider */ $regionDataProvider = StaticContainer::get('Piwik\\Intl\\Data\\Provider\\RegionDataProvider'); $result = array(); $continent = strtolower($continent); foreach ($regionDataProvider->getCountryList() as $countryCode => $continentCode) { if ($continent == $continentCode) { $result[] = $countryCode; } } return array('SQL' => "'" . implode("', '", $result) . "', ?", 'bind' => '-'); // HACK: SegmentExpression requires a $bind, even if there's nothing to bind } /** * Returns true if a GeoIP provider is installed & working, false if otherwise. * * @return bool */ public function isGeoIPWorking() { $provider = \Piwik\Plugins\UserCountry\LocationProvider::getCurrentProvider(); return $provider instanceof GeoIp2 && $provider->isAvailable() === true && $provider->isWorking() === true; } public static function isGeoLocationAdminEnabled() { return (bool) Config::getInstance()->General['enable_geolocation_admin']; } }