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:
authormattab <matthieu.aubry@gmail.com>2013-08-02 17:59:33 +0400
committermattab <matthieu.aubry@gmail.com>2013-08-02 17:59:33 +0400
commita96ec40e983a8b64f4c25def541a519ff3670e6a (patch)
treebef2a5f7b1e9532dc96161334e23a553cdff7ea1 /plugins/VisitorInterest
parent61997f45e4c39360000e815c9e0853ae04e2f56f (diff)
Refs #4059 Converting dozens of plugins/* classes to use Namespaces, \Piwik\Plugins\*
Added namespaces to functions.php files in the five plugins that had one Work in progress
Diffstat (limited to 'plugins/VisitorInterest')
-rw-r--r--plugins/VisitorInterest/API.php17
-rw-r--r--plugins/VisitorInterest/Archiver.php18
-rw-r--r--plugins/VisitorInterest/Controller.php9
-rw-r--r--plugins/VisitorInterest/VisitorInterest.php116
4 files changed, 84 insertions, 76 deletions
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php
index 8f34623fec..7a6f925254 100644
--- a/plugins/VisitorInterest/API.php
+++ b/plugins/VisitorInterest/API.php
@@ -6,20 +6,23 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
+namespace Piwik\Plugins\VisitorInterest;
+
use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\DataTable;
+use Piwik\Plugins\VisitorInterest\Archiver;
/**
* VisitorInterest API lets you access two Visitor Engagement reports: number of visits per number of pages,
* and number of visits per visit duration.
*
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
-class Piwik_VisitorInterest_API
+class API
{
static private $instance = null;
@@ -42,7 +45,7 @@ class Piwik_VisitorInterest_API
public function getNumberOfVisitsPerVisitDuration($idSite, $period, $date, $segment = false)
{
- $dataTable = $this->getDataTable(Piwik_VisitorInterest_Archiver::TIME_SPENT_RECORD_NAME, $idSite, $period, $date, $segment);
+ $dataTable = $this->getDataTable(Archiver::TIME_SPENT_RECORD_NAME, $idSite, $period, $date, $segment);
$dataTable->queueFilter('Sort', array('label', 'asc', true));
$dataTable->queueFilter('BeautifyTimeRangeLabels', array(
Piwik_Translate('VisitorInterest_BetweenXYSeconds'),
@@ -53,7 +56,7 @@ class Piwik_VisitorInterest_API
public function getNumberOfVisitsPerPage($idSite, $period, $date, $segment = false)
{
- $dataTable = $this->getDataTable(Piwik_VisitorInterest_Archiver::PAGES_VIEWED_RECORD_NAME, $idSite, $period, $date, $segment);
+ $dataTable = $this->getDataTable(Archiver::PAGES_VIEWED_RECORD_NAME, $idSite, $period, $date, $segment);
$dataTable->queueFilter('Sort', array('label', 'asc', true));
$dataTable->queueFilter('BeautifyRangeLabels', array(
Piwik_Translate('VisitorInterest_OnePage'),
@@ -74,7 +77,7 @@ class Piwik_VisitorInterest_API
public function getNumberOfVisitsByDaysSinceLast($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(
- Piwik_VisitorInterest_Archiver::DAYS_SINCE_LAST_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
+ Archiver::DAYS_SINCE_LAST_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
$dataTable->queueFilter('BeautifyRangeLabels', array(Piwik_Translate('General_OneDay'), Piwik_Translate('General_NDays')));
return $dataTable;
}
@@ -92,7 +95,7 @@ class Piwik_VisitorInterest_API
public function getNumberOfVisitsByVisitCount($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(
- Piwik_VisitorInterest_Archiver::VISITS_COUNT_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
+ Archiver::VISITS_COUNT_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
$dataTable->queueFilter('BeautifyRangeLabels', array(
Piwik_Translate('General_OneVisit'), Piwik_Translate('General_NVisits')));
diff --git a/plugins/VisitorInterest/Archiver.php b/plugins/VisitorInterest/Archiver.php
index 18449cbf4c..d6aa1a29ba 100644
--- a/plugins/VisitorInterest/Archiver.php
+++ b/plugins/VisitorInterest/Archiver.php
@@ -6,15 +6,17 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
+namespace Piwik\Plugins\VisitorInterest;
+
use Piwik\DataAccess\LogAggregator;
use Piwik\Metrics;
use Piwik\DataTable;
use Piwik\PluginsArchiver;
-class Piwik_VisitorInterest_Archiver extends PluginsArchiver
+class Archiver extends PluginsArchiver
{
// third element is unit (s for seconds, default is munutes)
const TIME_SPENT_RECORD_NAME = 'VisitorInterest_timeGap';
@@ -90,9 +92,9 @@ class Piwik_VisitorInterest_Archiver extends PluginsArchiver
// these prefixes are prepended to the 'SELECT as' parts of each SELECT expression. detecting
// these prefixes allows us to get all the data in one query.
$prefixes = array(
- self::TIME_SPENT_RECORD_NAME => 'tg',
- self::PAGES_VIEWED_RECORD_NAME => 'pg',
- self::VISITS_COUNT_RECORD_NAME => 'vbvn',
+ self::TIME_SPENT_RECORD_NAME => 'tg',
+ self::PAGES_VIEWED_RECORD_NAME => 'pg',
+ self::VISITS_COUNT_RECORD_NAME => 'vbvn',
self::DAYS_SINCE_LAST_RECORD_NAME => 'dslv',
);
@@ -105,13 +107,13 @@ class Piwik_VisitorInterest_Archiver extends PluginsArchiver
),
);
$selects = array();
- foreach($aggregatesMetadata as $aggregateMetadata) {
+ foreach ($aggregatesMetadata as $aggregateMetadata) {
$selectsFromRangedColumn = LogAggregator::getSelectsFromRangedColumn($aggregateMetadata);
- $selects = array_merge( $selects, $selectsFromRangedColumn);
+ $selects = array_merge($selects, $selectsFromRangedColumn);
}
$query = $this->getLogAggregator()->queryVisitsByDimension(array(), $where = false, $selects, array());
$row = $query->fetch();
- foreach($prefixes as $recordName => $selectAsPrefix) {
+ foreach ($prefixes as $recordName => $selectAsPrefix) {
$cleanRow = LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_VISITS, $selectAsPrefix);
$dataTable = DataTable::makeFromIndexedArray($cleanRow);
$this->getProcessor()->insertBlobRecord($recordName, $dataTable->getSerialized());
diff --git a/plugins/VisitorInterest/Controller.php b/plugins/VisitorInterest/Controller.php
index d7a505d6b4..5475d6cba8 100644
--- a/plugins/VisitorInterest/Controller.php
+++ b/plugins/VisitorInterest/Controller.php
@@ -6,17 +6,18 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
+namespace Piwik\Plugins\VisitorInterest;
+
use Piwik\Metrics;
-use Piwik\Controller;
use Piwik\ViewDataTable;
use Piwik\View;
/**
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
-class Piwik_VisitorInterest_Controller extends Controller
+class Controller extends \Piwik\Controller
{
public function index()
{
diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php
index a656e73804..a60118961d 100644
--- a/plugins/VisitorInterest/VisitorInterest.php
+++ b/plugins/VisitorInterest/VisitorInterest.php
@@ -6,19 +6,21 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
+namespace Piwik\Plugins\VisitorInterest;
+
use Piwik\ArchiveProcessor;
use Piwik\FrontController;
-use Piwik\Plugin;
use Piwik\Metrics;
+use Piwik\Plugins\VisitorInterest\Archiver;
use Piwik\WidgetsList;
/**
*
- * @package Piwik_VisitorInterest
+ * @package VisitorInterest
*/
-class Piwik_VisitorInterest extends Plugin
+class VisitorInterest extends \Piwik\Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -26,11 +28,11 @@ class Piwik_VisitorInterest extends Plugin
public function getListHooksRegistered()
{
$hooks = array(
- 'ArchiveProcessing_Day.compute' => 'archiveDay',
- 'ArchiveProcessing_Period.compute' => 'archivePeriod',
- 'WidgetsList.add' => 'addWidgets',
- 'Menu.add' => 'addMenu',
- 'API.getReportMetadata' => 'getReportMetadata',
+ 'ArchiveProcessing_Day.compute' => 'archiveDay',
+ 'ArchiveProcessing_Period.compute' => 'archivePeriod',
+ 'WidgetsList.add' => 'addWidgets',
+ 'Menu.add' => 'addMenu',
+ 'API.getReportMetadata' => 'getReportMetadata',
'ViewDataTable.getReportDisplayProperties' => 'getReportDisplayProperties',
);
return $hooks;
@@ -113,22 +115,22 @@ class Piwik_VisitorInterest extends Plugin
function postLoad()
{
- Piwik_AddAction('template_headerVisitsFrequency', array('Piwik_VisitorInterest', 'headerVisitsFrequency'));
- Piwik_AddAction('template_footerVisitsFrequency', array('Piwik_VisitorInterest', 'footerVisitsFrequency'));
+ Piwik_AddAction('template_headerVisitsFrequency', array('Piwik\Plugins\VisitorInterest\VisitorInterest', 'headerVisitsFrequency'));
+ Piwik_AddAction('template_footerVisitsFrequency', array('Piwik\Plugins\VisitorInterest\VisitorInterest', 'footerVisitsFrequency'));
}
public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
- $archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
- if($archiving->shouldArchive()) {
+ $archiving = new Archiver($archiveProcessor);
+ if ($archiving->shouldArchive()) {
$archiving->archivePeriod();
}
}
public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
- $archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
- if($archiving->shouldArchive()) {
+ $archiving = new Archiver($archiveProcessor);
+ if ($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
@@ -162,70 +164,70 @@ class Piwik_VisitorInterest extends Plugin
private function getDisplayPropertiesForGetNumberOfVisitsPerVisitDuration()
{
return array(
- 'default_view_type' => 'cloud',
- 'filter_sort_column' => 'label',
- 'filter_sort_order' => 'asc',
- 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnVisitDuration')),
- 'graph_limit' => 10,
- 'enable_sort' => false,
+ 'default_view_type' => 'cloud',
+ 'filter_sort_column' => 'label',
+ 'filter_sort_order' => 'asc',
+ 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnVisitDuration')),
+ 'graph_limit' => 10,
+ 'enable_sort' => false,
'show_exclude_low_population' => false,
- 'show_offset_information' => false,
- 'show_pagination_control' => false,
- 'show_search' => false,
- 'show_table_all_columns' => false,
+ 'show_offset_information' => false,
+ 'show_pagination_control' => false,
+ 'show_search' => false,
+ 'show_table_all_columns' => false,
);
}
private function getDisplayPropertiesForGetNumberOfVisitsPerPage()
{
return array(
- 'default_view_type' => 'cloud',
- 'filter_sort_column' => 'label',
- 'filter_sort_order' => 'asc',
- 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit')),
- 'graph_limit' => 10,
- 'enable_sort' => false,
+ 'default_view_type' => 'cloud',
+ 'filter_sort_column' => 'label',
+ 'filter_sort_order' => 'asc',
+ 'translations' => array('label' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit')),
+ 'graph_limit' => 10,
+ 'enable_sort' => false,
'show_exclude_low_population' => false,
- 'show_offset_information' => false,
- 'show_pagination_control' => false,
- 'show_search' => false,
- 'show_table_all_columns' => false,
+ 'show_offset_information' => false,
+ 'show_pagination_control' => false,
+ 'show_search' => false,
+ 'show_table_all_columns' => false,
);
}
private function getDisplayPropertiesForGetNumberOfVisitsByVisitCount()
{
return array(
- 'columns_to_display' => array('label', 'nb_visits', 'nb_visits_percentage'),
- 'filter_sort_column' => 'label',
- 'filter_sort_order' => 'asc',
- 'translations' => array('label' => Piwik_Translate('VisitorInterest_VisitNum'),
- 'nb_visits_percentage' => Metrics::getPercentVisitColumn()),
+ 'columns_to_display' => array('label', 'nb_visits', 'nb_visits_percentage'),
+ 'filter_sort_column' => 'label',
+ 'filter_sort_order' => 'asc',
+ 'translations' => array('label' => Piwik_Translate('VisitorInterest_VisitNum'),
+ 'nb_visits_percentage' => Metrics::getPercentVisitColumn()),
'show_exclude_low_population' => false,
- 'show_offset_information' => false,
- 'show_pagination_control' => false,
- 'filter_limit' => 15,
- 'show_search' => false,
- 'enable_sort' => false,
- 'show_table_all_columns' => false,
- 'show_all_views_icons' => false,
+ 'show_offset_information' => false,
+ 'show_pagination_control' => false,
+ 'filter_limit' => 15,
+ 'show_search' => false,
+ 'enable_sort' => false,
+ 'show_table_all_columns' => false,
+ 'show_all_views_icons' => false,
);
}
private function getDisplayPropertiesForGetNumberOfVisitsByDaysSinceLast()
{
return array(
- 'filter_sort_column' => 'label',
- 'filter_sort_order' => 'asc',
- 'translations' => array('label' => Piwik_Translate('General_DaysSinceLastVisit')),
+ 'filter_sort_column' => 'label',
+ 'filter_sort_order' => 'asc',
+ 'translations' => array('label' => Piwik_Translate('General_DaysSinceLastVisit')),
'show_exclude_low_population' => false,
- 'show_offset_information' => false,
- 'show_pagination_control' => false,
- 'show_all_views_icons' => false,
- 'filter_limit' => 15,
- 'show_search' => false,
- 'enable_sort' => false,
- 'show_table_all_columns' => false
+ 'show_offset_information' => false,
+ 'show_pagination_control' => false,
+ 'show_all_views_icons' => false,
+ 'filter_limit' => 15,
+ 'show_search' => false,
+ 'enable_sort' => false,
+ 'show_table_all_columns' => false
);
}
}