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 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/API.php5
-rw-r--r--plugins/UserCountry/Archiver.php13
-rw-r--r--plugins/UserCountry/Controller.php7
-rwxr-xr-xplugins/UserCountry/GeoIPAutoUpdater.php7
-rwxr-xr-xplugins/UserCountry/LocationProvider/GeoIp/ServerBased.php2
-rw-r--r--plugins/UserCountry/UserCountry.php10
-rw-r--r--plugins/UserCountry/functions.php15
7 files changed, 35 insertions, 24 deletions
diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php
index 79aaf191c5..113a1dc6c5 100644
--- a/plugins/UserCountry/API.php
+++ b/plugins/UserCountry/API.php
@@ -11,6 +11,7 @@
use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* @see plugins/UserCountry/functions.php
@@ -67,7 +68,7 @@ class Piwik_UserCountry_API
* @param string $period
* @param string $date
* @param string|bool $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getRegion($idSite, $period, $date, $segment = false)
{
@@ -109,7 +110,7 @@ class Piwik_UserCountry_API
* @param string $period
* @param string $date
* @param string|bool $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getCity($idSite, $period, $date, $segment = false)
{
diff --git a/plugins/UserCountry/Archiver.php b/plugins/UserCountry/Archiver.php
index 4667e38474..129da79557 100644
--- a/plugins/UserCountry/Archiver.php
+++ b/plugins/UserCountry/Archiver.php
@@ -9,9 +9,12 @@
* @package Piwik_UserCountry
*/
+use Piwik\ArchiveProcessor\Day;
use Piwik\Metrics;
+use Piwik\DataTable;
+use Piwik\PluginsArchiver;
-class Piwik_UserCountry_Archiver extends Piwik_PluginsArchiver
+class Piwik_UserCountry_Archiver extends PluginsArchiver
{
const COUNTRY_RECORD_NAME = 'UserCountry_country';
const REGION_RECORD_NAME = 'UserCountry_region';
@@ -124,15 +127,15 @@ class Piwik_UserCountry_Archiver extends Piwik_PluginsArchiver
protected function recordDayReports()
{
- $tableCountry = Piwik_ArchiveProcessor_Day::getDataTableFromDataArray($this->arrays[self::COUNTRY_FIELD]);
+ $tableCountry = Day::getDataTableFromDataArray($this->arrays[self::COUNTRY_FIELD]);
$this->getProcessor()->insertBlobRecord(self::COUNTRY_RECORD_NAME, $tableCountry->getSerialized());
$this->getProcessor()->insertNumericRecord(self::DISTINCT_COUNTRIES_METRIC, $tableCountry->getRowsCount());
- $tableRegion = Piwik_ArchiveProcessor_Day::getDataTableFromDataArray($this->arrays[self::REGION_FIELD]);
+ $tableRegion = Day::getDataTableFromDataArray($this->arrays[self::REGION_FIELD]);
$serialized = $tableRegion->getSerialized($this->maximumRows, $this->maximumRows, Metrics::INDEX_NB_VISITS);
$this->getProcessor()->insertBlobRecord(self::REGION_RECORD_NAME, $serialized);
- $tableCity = Piwik_ArchiveProcessor_Day::getDataTableFromDataArray($this->arrays[self::CITY_FIELD]);
+ $tableCity = Day::getDataTableFromDataArray($this->arrays[self::CITY_FIELD]);
$this->setLatitudeLongitude($tableCity);
$serialized = $tableCity->getSerialized($this->maximumRows, $this->maximumRows, Metrics::INDEX_NB_VISITS);
$this->getProcessor()->insertBlobRecord(self::CITY_RECORD_NAME, $serialized);
@@ -142,7 +145,7 @@ class Piwik_UserCountry_Archiver extends Piwik_PluginsArchiver
* Utility method, appends latitude/longitude pairs to city table labels, if that data
* exists for the city.
*/
- private function setLatitudeLongitude(Piwik_DataTable $tableCity)
+ private function setLatitudeLongitude(DataTable $tableCity)
{
foreach ($tableCity->getRows() as $row) {
$label = $row->getColumn('label');
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index bda89e927b..9c547ee6dc 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
+use Piwik\DataTable\Renderer\Json;
use Piwik\Piwik;
use Piwik\Common;
@@ -98,7 +99,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
Piwik::checkUserIsSuperUser();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$this->checkTokenInUrl();
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
$outputPath = Piwik_UserCountry_LocationProvider_GeoIp::getPathForGeoIpDatabase('GeoIPCity.dat') . '.gz';
try {
$result = Piwik_Http::downloadChunk(
@@ -180,7 +181,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
{
Piwik::checkUserIsSuperUser();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
try {
$this->checkTokenInUrl();
@@ -225,7 +226,7 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
try {
$this->checkTokenInUrl();
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
// based on the database type (provided by the 'key' query param) determine the
// url & output file name
diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php
index 051eeb42d4..dea98daa0f 100755
--- a/plugins/UserCountry/GeoIPAutoUpdater.php
+++ b/plugins/UserCountry/GeoIPAutoUpdater.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
/**
* Used to automatically update installed GeoIP databases, and manages the updater's
@@ -48,7 +49,7 @@ class Piwik_UserCountry_GeoIPAutoUpdater
public function update()
{
try {
- Piwik_SetOption(self::LAST_RUN_TIME_OPTION_NAME, Piwik_Date::factory('today')->getTimestamp());
+ Piwik_SetOption(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp());
$locUrl = Piwik_GetOption(self::LOC_URL_OPTION_NAME);
if (!empty($locUrl)) {
@@ -570,11 +571,11 @@ class Piwik_UserCountry_GeoIPAutoUpdater
/**
* Returns the time the auto updater was last run.
*
- * @return Piwik_Date|false
+ * @return Date|false
*/
public static function getLastRunTime()
{
$timestamp = Piwik_GetOption(self::LAST_RUN_TIME_OPTION_NAME);
- return $timestamp === false ? false : Piwik_Date::factory((int)$timestamp);
+ return $timestamp === false ? false : Date::factory((int)$timestamp);
}
}
diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
index a26217bac2..382ee9a319 100755
--- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
+++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php
@@ -9,6 +9,8 @@
* @package Piwik_UserCountry
*/
+use Piwik\Common;
+
/**
* A LocationProvider that uses an GeoIP module installed in an HTTP Server.
*
diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php
index d6e673e697..72c7cbda9b 100644
--- a/plugins/UserCountry/UserCountry.php
+++ b/plugins/UserCountry/UserCountry.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
-use Piwik\Piwik;
+use Piwik\ArchiveProcessor;
use Piwik\Common;
+use Piwik\Piwik;
+use Piwik\Plugin;
/**
* @see plugins/UserCountry/GeoIPAutoUpdater.php
@@ -20,7 +22,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/GeoIPAutoUpdater.php';
*
* @package Piwik_UserCountry
*/
-class Piwik_UserCountry extends Piwik_Plugin
+class Piwik_UserCountry extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -244,7 +246,7 @@ class Piwik_UserCountry extends Piwik_Plugin
));
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_UserCountry_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -252,7 +254,7 @@ class Piwik_UserCountry extends Piwik_Plugin
}
}
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_UserCountry_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/UserCountry/functions.php b/plugins/UserCountry/functions.php
index 9db8a85d78..35919cdf2d 100644
--- a/plugins/UserCountry/functions.php
+++ b/plugins/UserCountry/functions.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
+use Piwik\DataTable;
/**
* Return the flag image path for a given country
@@ -67,7 +68,7 @@ function Piwik_CountryTranslate($label)
*/
function Piwik_UserCountry_getElementFromStringArray($label, $separator, $index, $emptyValue = false)
{
- if ($label == Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($label == DataTable::LABEL_SUMMARY_ROW) {
return false; // so no metadata/column is added
}
@@ -80,11 +81,11 @@ function Piwik_UserCountry_getElementFromStringArray($label, $separator, $index,
*
* @param string $label A label containing a region code followed by '|' and a country code, eg,
* 'P3|GB'.
- * @return string|false The region name or false if $label == Piwik_DataTable::LABEL_SUMMARY_ROW.
+ * @return string|false The region name or false if $label == DataTable::LABEL_SUMMARY_ROW.
*/
function Piwik_UserCountry_getRegionName($label)
{
- if ($label == Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($label == DataTable::LABEL_SUMMARY_ROW) {
return false; // so no metadata/column is added
}
@@ -102,11 +103,11 @@ function Piwik_UserCountry_getRegionName($label)
*
* @param string $label A label containing a region code followed by '|' and a country code, eg,
* 'P3|GB'.
- * @return string|false eg. 'Ile de France, France' or false if $label == Piwik_DataTable::LABEL_SUMMARY_ROW.
+ * @return string|false eg. 'Ile de France, France' or false if $label == DataTable::LABEL_SUMMARY_ROW.
*/
function Piwik_UserCountry_getPrettyRegionName($label)
{
- if ($label == Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($label == DataTable::LABEL_SUMMARY_ROW) {
return $label;
}
@@ -130,11 +131,11 @@ function Piwik_UserCountry_getPrettyRegionName($label)
* @param string $label A label containing a city name, region code + country code,
* separated by two '|' chars: 'Paris|A8|FR'
* @return string|false eg. 'Paris, Ile de France, France' or false if $label ==
- * Piwik_DataTable::LABEL_SUMMARY_ROW.
+ * DataTable::LABEL_SUMMARY_ROW.
*/
function Piwik_UserCountry_getPrettyCityName($label)
{
- if ($label == Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($label == DataTable::LABEL_SUMMARY_ROW) {
return $label;
}