Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Intl/Data/Provider/RegionDataProvider.php')
-rw-r--r--core/Intl/Data/Provider/RegionDataProvider.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/core/Intl/Data/Provider/RegionDataProvider.php b/core/Intl/Data/Provider/RegionDataProvider.php
new file mode 100644
index 0000000000..b47aa4ab9c
--- /dev/null
+++ b/core/Intl/Data/Provider/RegionDataProvider.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Intl\Data\Provider;
+
+/**
+ * Provides region related data (continents, countries, etc.).
+ */
+class RegionDataProvider
+{
+ /**
+ * Returns the list of continent codes.
+ *
+ * @return string[] Array of 3 letter continent codes
+ * @api
+ */
+ public function getContinentList()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
+
+ return $GLOBALS['Piwik_ContinentList'];
+ }
+
+ /**
+ * Returns the list of valid country codes.
+ *
+ * @param bool $includeInternalCodes
+ * @return string[] Array of 2 letter country ISO codes => 3 letter continent code
+ * @api
+ */
+ public static function getCountryList($includeInternalCodes = false)
+ {
+ require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
+
+ $countriesList = $GLOBALS['Piwik_CountryList'];
+ $extras = $GLOBALS['Piwik_CountryList_Extras'];
+
+ if ($includeInternalCodes) {
+ return array_merge($countriesList, $extras);
+ }
+
+ return $countriesList;
+ }
+}