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-07-21 12:01:35 +0400
committermattab <matthieu.aubry@gmail.com>2013-07-21 12:01:36 +0400
commitaca8ec33a85e0a70b818b6227145041717d7a69e (patch)
tree41377e3a9737d63222522ef93ecf8483f3faddfa /plugins
parent0a63210e3eae7562af1a3dbee340eb1ee140db3d (diff)
Refs #4059 Work in progress: Conversion to use Namespaces: Period*, Metrics, Segment, SegmentExpression, PluginsManager.
Removed some deprecated code.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/API/API.php28
-rw-r--r--plugins/API/ProcessedReport.php46
-rw-r--r--plugins/API/RowEvolution.php28
-rw-r--r--plugins/Actions/API.php56
-rw-r--r--plugins/Actions/Actions.php12
-rw-r--r--plugins/Actions/Archiver.php26
-rw-r--r--plugins/Actions/ArchivingHelper.php46
-rw-r--r--plugins/Actions/Controller.php2
-rwxr-xr-xplugins/Annotations/API.php15
-rwxr-xr-xplugins/Annotations/AnnotationList.php10
-rwxr-xr-xplugins/Annotations/Annotations.php3
-rw-r--r--plugins/AnonymizeIP/AnonymizeIP.php3
-rw-r--r--plugins/CoreAdminHome/API.php16
-rw-r--r--plugins/CoreAdminHome/Controller.php9
-rw-r--r--plugins/CoreAdminHome/CoreAdminHome.php22
-rw-r--r--plugins/CoreHome/Controller.php7
-rw-r--r--plugins/CoreHome/CoreHome.php3
-rw-r--r--plugins/CoreHome/DataTableRowAction/RowEvolution.php5
-rw-r--r--plugins/CoreHome/templates/_dataTable.twig3
-rw-r--r--plugins/CorePluginsAdmin/Controller.php21
-rw-r--r--plugins/CorePluginsAdmin/CorePluginsAdmin.php3
-rw-r--r--plugins/CoreUpdater/Controller.php5
-rw-r--r--plugins/CoreUpdater/CoreUpdater.php5
-rw-r--r--plugins/CustomVariables/API.php16
-rw-r--r--plugins/CustomVariables/Archiver.php6
-rw-r--r--plugins/CustomVariables/CustomVariables.php8
-rw-r--r--plugins/DBStats/API.php25
-rw-r--r--plugins/DBStats/Controller.php5
-rw-r--r--plugins/DBStats/DBStats.php6
-rwxr-xr-xplugins/DBStats/MySQLMetadataProvider.php12
-rw-r--r--plugins/Dashboard/Controller.php11
-rw-r--r--plugins/Dashboard/Dashboard.php3
-rw-r--r--plugins/DevicesDetection/API.php15
-rw-r--r--plugins/DevicesDetection/Archiver.php3
-rw-r--r--plugins/DevicesDetection/DevicesDetection.php8
-rw-r--r--plugins/DoNotTrack/DoNotTrack.php4
-rw-r--r--plugins/ExampleAPI/API.php8
-rw-r--r--plugins/ExampleAPI/ExampleAPI.php3
-rw-r--r--plugins/ExamplePlugin/Controller.php2
-rw-r--r--plugins/ExamplePlugin/ExamplePlugin.php3
-rw-r--r--plugins/ExampleRssWidget/ExampleRssWidget.php3
-rw-r--r--plugins/ExampleUI/API.php11
-rw-r--r--plugins/ExampleUI/ExampleUI.php3
-rw-r--r--plugins/Feedback/Feedback.php3
-rw-r--r--plugins/Goals/API.php19
-rw-r--r--plugins/Goals/Archiver.php21
-rw-r--r--plugins/Goals/Controller.php12
-rw-r--r--plugins/Goals/Goals.php10
-rw-r--r--plugins/ImageGraph/API.php15
-rw-r--r--plugins/ImageGraph/ImageGraph.php4
-rw-r--r--plugins/ImageGraph/StaticGraph.php6
-rw-r--r--plugins/Installation/Controller.php4
-rw-r--r--plugins/Installation/Installation.php6
-rw-r--r--plugins/LanguagesManager/LanguagesManager.php8
-rw-r--r--plugins/Live/API.php57
-rw-r--r--plugins/Live/Controller.php7
-rw-r--r--plugins/Live/Live.php3
-rw-r--r--plugins/Live/Visitor.php6
-rw-r--r--plugins/Login/Controller.php5
-rw-r--r--plugins/Login/Login.php3
-rwxr-xr-xplugins/Login/templates/resetPassword.twig4
-rw-r--r--plugins/MobileMessaging/MobileMessaging.php5
-rw-r--r--plugins/MobileMessaging/SMSProvider.php3
-rwxr-xr-xplugins/MultiSites/API.php45
-rw-r--r--plugins/MultiSites/Controller.php15
-rw-r--r--plugins/MultiSites/MultiSites.php3
-rw-r--r--plugins/Overlay/API.php3
-rw-r--r--plugins/Overlay/Controller.php3
-rw-r--r--plugins/Overlay/Overlay.php4
-rw-r--r--plugins/PDFReports/API.php14
-rw-r--r--plugins/PDFReports/PDFReports.php15
-rw-r--r--plugins/PleineLune/PleineLune.php3
-rw-r--r--plugins/PrivacyManager/Controller.php19
-rwxr-xr-xplugins/PrivacyManager/LogDataPurger.php3
-rw-r--r--plugins/PrivacyManager/PrivacyManager.php16
-rwxr-xr-xplugins/PrivacyManager/ReportsPurger.php16
-rw-r--r--plugins/Provider/Archiver.php3
-rw-r--r--plugins/Provider/Provider.php8
-rw-r--r--plugins/Provider/functions.php3
-rw-r--r--plugins/Proxy/Controller.php67
-rw-r--r--plugins/Proxy/Proxy.php3
-rw-r--r--plugins/Proxy/templates/exportImageWindow.twig12
-rw-r--r--plugins/Referers/API.php45
-rw-r--r--plugins/Referers/Archiver.php3
-rw-r--r--plugins/Referers/Controller.php4
-rw-r--r--plugins/Referers/Referers.php8
-rw-r--r--plugins/SEO/API.php5
-rw-r--r--plugins/SEO/Controller.php3
-rw-r--r--plugins/SEO/SEO.php3
-rw-r--r--plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php2
-rw-r--r--plugins/SecurityInfo/SecurityInfo.php3
-rw-r--r--plugins/SegmentEditor/API.php15
-rw-r--r--plugins/SegmentEditor/SegmentEditor.php3
-rw-r--r--plugins/SitesManager/API.php15
-rw-r--r--plugins/SitesManager/Controller.php8
-rw-r--r--plugins/SitesManager/SitesManager.php3
-rw-r--r--plugins/Transitions/API.php53
-rw-r--r--plugins/Transitions/Transitions.php3
-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
-rw-r--r--plugins/UserCountryMap/Controller.php3
-rw-r--r--plugins/UserCountryMap/UserCountryMap.php3
-rw-r--r--plugins/UserSettings/API.php5
-rw-r--r--plugins/UserSettings/Archiver.php15
-rw-r--r--plugins/UserSettings/UserSettings.php8
-rw-r--r--plugins/UsersManager/API.php17
-rw-r--r--plugins/UsersManager/Controller.php1
-rw-r--r--plugins/UsersManager/UsersManager.php5
-rw-r--r--plugins/VisitFrequency/VisitFrequency.php3
-rw-r--r--plugins/VisitTime/API.php12
-rw-r--r--plugins/VisitTime/Archiver.php9
-rw-r--r--plugins/VisitTime/VisitTime.php8
-rw-r--r--plugins/VisitorGenerator/Controller.php6
-rw-r--r--plugins/VisitorGenerator/VisitorGenerator.php3
-rw-r--r--plugins/VisitorInterest/API.php9
-rw-r--r--plugins/VisitorInterest/Archiver.php11
-rw-r--r--plugins/VisitorInterest/VisitorInterest.php8
-rw-r--r--plugins/VisitsSummary/API.php2
-rw-r--r--plugins/VisitsSummary/Controller.php8
-rw-r--r--plugins/VisitsSummary/VisitsSummary.php5
-rw-r--r--plugins/Widgetize/Widgetize.php3
126 files changed, 738 insertions, 626 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php
index b93dae7902..e85974fd8e 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -8,17 +8,23 @@
* @category Piwik_Plugins
* @package Piwik_API
*/
+use Piwik\DataTable\Filter\ColumnDelete;
+use Piwik\DataTable\Row;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Date;
+use Piwik\DataTable;
+use Piwik\Plugin;
+use Piwik\Translate;
require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
/**
* @package Piwik_API
*/
-class Piwik_API extends Piwik_Plugin
+class Piwik_API extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -385,7 +391,7 @@ class Piwik_API_API
public function getMetadata($idSite, $apiModule, $apiAction, $apiParameters = array(), $language = false,
$period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false)
{
- Piwik_Translate::getInstance()->reloadLanguage($language);
+ Translate::getInstance()->reloadLanguage($language);
$reporter = new Piwik_API_ProcessedReport();
$metadata = $reporter->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, $period, $date, $hideMetricsDoc, $showSubtableReports);
return $metadata;
@@ -397,7 +403,7 @@ class Piwik_API_API
*
* @param string $idSites Comma separated list of website Ids
* @param bool|string $period
- * @param bool|Piwik_Date $date
+ * @param bool|Date $date
* @param bool $hideMetricsDoc
* @param bool $showSubtableReports
* @return array
@@ -466,13 +472,13 @@ class Piwik_API_API
$params['columns'] = implode(',', $columns);
$dataTable = Piwik_API_Proxy::getInstance()->call($className, 'get', $params);
// make sure the table has all columns
- $array = ($dataTable instanceof Piwik_DataTable_Array ? $dataTable->getArray() : array($dataTable));
+ $array = ($dataTable instanceof DataTable\Map ? $dataTable->getArray() : array($dataTable));
foreach ($array as $table) {
// we don't support idSites=all&date=DATE1,DATE2
- if ($table instanceof Piwik_DataTable) {
+ if ($table instanceof DataTable) {
$firstRow = $table->getFirstRow();
if (!$firstRow) {
- $firstRow = new Piwik_DataTable_Row;
+ $firstRow = new Row;
$table->addRow($firstRow);
}
foreach ($columns as $column) {
@@ -500,7 +506,7 @@ class Piwik_API_API
private function mergeDataTables($table1, $table2)
{
// handle table arrays
- if ($table1 instanceof Piwik_DataTable_Array && $table2 instanceof Piwik_DataTable_Array) {
+ if ($table1 instanceof DataTable\Map && $table2 instanceof DataTable\Map) {
$subTables2 = $table2->getArray();
foreach ($table1->getArray() as $index => $subTable1) {
$subTable2 = $subTables2[$index];
@@ -511,7 +517,7 @@ class Piwik_API_API
$firstRow1 = $table1->getFirstRow();
$firstRow2 = $table2->getFirstRow();
- if ($firstRow2 instanceof Piwik_DataTable_Row) {
+ if ($firstRow2 instanceof Row) {
foreach ($firstRow2->getColumns() as $metric => $value) {
$firstRow1->setColumn($metric, $value);
}
@@ -525,7 +531,7 @@ class Piwik_API_API
*
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param string $apiModule
* @param string $apiAction
* @param bool|string $label
@@ -591,7 +597,7 @@ class Piwik_API_API
throw new Exception("Requested segment not found.");
}
- $startDate = Piwik_Date::now()->subDay(60)->toString();
+ $startDate = Date::now()->subDay(60)->toString();
$requestLastVisits = "method=Live.getLastVisitsDetails
&idSite=$idSite
&period=range
@@ -622,7 +628,7 @@ class Piwik_API_API
$values = $table->getColumn($segmentName);
// Select also flattened keys (custom variables "page" scope, page URLs for one visit, page titles for one visit)
- $valuesBis = $table->getColumnsStartingWith($segmentName . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP);
+ $valuesBis = $table->getColumnsStartingWith($segmentName . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP);
$values = array_merge($values, $valuesBis);
// remove false values (while keeping zeros)
diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php
index db30a13648..a008c82025 100644
--- a/plugins/API/ProcessedReport.php
+++ b/plugins/API/ProcessedReport.php
@@ -1,8 +1,12 @@
<?php
+use Piwik\DataTable\Simple;
+use Piwik\DataTable\Row;
use Piwik\Metrics;
use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
+use Piwik\DataTable;
use Piwik\Site;
/**
@@ -60,7 +64,7 @@ class Piwik_API_ProcessedReport
*
* @param string $idSites Comma separated list of website Ids
* @param bool|string $period
- * @param bool|Piwik_Date $date
+ * @param bool|Date $date
* @param bool $hideMetricsDoc
* @param bool $showSubtableReports
* @return array
@@ -272,7 +276,7 @@ class Piwik_API_ProcessedReport
$url = Piwik_Url::getQueryStringFromParameters($parameters);
$request = new Piwik_API_Request($url);
try {
- /** @var Piwik_DataTable */
+ /** @var DataTable */
$dataTable = $request->process();
} catch (Exception $e) {
throw new Exception("API returned an error: " . $e->getMessage() . " at " . basename($e->getFile()) . ":" . $e->getLine() . "\n");
@@ -307,14 +311,14 @@ class Piwik_API_ProcessedReport
* - remove metrics based on $reportMetadata['metrics']
* - add 0 valued metrics if $dataTable doesn't provide all $reportMetadata['metrics']
* - format metric values to a 'human readable' format
- * - extract row metadata to a separate Piwik_DataTable_Simple|Piwik_DataTable_Array : $rowsMetadata
+ * - extract row metadata to a separate Simple|Set : $rowsMetadata
* - translate metric names to a separate array : $columns
*
* @param int $idSite enables monetary value formatting based on site currency
- * @param Piwik_DataTable|Piwik_DataTable_Array $dataTable
+ * @param \Piwik\DataTable\Set $dataTable
* @param array $reportMetadata
* @param bool $showRawMetrics
- * @return array Piwik_DataTable_Simple|Piwik_DataTable_Array $newReport with human readable format & array $columns list of translated column names & Piwik_DataTable_Simple|Piwik_DataTable_Array $rowsMetadata
+ * @return array Simple|Set $newReport with human readable format & array $columns list of translated column names & Simple|Set $rowsMetadata
*/
private function handleTableReport($idSite, $dataTable, &$reportMetadata, $showRawMetrics = false)
{
@@ -356,17 +360,17 @@ class Piwik_API_ProcessedReport
$columns = $this->hideShowMetrics($columns);
- // $dataTable is an instance of Piwik_DataTable_Array when multiple periods requested
- if ($dataTable instanceof Piwik_DataTable_Array) {
- // Need a new Piwik_DataTable_Array to store the 'human readable' values
- $newReport = new Piwik_DataTable_Array();
+ // $dataTable is an instance of Set when multiple periods requested
+ if ($dataTable instanceof DataTable\Map) {
+ // Need a new Set to store the 'human readable' values
+ $newReport = new DataTable\Map();
$newReport->setKeyName("prettyDate");
- // Need a new Piwik_DataTable_Array to store report metadata
- $rowsMetadata = new Piwik_DataTable_Array();
+ // Need a new Set to store report metadata
+ $rowsMetadata = new DataTable\Map();
$rowsMetadata->setKeyName("prettyDate");
- // Process each Piwik_DataTable_Simple entry
+ // Process each Simple entry
foreach ($dataTable->getArray() as $label => $simpleDataTable) {
$this->removeEmptyColumns($columns, $reportMetadata, $simpleDataTable);
@@ -395,7 +399,7 @@ class Piwik_API_ProcessedReport
*/
private function removeEmptyColumns(&$columns, &$reportMetadata, $dataTable)
{
- $emptyColumns = $dataTable->getMetadata(Piwik_DataTable::EMPTY_COLUMNS_METADATA_NAME);
+ $emptyColumns = $dataTable->getMetadata(DataTable::EMPTY_COLUMNS_METADATA_NAME);
if (!is_array($emptyColumns)) {
return;
@@ -473,26 +477,26 @@ class Piwik_API_ProcessedReport
* - remove metrics based on $reportMetadata['metrics']
* - add 0 valued metrics if $simpleDataTable doesn't provide all $reportMetadata['metrics']
* - format metric values to a 'human readable' format
- * - extract row metadata to a separate Piwik_DataTable_Simple $rowsMetadata
+ * - extract row metadata to a separate Simple $rowsMetadata
*
* @param int $idSite enables monetary value formatting based on site currency
- * @param Piwik_DataTable_Simple $simpleDataTable
+ * @param Simple $simpleDataTable
* @param array $metadataColumns
* @param boolean $hasDimension
* @param bool $returnRawMetrics If set to true, the original metrics will be returned
*
- * @return array Piwik_DataTable $enhancedDataTable filtered metrics with human readable format & Piwik_DataTable_Simple $rowsMetadata
+ * @return array DataTable $enhancedDataTable filtered metrics with human readable format & Simple $rowsMetadata
*/
private function handleSimpleDataTable($idSite, $simpleDataTable, $metadataColumns, $hasDimension, $returnRawMetrics = false)
{
// new DataTable to store metadata
- $rowsMetadata = new Piwik_DataTable();
+ $rowsMetadata = new DataTable();
// new DataTable to store 'human readable' values
if ($hasDimension) {
- $enhancedDataTable = new Piwik_DataTable();
+ $enhancedDataTable = new DataTable();
} else {
- $enhancedDataTable = new Piwik_DataTable_Simple();
+ $enhancedDataTable = new Simple();
}
// add missing metrics
@@ -506,7 +510,7 @@ class Piwik_API_ProcessedReport
}
foreach ($simpleDataTable->getRows() as $row) {
- $enhancedRow = new Piwik_DataTable_Row();
+ $enhancedRow = new Row();
$enhancedDataTable->addRow($enhancedRow);
$rowMetrics = $row->getColumns();
foreach ($rowMetrics as $columnName => $columnValue) {
@@ -528,7 +532,7 @@ class Piwik_API_ProcessedReport
// Create a row metadata only if there are metadata to insert
if (count($rowMetadata) > 0 || !is_null($idSubDataTable)) {
- $metadataRow = new Piwik_DataTable_Row();
+ $metadataRow = new Row();
$rowsMetadata->addRow($metadataRow);
foreach ($rowMetadata as $metadataKey => $metadataValue) {
diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php
index 13b1250a1c..ec6b3c06fc 100644
--- a/plugins/API/RowEvolution.php
+++ b/plugins/API/RowEvolution.php
@@ -8,9 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_API
*/
+use Piwik\DataTable\Filter\CalculateEvolutionFilter;
+use Piwik\DataTable\Filter\SafeDecodeLabel;
+use Piwik\DataTable\Row;
use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
/**
* This class generates a Row evolution dataset, from input request
@@ -104,7 +108,7 @@ class Piwik_API_RowEvolution
/**
* Get row evolution for a single label
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
* @param array $metadata
* @param string $apiModule
* @param string $apiAction
@@ -119,10 +123,10 @@ class Piwik_API_RowEvolution
$logo = $actualLabel = false;
$urlFound = false;
foreach ($dataTable->getArray() as $date => $subTable) {
- /** @var $subTable Piwik_DataTable */
+ /** @var $subTable DataTable */
$subTable->applyQueuedFilters();
if ($subTable->getRowsCount() > 0) {
- /** @var $row Piwik_DataTable_Row */
+ /** @var $row Row */
$row = $subTable->getFirstRow();
if (!$actualLabel) {
@@ -155,7 +159,7 @@ class Piwik_API_RowEvolution
}
$return = array(
- 'label' => Piwik_DataTable_Filter_SafeDecodeLabel::safeDecodeLabel($actualLabel),
+ 'label' => SafeDecodeLabel::safeDecodeLabel($actualLabel),
'reportData' => $dataTable,
'metadata' => $metadata
);
@@ -190,7 +194,7 @@ class Piwik_API_RowEvolution
* @param $segment
* @param $idGoal
* @throws Exception
- * @return Piwik_DataTable_Array|Piwik_DataTable
+ * @return DataTable\Map|DataTable
*/
private function loadRowEvolutionDataFromAPI($idSite, $period, $date, $apiModule, $apiAction, $label = false, $segment = false, $idGoal = false)
{
@@ -289,7 +293,7 @@ class Piwik_API_RowEvolution
* Given the Row evolution dataTable, and the associated metadata,
* enriches the metadata with min/max values, and % change between the first period and the last one
* @param array $metadata
- * @param Piwik_DataTable_Array $dataTable
+ * @param DataTable\Map $dataTable
*/
private function enhanceRowEvolutionMetaData(&$metadata, $dataTable)
{
@@ -345,8 +349,8 @@ class Piwik_API_RowEvolution
continue;
}
- $change = Piwik_DataTable_Filter_CalculateEvolutionFilter::calculate($last, $first, $quotientPrecision = 0);
- $change = Piwik_DataTable_Filter_CalculateEvolutionFilter::prependPlusSignToNumber($change);
+ $change = CalculateEvolutionFilter::calculate($last, $first, $quotientPrecision = 0);
+ $change = CalculateEvolutionFilter::prependPlusSignToNumber($change);
$metricsResult[$metric]['change'] = $change;
}
@@ -391,7 +395,7 @@ class Piwik_API_RowEvolution
// array('label' => $label, 'column' => $value).
$dataTableMulti = $dataTable->getEmptyClone();
foreach ($dataTable->getArray() as $tableLabel => $table) {
- $newRow = new Piwik_DataTable_Row();
+ $newRow = new Row();
foreach ($labels as $labelIdx => $label) {
$row = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
@@ -429,7 +433,7 @@ class Piwik_API_RowEvolution
$label .= ' (' . $metadata['columns'][$column] . ')';
}
$metricName = $column . '_' . $labelIndex;
- $metadata['metrics'][$metricName] = Piwik_DataTable_Filter_SafeDecodeLabel::safeDecodeLabel($label);
+ $metadata['metrics'][$metricName] = SafeDecodeLabel::safeDecodeLabel($label);
if (!empty($logos[$labelIndex])) {
$metadata['logos'][$metricName] = $logos[$labelIndex];
@@ -448,9 +452,9 @@ class Piwik_API_RowEvolution
/**
* Returns the row in a datatable by its Piwik_API_DataTableManipulator_LabelFilter::FLAG_IS_ROW_EVOLUTION metadata.
*
- * @param Piwik_DataTable $table
+ * @param DataTable $table
* @param int $labelIdx
- * @return Piwik_DataTable_Row|false
+ * @return Row|false
*/
private function getRowEvolutionRowFromLabelIdx($table, $labelIdx)
{
diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php
index 0262f807e0..b40afb87e2 100644
--- a/plugins/Actions/API.php
+++ b/plugins/Actions/API.php
@@ -12,6 +12,8 @@ use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
+use Piwik\DataTable;
/**
* The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles (Piwik Events),
@@ -50,7 +52,7 @@ class Piwik_Actions_API
* @param string $date
* @param bool|string $segment
* @param bool|array $columns
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function get($idSite, $period, $date, $segment = false, $columns = false)
{
@@ -112,12 +114,12 @@ class Piwik_Actions_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param bool $segment
* @param bool $expanded
* @param bool $idSubtable
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getPageUrls($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
@@ -130,12 +132,12 @@ class Piwik_Actions_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param bool $segment
* @param bool $expanded
* @param bool $idSubtable
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getPageUrlsFollowingSiteSearch($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
@@ -147,12 +149,12 @@ class Piwik_Actions_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param bool $segment
* @param bool $expanded
* @param bool $idSubtable
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getPageTitlesFollowingSiteSearch($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
@@ -162,7 +164,7 @@ class Piwik_Actions_API
}
/**
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
*/
protected function keepPagesFollowingSearch($dataTable)
{
@@ -213,7 +215,7 @@ class Piwik_Actions_API
}
/**
- * Returns a Piwik_DataTable with analytics information for every unique entry page title
+ * Returns a DataTable with analytics information for every unique entry page title
* for the given site, time period & segment.
*/
public function getEntryPageTitles($idSite, $period, $date, $segment = false, $expanded = false,
@@ -225,7 +227,7 @@ class Piwik_Actions_API
}
/**
- * Returns a Piwik_DataTable with analytics information for every unique exit page title
+ * Returns a DataTable with analytics information for every unique exit page title
* for the given site, time period & segment.
*/
public function getExitPageTitles($idSite, $period, $date, $segment = false, $expanded = false,
@@ -306,7 +308,7 @@ class Piwik_Actions_API
Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT,
create_function('$value', 'return $value >= 1;')
));
- $dataTable->deleteRow(Piwik_DataTable::ID_SUMMARY_ROW);
+ $dataTable->deleteRow(DataTable::ID_SUMMARY_ROW);
$dataTable->deleteColumn(Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT);
$this->filterPageDatatable($dataTable);
$this->filterActionsDataTable($dataTable);
@@ -317,10 +319,10 @@ class Piwik_Actions_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param bool $segment
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getSiteSearchCategories($idSite, $period, $date, $segment = false)
{
@@ -329,10 +331,10 @@ class Piwik_Actions_API
$customVarNameToLookFor = Piwik_Tracker_Action::CVAR_KEY_SEARCH_CATEGORY;
- $dataTable = new Piwik_DataTable();
+ $dataTable = new DataTable();
// Handle case where date=last30&period=day
// FIXMEA: this logic should really be refactored somewhere, this is ugly!
- if ($customVariables instanceof Piwik_DataTable_Array) {
+ if ($customVariables instanceof DataTable\Map) {
$dataTable = $customVariables->getEmptyClone();
$customVariableDatatables = $customVariables->getArray();
@@ -349,7 +351,7 @@ class Piwik_Actions_API
}
}
}
- } elseif ($customVariables instanceof Piwik_DataTable) {
+ } elseif ($customVariables instanceof DataTable) {
$row = $customVariables->getRowFromLabel($customVarNameToLookFor);
if ($row) {
$idSubtable = $row->getIdSubDataTable();
@@ -388,7 +390,7 @@ class Piwik_Actions_API
// fetch the data table
$table = call_user_func_array(array('Piwik\Archive', 'getDataTableFromArchive'), $callBackParameters);
- if ($table instanceof Piwik_DataTable_Array) {
+ if ($table instanceof DataTable\Map) {
// search an array of tables, e.g. when using date=last30
// note that if the root is an array, we filter all children
// if an array occurs inside the nested table, we only look for the first match (see below)
@@ -414,7 +416,7 @@ class Piwik_Actions_API
protected function doFilterPageDatatableSearch($callBackParameters, $table, $searchTree)
{
// filter a data table array
- if ($table instanceof Piwik_DataTable_Array) {
+ if ($table instanceof DataTable\Map) {
foreach ($table->getArray() as $subTable) {
$filteredSubTable = $this->doFilterPageDatatableSearch($callBackParameters, $subTable, $searchTree);
@@ -425,24 +427,24 @@ class Piwik_Actions_API
}
// nothing found in all sub tables
- return new Piwik_DataTable;
+ return new DataTable;
}
// filter regular data table
- if ($table instanceof Piwik_DataTable) {
+ if ($table instanceof DataTable) {
// search for the first part of the tree search
$search = array_shift($searchTree);
$row = $table->getRowFromLabel($search);
if ($row === false) {
// not found
- $result = new Piwik_DataTable;
+ $result = new DataTable;
$result->metadata = $table->metadata;
return $result;
}
// end of tree search reached
if (count($searchTree) == 0) {
- $result = new Piwik_DataTable();
+ $result = new DataTable();
$result->addRow($row);
$result->metadata = $table->metadata;
return $result;
@@ -489,8 +491,8 @@ class Piwik_Actions_API
Metrics::INDEX_PAGE_MAX_TIME_GENERATION
)));
- if ($dataTable instanceof Piwik_DataTable) {
- $emptyColumns = $dataTable->getMetadata(Piwik_DataTable::EMPTY_COLUMNS_METADATA_NAME);
+ if ($dataTable instanceof DataTable) {
+ $emptyColumns = $dataTable->getMetadata(DataTable::EMPTY_COLUMNS_METADATA_NAME);
if (!is_array($emptyColumns)) {
$emptyColumns = array();
}
@@ -498,7 +500,7 @@ class Piwik_Actions_API
$emptyColumns[] = 'avg_time_generation';
$emptyColumns[] = 'min_time_generation';
$emptyColumns[] = 'max_time_generation';
- $dataTable->setMetadata(Piwik_DataTable::EMPTY_COLUMNS_METADATA_NAME, $emptyColumns);
+ $dataTable->setMetadata(DataTable::EMPTY_COLUMNS_METADATA_NAME, $emptyColumns);
}
}
}
@@ -519,7 +521,7 @@ class Piwik_Actions_API
/**
* Removes DataTable rows referencing actions that were never the first action of a visit.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
*/
private function filterNonEntryActions($dataTable)
{
@@ -529,7 +531,7 @@ class Piwik_Actions_API
/**
* Removes DataTable rows referencing actions that were never the last action of a visit.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
*/
private function filterNonExitActions($dataTable)
{
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index 03109bfdb9..0906c0cbd3 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_Actions
*/
+use Piwik\ArchiveProcessor;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
use Piwik\SegmentExpression;
use Piwik\Site;
@@ -20,7 +22,7 @@ use Piwik\Site;
*
* @package Piwik_Actions
*/
-class Piwik_Actions extends Piwik_Plugin
+class Piwik_Actions extends Plugin
{
const ACTIONS_REPORT_ROWS_DISPLAY = 100;
@@ -572,7 +574,7 @@ class Piwik_Actions extends Piwik_Plugin
* For each action we process the "interest statistics" :
* visits, unique visitors, bounce count, sum visit length.
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_Actions_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -580,7 +582,7 @@ class Piwik_Actions extends Piwik_Plugin
}
}
- function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_Actions_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -597,7 +599,7 @@ class Piwik_Actions extends Piwik_Plugin
static protected function isCustomVariablesPluginsEnabled()
{
- return PluginsManager::getInstance()->isPluginActivated('CustomVariables');
+ return \Piwik\PluginsManager::getInstance()->isPluginActivated('CustomVariables');
}
/**
@@ -711,7 +713,7 @@ class Piwik_Actions extends Piwik_Plugin
);
// prettify avg_time_on_page column
- $getPrettyTimeFromSeconds = array('Piwik', 'getPrettyTimeFromSeconds');
+ $getPrettyTimeFromSeconds = '\Piwik\Piwik::getPrettyTimeFromSeconds';
$result['filters'][] = array('ColumnCallbackReplace', array('avg_time_on_page', $getPrettyTimeFromSeconds));
// prettify avg_time_generation column
diff --git a/plugins/Actions/Archiver.php b/plugins/Actions/Archiver.php
index f512bd36ea..987bf5104a 100644
--- a/plugins/Actions/Archiver.php
+++ b/plugins/Actions/Archiver.php
@@ -9,14 +9,18 @@
* @package Piwik_Actions
*/
use Piwik\Config;
+use Piwik\DataTable\Manager;
+use Piwik\DataTable\Row\DataTableSummaryRow;
use Piwik\Metrics;
+use Piwik\DataTable;
+use Piwik\PluginsArchiver;
/**
* Class encapsulating logic to process Day/Period Archiving for the Actions reports
*
* @package Piwik_Actions
*/
-class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
+class Piwik_Actions_Archiver extends PluginsArchiver
{
const DOWNLOADS_RECORD_NAME = 'Actions_downloads';
const OUTLINKS_RECORD_NAME = 'Actions_outlink';
@@ -152,7 +156,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
{
$this->actionsTablesByType = array();
foreach (self::$actionTypes as $type) {
- $dataTable = new Piwik_DataTable();
+ $dataTable = new DataTable();
$dataTable->setMaximumAllowedRows(Piwik_Actions_ArchivingHelper::$maximumRowsInDataTableLevelZero);
if ($type == Piwik_Tracker_Action::TYPE_ACTION_URL
@@ -212,7 +216,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new Piwik_RankingQuery($rankingQueryLimit);
- $rankingQuery->setOthersLabel(Piwik_DataTable::LABEL_SUMMARY_ROW);
+ $rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn(array('idaction', 'name'));
$rankingQuery->addColumn(array('url_prefix', Metrics::INDEX_NB_UNIQ_VISITORS));
$rankingQuery->addColumn(array(Metrics::INDEX_PAGE_NB_HITS, Metrics::INDEX_NB_VISITS), 'sum');
@@ -291,7 +295,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new Piwik_RankingQuery($rankingQueryLimit);
- $rankingQuery->setOthersLabel(Piwik_DataTable::LABEL_SUMMARY_ROW);
+ $rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn('idaction');
$rankingQuery->addColumn(Metrics::INDEX_PAGE_ENTRY_NB_UNIQ_VISITORS);
$rankingQuery->addColumn(array(Metrics::INDEX_PAGE_ENTRY_NB_VISITS,
@@ -342,7 +346,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new Piwik_RankingQuery($rankingQueryLimit);
- $rankingQuery->setOthersLabel(Piwik_DataTable::LABEL_SUMMARY_ROW);
+ $rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn('idaction');
$rankingQuery->addColumn(Metrics::INDEX_PAGE_EXIT_NB_UNIQ_VISITORS);
$rankingQuery->addColumn(Metrics::INDEX_PAGE_EXIT_NB_VISITS, 'sum');
@@ -388,7 +392,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
$rankingQuery = false;
if ($rankingQueryLimit > 0) {
$rankingQuery = new Piwik_RankingQuery($rankingQueryLimit);
- $rankingQuery->setOthersLabel(Piwik_DataTable::LABEL_SUMMARY_ROW);
+ $rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW);
$rankingQuery->addLabelColumn('idaction');
$rankingQuery->addColumn(Metrics::INDEX_PAGE_SUM_TIME_SPENT, 'sum');
$rankingQuery->partitionResultIntoMultipleGroups('type', array_keys($this->actionsTablesByType));
@@ -454,7 +458,7 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
/**
* @param $typeId
- * @return Piwik_DataTable
+ * @return DataTable
*/
protected function getDataTable($typeId)
{
@@ -472,20 +476,20 @@ class Piwik_Actions_Archiver extends Piwik_PluginsArchiver
* For rows which have subtables (eg. directories with sub pages),
* deletes columns which don't make sense when all values of sub pages are summed.
*
- * @param $dataTable Piwik_DataTable
+ * @param $dataTable DataTable
*/
static public function deleteInvalidSummedColumnsFromDataTable($dataTable)
{
foreach ($dataTable->getRows() as $id => $row) {
if (($idSubtable = $row->getIdSubDataTable()) !== null
- || $id === Piwik_DataTable::ID_SUMMARY_ROW
+ || $id === DataTable::ID_SUMMARY_ROW
) {
if ($idSubtable !== null) {
- $subtable = Piwik_DataTable_Manager::getInstance()->getTable($idSubtable);
+ $subtable = Manager::getInstance()->getTable($idSubtable);
self::deleteInvalidSummedColumnsFromDataTable($subtable);
}
- if ($row instanceof Piwik_DataTable_Row_DataTableSummary) {
+ if ($row instanceof DataTableSummaryRow) {
$row->recalculate();
}
diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php
index 514b75116b..2e885a435e 100644
--- a/plugins/Actions/ArchivingHelper.php
+++ b/plugins/Actions/ArchivingHelper.php
@@ -9,7 +9,9 @@
* @package Piwik_Actions
*/
use Piwik\Config;
+use Piwik\DataTable\Row;
use Piwik\Metrics;
+use Piwik\DataTable;
/**
* This static class provides:
@@ -55,7 +57,7 @@ class Piwik_Actions_ArchivingHelper
) {
$url = null;
} elseif (!empty($row['name'])
- && $row['name'] != Piwik_DataTable::LABEL_SUMMARY_ROW
+ && $row['name'] != DataTable::LABEL_SUMMARY_ROW
) {
$url = Piwik_Tracker_Action::reconstructNormalizedUrl((string)$row['name'], $row['url_prefix']);
}
@@ -70,7 +72,7 @@ class Piwik_Actions_ArchivingHelper
// in some unknown case, the type field is NULL, as reported in #1082 - we ignore this page view
if (empty($actionType)) {
- if ($idaction != Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($idaction != DataTable::LABEL_SUMMARY_ROW) {
self::setCachedActionRow($idaction, $actionType, false);
}
continue;
@@ -97,7 +99,7 @@ class Piwik_Actions_ArchivingHelper
// This is to ensure that when, different URLs are loaded with the same page name.
// For example http://piwik.org and http://id.piwik.org are reported in Piwik > Actions > Pages with /index
// But, we must make sure http://piwik.org is used to link & for transitions
- // Note: this code is partly duplicated from Piwik_DataTable_Row->sumRowMetadata()
+ // Note: this code is partly duplicated from Row->sumRowMetadata()
if (!is_null($url)
&& !$actionRow->isSummaryRow()
) {
@@ -220,7 +222,7 @@ class Piwik_Actions_ArchivingHelper
self::$maximumRowsInDataTableLevelZero = Config::getInstance()->General['datatable_archiving_maximum_rows_actions'];
self::$maximumRowsInSubDataTable = Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_actions'];
- Piwik_DataTable::setMaximumDepthLevelAllowedAtLeast(self::getSubCategoryLevelLimit() + 1);
+ DataTable::setMaximumDepthLevelAllowedAtLeast(self::getSubCategoryLevelLimit() + 1);
}
@@ -229,7 +231,7 @@ class Piwik_Actions_ArchivingHelper
* there could be pages that have exit/entry hits, but don't yet
* have a record in the table (or the record was truncated).
*
- * @return Piwik_DataTable_Row
+ * @return Row
*/
static private function getDefaultRow()
{
@@ -238,8 +240,8 @@ class Piwik_Actions_ArchivingHelper
// This row is used in the case where an action is know as an exit_action
// but this action was not properly recorded when it was hit in the first place
// so we add this fake row information to make sure there is a nb_hits, etc. column for every action
- $row = new Piwik_DataTable_Row(array(
- Piwik_DataTable_Row::COLUMNS => array(
+ $row = new Row(array(
+ Row::COLUMNS => array(
Metrics::INDEX_NB_VISITS => 1,
Metrics::INDEX_NB_UNIQ_VISITORS => 1,
Metrics::INDEX_PAGE_NB_HITS => 1,
@@ -256,17 +258,17 @@ class Piwik_Actions_ArchivingHelper
* @param int $actionType
* @param int $urlPrefix
* @param array $actionsTablesByType
- * @return Piwik_DataTable
+ * @return DataTable
*/
protected static function getActionRow($actionName, $actionType, $urlPrefix = null, &$actionsTablesByType)
{
// we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.)
- /* @var Piwik_DataTable $currentTable */
+ /* @var DataTable $currentTable */
$currentTable =& $actionsTablesByType[$actionType];
// check for ranking query cut-off
- if ($actionName == Piwik_DataTable::LABEL_SUMMARY_ROW) {
- $summaryRow = $currentTable->getRowFromId(Piwik_DataTable::ID_SUMMARY_ROW);
+ if ($actionName == DataTable::LABEL_SUMMARY_ROW) {
+ $summaryRow = $currentTable->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($summaryRow === false) {
$summaryRow = $currentTable->addSummaryRow(self::createSummaryRow());
}
@@ -296,11 +298,11 @@ class Piwik_Actions_ArchivingHelper
* we explode link http://piwik.org/some/path into an array( 'some', 'path' );
*
* for action names:
- * we explode name 'Piwik / Category 1 / Category 2' into an array('Piwik', 'Category 1', 'Category 2');
+ * we explode name 'Piwik / Category 1 / Category 2' into an array('\Piwik\Piwik', 'Category 1', 'Category 2');
*
- * @param string action name
- * @param int action type
- * @param int url prefix (only used for TYPE_ACTION_URL)
+ * @param string $name action name
+ * @param int $type action type
+ * @param int $urlPrefix url prefix (only used for TYPE_ACTION_URL)
* @return array of exploded elements from $name
*/
static public function getActionExplodedNames($name, $type, $urlPrefix = null)
@@ -402,7 +404,7 @@ class Piwik_Actions_ArchivingHelper
*/
private static function getCachedActionRowKey($idAction, $actionType)
{
- return $idAction == Piwik_DataTable::LABEL_SUMMARY_ROW
+ return $idAction == DataTable::LABEL_SUMMARY_ROW
? $actionType . '_others'
: $idAction;
}
@@ -451,7 +453,7 @@ class Piwik_Actions_ArchivingHelper
*
* @param int $idAction
* @param int $actionType
- * @return Piwik_DataTable_Row|false
+ * @return Row|false
*/
private static function getCachedActionRow($idAction, $actionType)
{
@@ -472,7 +474,7 @@ class Piwik_Actions_ArchivingHelper
*
* @param int $idAction
* @param int $actionType
- * @param Piwik_DataTable_Row
+ * @param \DataTable\Row
*/
private static function setCachedActionRow($idAction, $actionType, $actionRow)
{
@@ -496,13 +498,13 @@ class Piwik_Actions_ArchivingHelper
/**
* Creates a summary row for an Actions DataTable.
*
- * @return Piwik_DataTable_Row
+ * @return Row
*/
private static function createSummaryRow()
{
- return new Piwik_DataTable_Row(array(
- Piwik_DataTable_Row::COLUMNS =>
- array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW) + self::getDefaultRowColumns()
+ return new Row(array(
+ Row::COLUMNS =>
+ array('label' => DataTable::LABEL_SUMMARY_ROW) + self::getDefaultRowColumns()
));
}
}
diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php
index 6044c225d8..f90ad12f28 100644
--- a/plugins/Actions/Controller.php
+++ b/plugins/Actions/Controller.php
@@ -49,7 +49,7 @@ class Piwik_Actions_Controller extends Piwik_Controller
$view->noResultKeywords = $this->getSiteSearchNoResultKeywords(true);
$view->pagesUrlsFollowingSiteSearch = $this->getPageUrlsFollowingSiteSearch(true);
- $categoryTrackingEnabled = PluginsManager::getInstance()->isPluginActivated('CustomVariables');
+ $categoryTrackingEnabled = \Piwik\PluginsManager::getInstance()->isPluginActivated('CustomVariables');
if ($categoryTrackingEnabled) {
$view->categories = $this->getSiteSearchCategories(true);
}
diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php
index 603cce5431..8e2ec1c167 100755
--- a/plugins/Annotations/API.php
+++ b/plugins/Annotations/API.php
@@ -9,8 +9,9 @@
* @package Piwik_Annotations
*/
use Piwik\Period;
-use Piwik\Period_Range;
+use Piwik\Period\Range;
use Piwik\Piwik;
+use Piwik\Date;
/**
* @see plugins/Annotations/AnnotationList.php
@@ -248,7 +249,7 @@ class Piwik_Annotations_API
&& $result[$idSite][$strDate]['count'] == 1
) {
$annotationsForSite = $annotations->search(
- $date, Piwik_Date::factory($nextDate->getTimestamp() - 1), $idSite);
+ $date, Date::factory($nextDate->getTimestamp() - 1), $idSite);
$annotation = reset($annotationsForSite[$idSite]);
$result[$idSite][$strDate]['note'] = $annotation['note'];
@@ -318,9 +319,9 @@ class Piwik_Annotations_API
|| $period == 'range'
) {
if ($period == 'range') {
- $oPeriod = new Period_Range('day', $date);
+ $oPeriod = new Range('day', $date);
} else {
- $oPeriod = Period::factory($period, Piwik_Date::factory($date));
+ $oPeriod = Period::factory($period, Date::factory($date));
}
$startDate = $oPeriod->getDateStart();
@@ -331,8 +332,8 @@ class Piwik_Annotations_API
Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($period, $date, $lastN);
list($startDate, $endDate) = explode(',', $date);
- $startDate = Piwik_Date::factory($startDate);
- $endDate = Piwik_Date::factory($endDate);
+ $startDate = Date::factory($startDate);
+ $endDate = Date::factory($endDate);
}
return array($startDate, $endDate);
}
@@ -361,6 +362,6 @@ class Piwik_Annotations_API
return;
}
- Piwik_Date::factory($date);
+ Date::factory($date);
}
}
diff --git a/plugins/Annotations/AnnotationList.php b/plugins/Annotations/AnnotationList.php
index 4d15e91e50..0f5ba42ae9 100755
--- a/plugins/Annotations/AnnotationList.php
+++ b/plugins/Annotations/AnnotationList.php
@@ -9,6 +9,7 @@
* @package Piwik_Annotations
*/
use Piwik\Piwik;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -172,7 +173,6 @@ class Piwik_Annotations_AnnotationList
*
* @param int $idSite The ID of the site to get an annotation for.
* @param int $idNote The ID of the note to get.
- * @param array The annotation.
* @throws Exception if $idSite is not an ID that was supplied upon construction.
* @throws Exception if $idNote does not refer to valid note for the site.
*/
@@ -194,8 +194,8 @@ class Piwik_Annotations_AnnotationList
*
* @see self::get for info on what attributes stored within annotations.
*
- * @param Piwik_Date|bool $startDate The start of the date range.
- * @param Piwik_Date|bool $endDate The end of the date range.
+ * @param Date|bool $startDate The start of the date range.
+ * @param Date|bool $endDate The end of the date range.
* @param array|bool|int|string $idSite IDs of the sites whose annotations to
* search through.
* @return array Array mapping site IDs with arrays of annotations, eg:
@@ -230,7 +230,7 @@ class Piwik_Annotations_AnnotationList
foreach ($this->annotations[$idSite] as $idNote => $annotation) {
if ($startDate !== false) {
- $annotationDate = Piwik_Date::factory($annotation['date']);
+ $annotationDate = Date::factory($annotation['date']);
if ($annotationDate->getTimestamp() < $startDate->getTimestamp()
|| $annotationDate->getTimestamp() > $endDate->getTimestamp()
) {
@@ -266,7 +266,7 @@ class Piwik_Annotations_AnnotationList
$this->checkIdSiteIsLoaded($idSite);
// search includes end date, and count should not, so subtract one from the timestamp
- $annotations = $this->search($startDate, Piwik_Date::factory($endDate->getTimestamp() - 1));
+ $annotations = $this->search($startDate, Date::factory($endDate->getTimestamp() - 1));
// count the annotations
$count = $starred = 0;
diff --git a/plugins/Annotations/Annotations.php b/plugins/Annotations/Annotations.php
index 1ef39eeee6..5b29ec48b5 100755
--- a/plugins/Annotations/Annotations.php
+++ b/plugins/Annotations/Annotations.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_Annotations
*/
+use Piwik\Plugin;
/**
* Annotations plugins. Provides the ability to attach text notes to
@@ -15,7 +16,7 @@
*
* @package Piwik_Annotations
*/
-class Piwik_Annotations extends Piwik_Plugin
+class Piwik_Annotations extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php
index a835a91d8a..7d6ce520a9 100644
--- a/plugins/AnonymizeIP/AnonymizeIP.php
+++ b/plugins/AnonymizeIP/AnonymizeIP.php
@@ -10,13 +10,14 @@
*/
use Piwik\Config;
use Piwik\Common;
+use Piwik\Plugin;
/**
* Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany.
*
* @package Piwik_AnonymizeIP
*/
-class Piwik_AnonymizeIP extends Piwik_Plugin
+class Piwik_AnonymizeIP extends Plugin
{
/**
* @see Piwik_Plugin::getInformation
diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php
index d9bf9b4cee..fe6772fe09 100644
--- a/plugins/CoreAdminHome/API.php
+++ b/plugins/CoreAdminHome/API.php
@@ -8,9 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
+use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Period;
+use Piwik\Period\Week;
use Piwik\Piwik;
+use Piwik\Config;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -85,7 +89,7 @@ class Piwik_CoreAdminHome_API
$dates = array_unique($dates);
foreach ($dates as $theDate) {
try {
- $date = Piwik_Date::factory($theDate);
+ $date = Date::factory($theDate);
} catch (Exception $e) {
$invalidDates[] = $theDate;
continue;
@@ -105,13 +109,13 @@ class Piwik_CoreAdminHome_API
if ($logsDeleteEnabled
&& $logsAreDeletedBeforeThisDate
) {
- $minimumDateWithLogs = Piwik_Date::factory('today')->subDay($logsAreDeletedBeforeThisDate);
+ $minimumDateWithLogs = Date::factory('today')->subDay($logsAreDeletedBeforeThisDate);
}
// Given the list of dates, process which tables they should be deleted from
$minDate = false;
$warningDates = $processedDates = array();
- /* @var $date Piwik_Date */
+ /* @var $date Date */
foreach ($toInvalidate as $date) {
// we should only delete reports for dates that are more recent than N days
if ($minimumDateWithLogs
@@ -131,7 +135,7 @@ class Piwik_CoreAdminHome_API
$datesByMonth[$year][] = $date->toString();
// but also weeks overlapping several months stored in the month where the week is starting
- /* @var $week Piwik_Period_Week */
+ /* @var $week Week */
$week = Period::factory('week', $date);
$weekAsString = $week->getDateStart()->toString('Y_m');
$datesByMonth[$weekAsString][] = $date->toString();
@@ -146,10 +150,10 @@ class Piwik_CoreAdminHome_API
// In each table, invalidate day/week/month/year containing this date
$sqlIdSites = implode(",", $idSites);
- $archiveTables = Piwik_DataAccess_ArchiveTableCreator::getTablesArchivesInstalled();
+ $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
foreach ($archiveTables as $table) {
// Extract Y_m from table name
- $suffix = Piwik_DataAccess_ArchiveTableCreator::getDateFromTableName($table);
+ $suffix = ArchiveTableCreator::getDateFromTableName($table);
if (!isset($datesByMonth[$suffix])) {
continue;
}
diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php
index 612a9e1c3e..5bae81c756 100644
--- a/plugins/CoreAdminHome/Controller.php
+++ b/plugins/CoreAdminHome/Controller.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
@@ -33,8 +34,8 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller_Admin
$view = new Piwik_View('@CoreAdminHome/generalSettings');
if (Piwik::isUserIsSuperUser()) {
- $enableBrowserTriggerArchiving = Piwik_ArchiveProcessor_Rules::isBrowserTriggerEnabled();
- $todayArchiveTimeToLive = Piwik_ArchiveProcessor_Rules::getTodayArchiveTimeToLive();
+ $enableBrowserTriggerArchiving = Rules::isBrowserTriggerEnabled();
+ $todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();
$showWarningCron = false;
if (!$enableBrowserTriggerArchiving
&& $todayArchiveTimeToLive < 3600
@@ -83,8 +84,8 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller_Admin
$enableBrowserTriggerArchiving = Common::getRequestVar('enableBrowserTriggerArchiving');
$todayArchiveTimeToLive = Common::getRequestVar('todayArchiveTimeToLive');
- Piwik_ArchiveProcessor_Rules::setBrowserTriggerArchiving((bool)$enableBrowserTriggerArchiving);
- Piwik_ArchiveProcessor_Rules::setTodayArchiveTimeToLive($todayArchiveTimeToLive);
+ Rules::setBrowserTriggerArchiving((bool)$enableBrowserTriggerArchiving);
+ Rules::setTodayArchiveTimeToLive($todayArchiveTimeToLive);
// Update email settings
$mail = array();
diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php
index 110feb03b6..39a4f08199 100644
--- a/plugins/CoreAdminHome/CoreAdminHome.php
+++ b/plugins/CoreAdminHome/CoreAdminHome.php
@@ -8,13 +8,17 @@
* @category Piwik_Plugins
* @package Piwik_CoreAdminHome
*/
+use Piwik\DataAccess\ArchiveSelector;
+use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Piwik;
+use Piwik\Date;
+use Piwik\Plugin;
/**
*
* @package Piwik_CoreAdminHome
*/
-class Piwik_CoreAdminHome extends Piwik_Plugin
+class Piwik_CoreAdminHome extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -72,10 +76,10 @@ class Piwik_CoreAdminHome extends Piwik_Plugin
function addMenu()
{
- Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', NULL, "", Piwik::isUserHasSomeAdminAccess(), $order = 1);
- Piwik_AddAdminSubMenu('CoreAdminHome_MenuCommunity', NULL, "", Piwik::isUserHasSomeAdminAccess(), $order = 3);
- Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', NULL, "", Piwik::isUserHasSomeAdminAccess(), $order = 20);
- Piwik_AddAdminSubMenu('General_Settings', NULL, "", Piwik::isUserHasSomeAdminAccess(), $order = 5);
+ Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1);
+ Piwik_AddAdminSubMenu('CoreAdminHome_MenuCommunity', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 3);
+ Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 20);
+ Piwik_AddAdminSubMenu('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5);
Piwik_AddAdminSubMenu('General_Settings', 'CoreAdminHome_MenuGeneralSettings',
array('module' => 'CoreAdminHome', 'action' => 'generalSettings'),
Piwik::isUserHasSomeAdminAccess(),
@@ -89,17 +93,17 @@ class Piwik_CoreAdminHome extends Piwik_Plugin
function purgeOutdatedArchives()
{
- $archiveTables = Piwik_DataAccess_ArchiveTableCreator::getTablesArchivesInstalled();
+ $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
foreach ($archiveTables as $table) {
- $date = Piwik_DataAccess_ArchiveTableCreator::getDateFromTableName($table);
+ $date = ArchiveTableCreator::getDateFromTableName($table);
list($month, $year) = explode('_', $date);
- Piwik_DataAccess_ArchiveSelector::purgeOutdatedArchives(Piwik_Date::factory("$year-$month-15"));
+ ArchiveSelector::purgeOutdatedArchives(Date::factory("$year-$month-15"));
}
}
function optimizeArchiveTable()
{
- $archiveTables = Piwik_DataAccess_ArchiveTableCreator::getTablesArchivesInstalled();
+ $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
Piwik_OptimizeTables($archiveTables);
}
}
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php
index 08eabcbf82..c95b5d61ce 100644
--- a/plugins/CoreHome/Controller.php
+++ b/plugins/CoreHome/Controller.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -31,7 +32,7 @@ class Piwik_CoreHome_Controller extends Piwik_Controller
// User preference: default report to load is the All Websites dashboard
if ($defaultReport == 'MultiSites'
- && PluginsManager::getInstance()->isPluginActivated('MultiSites')
+ && \Piwik\PluginsManager::getInstance()->isPluginActivated('MultiSites')
) {
$module = 'MultiSites';
}
@@ -76,8 +77,8 @@ class Piwik_CoreHome_Controller extends Piwik_Controller
if ($websiteId) {
$website = new Site($websiteId);
$datetimeCreationDate = $this->site->getCreationDate()->getDatetime();
- $creationDateLocalTimezone = Piwik_Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
- $todayLocalTimezone = Piwik_Date::factory('now', $website->getTimezone())->toString('Y-m-d');
+ $creationDateLocalTimezone = Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
+ $todayLocalTimezone = Date::factory('now', $website->getTimezone())->toString('Y-m-d');
if ($creationDateLocalTimezone == $todayLocalTimezone) {
Piwik::redirectToModule('CoreHome', 'index',
array('date' => 'today',
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php
index 07820ffe01..56c4dbbfd2 100644
--- a/plugins/CoreHome/CoreHome.php
+++ b/plugins/CoreHome/CoreHome.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_CoreHome
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_CoreHome
*/
-class Piwik_CoreHome extends Piwik_Plugin
+class Piwik_CoreHome extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
index 4d16253e6b..3b3bea686c 100644
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
@@ -10,6 +10,7 @@
*/
use Piwik\Common;
use Piwik\Metrics;
+use Piwik\Date;
/**
* ROW EVOLUTION
@@ -45,7 +46,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution
/**
* The data
- * @var Piwik_DataTable_Array
+ * @var DataTable
*/
protected $dataTable;
@@ -68,7 +69,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution
* The constructor
* Initialize some local variables from the request
* @param int $idSite
- * @param Piwik_Date $date ($this->date from controller)
+ * @param Date $date ($this->date from controller)
* @param null|string $graphType
* @throws Exception
*/
diff --git a/plugins/CoreHome/templates/_dataTable.twig b/plugins/CoreHome/templates/_dataTable.twig
index d6b51d34f1..73eb6f1143 100644
--- a/plugins/CoreHome/templates/_dataTable.twig
+++ b/plugins/CoreHome/templates/_dataTable.twig
@@ -1,3 +1,4 @@
+{% set summaryRowId = -1 %}{# ID_SUMMARY_ROW #}
{% set isSubtable = javascriptVariablesToSet.idSubtable is defined and javascriptVariablesToSet.idSubtable != 0 %}
<div class="dataTable {{ properties.datatable_css_class }} {% if isSubtable %}subDataTable{% endif %}"
data-table-type="{{ properties.datatable_js_type|default('dataTable') }}"
@@ -26,7 +27,7 @@
<tbody>
{% for rowId, row in dataTable.getRows() %}
{%- set rowHasSubtable = row.getIdSubDataTable() and javascriptVariablesToSet.controllerActionCalledWhenRequestSubTable is not null -%}
- {%- set shouldHighlightRow = rowId == constant("Piwik_DataTable::ID_SUMMARY_ROW") and properties.highlight_summary_row -%}
+ {%- set shouldHighlightRow = rowId == summaryRowId and properties.highlight_summary_row -%}
{# display this row if it doesn't have a subtable or if we don't replace the row with the subtable #}
{% if not rowHasSubtable or not properties.show_expanded|default(false) or not properties.replace_row_with_subtable|default(false) %}
diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php
index 64f7be4bb3..ff0900073e 100644
--- a/plugins/CorePluginsAdmin/Controller.php
+++ b/plugins/CorePluginsAdmin/Controller.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Config;
/**
*
@@ -51,21 +52,21 @@ class Piwik_CorePluginsAdmin_Controller extends Piwik_Controller_Admin
$plugins = array();
$listPlugins = array_merge(
- PluginsManager::getInstance()->readPluginsDirectory(),
+ \Piwik\PluginsManager::getInstance()->readPluginsDirectory(),
Config::getInstance()->Plugins['Plugins']
);
$listPlugins = array_unique($listPlugins);
foreach ($listPlugins as $pluginName) {
- PluginsManager::getInstance()->loadPlugin($pluginName);
+ \Piwik\PluginsManager::getInstance()->loadPlugin($pluginName);
$plugins[$pluginName] = array(
- 'activated' => PluginsManager::getInstance()->isPluginActivated($pluginName),
- 'alwaysActivated' => PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName),
- 'uninstallable' => PluginsManager::getInstance()->isPluginUninstallable($pluginName),
+ 'activated' => \Piwik\PluginsManager::getInstance()->isPluginActivated($pluginName),
+ 'alwaysActivated' => \Piwik\PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName),
+ 'uninstallable' => \Piwik\PluginsManager::getInstance()->isPluginUninstallable($pluginName),
);
}
- PluginsManager::getInstance()->loadPluginTranslations();
+ \Piwik\PluginsManager::getInstance()->loadPluginTranslations();
- $loadedPlugins = PluginsManager::getInstance()->getLoadedPlugins();
+ $loadedPlugins = \Piwik\PluginsManager::getInstance()->getLoadedPlugins();
foreach ($loadedPlugins as $oPlugin) {
$pluginName = $oPlugin->getPluginName();
$plugins[$pluginName]['info'] = $oPlugin->getInformation();
@@ -107,7 +108,7 @@ class Piwik_CorePluginsAdmin_Controller extends Piwik_Controller_Admin
public function deactivate($redirectAfter = true)
{
$pluginName = $this->initPluginModification();
- PluginsManager::getInstance()->deactivatePlugin($pluginName);
+ \Piwik\PluginsManager::getInstance()->deactivatePlugin($pluginName);
$this->redirectAfterModification($redirectAfter);
}
@@ -129,14 +130,14 @@ class Piwik_CorePluginsAdmin_Controller extends Piwik_Controller_Admin
public function activate($redirectAfter = true)
{
$pluginName = $this->initPluginModification();
- PluginsManager::getInstance()->activatePlugin($pluginName);
+ \Piwik\PluginsManager::getInstance()->activatePlugin($pluginName);
$this->redirectAfterModification($redirectAfter);
}
public function uninstall($redirectAfter = true)
{
$pluginName = $this->initPluginModification();
- $uninstalled = PluginsManager::getInstance()->uninstallPlugin($pluginName);
+ $uninstalled = \Piwik\PluginsManager::getInstance()->uninstallPlugin($pluginName);
if(!$uninstalled) {
$path = Common::getPathToPiwikRoot() . '/plugins/' . $pluginName . '/';
$messagePermissions = Piwik::getErrorMessageMissingPermissions($path);
diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php
index c7e856b91e..fe4e9d8780 100644
--- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php
+++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php
@@ -9,12 +9,13 @@
* @package Piwik_CorePluginsAdmin
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_CorePluginsAdmin
*/
-class Piwik_CorePluginsAdmin extends Piwik_Plugin
+class Piwik_CorePluginsAdmin extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index 87f1beb634..11e0c9c7d1 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_CoreUpdater
*/
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
@@ -166,7 +167,7 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller
/*
* Make sure the execute bit is set for this shell script
*/
- if (!Piwik_ArchiveProcessor_Rules::isBrowserTriggerEnabled()) {
+ if (!Rules::isBrowserTriggerEnabled()) {
@chmod($this->pathRootExtractedPiwik . '/misc/cron/archive.sh', 0755);
}
@@ -345,7 +346,7 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller
$this->coreError = true;
break;
} else {
- PluginsManager::getInstance()->deactivatePlugin($name);
+ \Piwik\PluginsManager::getInstance()->deactivatePlugin($name);
$this->deactivatedPlugins[] = $name;
}
}
diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php
index 4c35b42029..99c7e4029d 100644
--- a/plugins/CoreUpdater/CoreUpdater.php
+++ b/plugins/CoreUpdater/CoreUpdater.php
@@ -10,12 +10,13 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
/**
*
* @package Piwik_CoreUpdater
*/
-class Piwik_CoreUpdater extends Piwik_Plugin
+class Piwik_CoreUpdater extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -32,7 +33,7 @@ class Piwik_CoreUpdater extends Piwik_Plugin
public static function getComponentUpdates(Piwik_Updater $updater)
{
$updater->addComponentToCheck('core', Piwik_Version::VERSION);
- $plugins = PluginsManager::getInstance()->getLoadedPlugins();
+ $plugins = \Piwik\PluginsManager::getInstance()->getLoadedPlugins();
foreach ($plugins as $pluginName => $plugin) {
$updater->addComponentToCheck($pluginName, $plugin->getVersion());
}
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php
index 800b916886..bfe38b7240 100644
--- a/plugins/CustomVariables/API.php
+++ b/plugins/CustomVariables/API.php
@@ -10,6 +10,8 @@
*/
use Piwik\Archive;
use Piwik\Metrics;
+use Piwik\Date;
+use Piwik\DataTable;
/**
* The Custom Variables API lets you access reports for your <a href='http://piwik.org/docs/custom-variables/' target='_blank'>Custom Variables</a> names and values.
@@ -34,12 +36,12 @@ class Piwik_CustomVariables_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param string $segment
* @param bool $expanded
* @param int $idSubtable
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
protected function getDataTable($idSite, $period, $date, $segment, $expanded, $idSubtable)
{
@@ -53,18 +55,18 @@ class Piwik_CustomVariables_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param string|bool $segment
* @param bool $expanded
* @param bool $_leavePiwikCoreVariables
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getCustomVariables($idSite, $period, $date, $segment = false, $expanded = false, $_leavePiwikCoreVariables = false)
{
$dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded, $idSubtable = null);
- if ($dataTable instanceof Piwik_DataTable
+ if ($dataTable instanceof DataTable
&& !$_leavePiwikCoreVariables
) {
$mapping = self::getReservedCustomVariableKeys();
@@ -90,12 +92,12 @@ class Piwik_CustomVariables_API
/**
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param int $idSubtable
* @param string|bool $segment
* @param bool $_leavePriceViewedColumn
*
- * @return Piwik_DataTable|Piwik_DataTable_Array
+ * @return DataTable|DataTable\Map
*/
public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable, $segment = false, $_leavePriceViewedColumn = false)
{
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php
index 08b15ec865..654cf22835 100644
--- a/plugins/CustomVariables/Archiver.php
+++ b/plugins/CustomVariables/Archiver.php
@@ -1,7 +1,9 @@
<?php
use Piwik\Common;
use Piwik\Config;
+use Piwik\DataAccess\LogAggregator;
use Piwik\Metrics;
+use Piwik\PluginsArchiver;
/**
* Piwik - Open source web analytics
@@ -13,7 +15,7 @@ use Piwik\Metrics;
* @package Piwik_CustomVariables
*/
-class Piwik_CustomVariables_Archiver extends Piwik_PluginsArchiver
+class Piwik_CustomVariables_Archiver extends PluginsArchiver
{
const LABEL_CUSTOM_VALUE_NOT_DEFINED = "Value not defined";
const CUSTOM_VARIABLE_RECORD_NAME = 'CustomVariables_valueByName';
@@ -78,7 +80,7 @@ class Piwik_CustomVariables_Archiver extends Piwik_PluginsArchiver
protected function getSelectAveragePrice()
{
- return Piwik_DataAccess_LogAggregator::getSqlRevenue("AVG(log_link_visit_action.custom_var_v2)")
+ return LogAggregator::getSqlRevenue("AVG(log_link_visit_action.custom_var_v2)")
. " as `" . Metrics::INDEX_ECOMMERCE_ITEM_PRICE_VIEWED . "`";
}
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index 9a402c192f..971a967b8e 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -8,11 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_CustomVariables
*/
+use Piwik\ArchiveProcessor;
+use Piwik\Plugin;
/**
* @package Piwik_CustomVariables
*/
-class Piwik_CustomVariables extends Piwik_Plugin
+class Piwik_CustomVariables extends Plugin
{
public function getInformation()
{
@@ -130,7 +132,7 @@ class Piwik_CustomVariables extends Piwik_Plugin
/**
* Hooks on daily archive to trigger various log processing
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_CustomVariables_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -138,7 +140,7 @@ class Piwik_CustomVariables extends Piwik_Plugin
}
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_CustomVariables_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php
index 0c4a4d1e53..46b3666c02 100644
--- a/plugins/DBStats/API.php
+++ b/plugins/DBStats/API.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
/**
* @see plugins/DBStats/MySQLMetadataProvider.php
@@ -100,7 +101,7 @@ class Piwik_DBStats_API
* This function will group tracker tables, numeric archive tables, blob archive tables
* and other tables together so only four rows are shown.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getDatabaseUsageSummary()
{
@@ -130,13 +131,13 @@ class Piwik_DBStats_API
$rowToAddTo['row_count'] += $status['Rows'];
}
- return Piwik_DataTable::makeFromIndexedArray($rows);
+ return DataTable::makeFromIndexedArray($rows);
}
/**
* Returns a datatable describing how much space is taken up by each log table.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getTrackerDataSummary()
{
@@ -148,7 +149,7 @@ class Piwik_DBStats_API
* Returns a datatable describing how much space is taken up by each numeric
* archive table.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getMetricDataSummary()
{
@@ -160,7 +161,7 @@ class Piwik_DBStats_API
* Returns a datatable describing how much space is taken up by each numeric
* archive table, grouped by year.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getMetricDataSummaryByYear()
{
@@ -178,7 +179,7 @@ class Piwik_DBStats_API
* Returns a datatable describing how much space is taken up by each blob
* archive table.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getReportDataSummary()
{
@@ -190,7 +191,7 @@ class Piwik_DBStats_API
* Returns a datatable describing how much space is taken up by each blob
* archive table, grouped by year.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getReportDataSummaryByYear()
{
@@ -210,7 +211,7 @@ class Piwik_DBStats_API
* An 'admin' table is a table that is not central to analytics functionality.
* So any table that isn't an archive table or a log table is an 'admin' table.
*
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getAdminDataSummary()
{
@@ -226,7 +227,7 @@ class Piwik_DBStats_API
*
* @param bool $forceCache false to use the cached result, true to run the queries again and
* cache the result.
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getIndividualReportsSummary($forceCache = false)
{
@@ -242,7 +243,7 @@ class Piwik_DBStats_API
*
* @param bool $forceCache false to use the cached result, true to run the queries again and
* cache the result.
- * @return Piwik_DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
+ * @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getIndividualMetricsSummary($forceCache = false)
{
@@ -254,11 +255,11 @@ class Piwik_DBStats_API
* Returns a datatable representation of a set of table statuses.
*
* @param array $statuses The table statuses to summarize.
- * @return Piwik_DataTable
+ * @return DataTable
*/
private function getTablesSummary($statuses)
{
- $dataTable = new Piwik_DataTable();
+ $dataTable = new DataTable();
foreach ($statuses as $status) {
$dataTable->addRowFromSimpleArray(array(
'label' => $status['Name'],
diff --git a/plugins/DBStats/Controller.php b/plugins/DBStats/Controller.php
index caf2241e14..7596dc4106 100644
--- a/plugins/DBStats/Controller.php
+++ b/plugins/DBStats/Controller.php
@@ -313,7 +313,7 @@ class Piwik_DBStats_Controller extends Piwik_Controller_Admin
}
}
- $getPrettySize = array('Piwik', 'getPrettySizeFromBytes');
+ $getPrettySize = '\Piwik\Piwik::getPrettySizeFromBytes';
$params = $fixedMemoryUnit === false ? array() : array($fixedMemoryUnit);
$view->queueFilter(
'ColumnCallbackReplace', array($sizeColumns, $getPrettySize, $params), $runPrettySizeFilterBeforeGeneric);
@@ -324,8 +324,7 @@ class Piwik_DBStats_Controller extends Piwik_Controller_Admin
$view->queueFilter('ColumnCallbackReplace', array($sizeColumns, $replaceSpaces));
}
- $getPrettyNumber = array('Piwik', 'getPrettyNumber');
- $view->queueFilter('ColumnCallbackReplace', array(array('row_count'), $getPrettyNumber));
+ $view->queueFilter('ColumnCallbackReplace', array(array('row_count'), '\Piwik\Piwik::getPrettyNumber'));
return $view;
}
diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php
index fd649d5b1e..770e00f0ed 100644
--- a/plugins/DBStats/DBStats.php
+++ b/plugins/DBStats/DBStats.php
@@ -9,12 +9,14 @@
* @package Piwik_DBStats
*/
use Piwik\Piwik;
+use Piwik\Date;
+use Piwik\Plugin;
/**
*
* @package Piwik_DBStats
*/
-class Piwik_DBStats extends Piwik_Plugin
+class Piwik_DBStats extends Plugin
{
const TIME_OF_LAST_TASK_RUN_OPTION = 'dbstats_time_of_last_cache_task_run';
@@ -63,7 +65,7 @@ class Piwik_DBStats extends Piwik_Plugin
$api->getIndividualReportsSummary(true);
$api->getIndividualMetricsSummary(true);
- $now = Piwik_Date::now()->getLocalized("%longYear%, %shortMonth% %day%");
+ $now = Date::now()->getLocalized("%longYear%, %shortMonth% %day%");
Piwik_SetOption(self::TIME_OF_LAST_TASK_RUN_OPTION, $now);
}
diff --git a/plugins/DBStats/MySQLMetadataProvider.php b/plugins/DBStats/MySQLMetadataProvider.php
index 9641d2d788..c7701e6023 100755
--- a/plugins/DBStats/MySQLMetadataProvider.php
+++ b/plugins/DBStats/MySQLMetadataProvider.php
@@ -10,6 +10,8 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Config;
+use Piwik\DataTable;
/**
* Utility class that provides general information about databases, including the size of
@@ -175,7 +177,7 @@ class Piwik_DBStats_MySQLMetadataProvider
*
* @param bool $forceCache false to use the cached result, true to run the queries again and
* cache the result.
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getRowCountsAndSizeByBlobName($forceCache = false)
{
@@ -194,7 +196,7 @@ class Piwik_DBStats_MySQLMetadataProvider
*
* @param bool $forceCache false to use the cached result, true to run the queries again and
* cache the result.
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getRowCountsAndSizeByMetricName($forceCache = false)
{
@@ -216,20 +218,20 @@ class Piwik_DBStats_MySQLMetadataProvider
$cols = array_merge(array('row_count'), $otherDataTableColumns);
- $dataTable = new Piwik_DataTable();
+ $dataTable = new DataTable();
foreach ($statuses as $status) {
$dataTableOptionName = $this->getCachedOptionName($status['Name'], 'byArchiveName');
// if option exists && !$forceCache, use the cached data, otherwise create the
$cachedData = Piwik_GetOption($dataTableOptionName);
if ($cachedData !== false && !$forceCache) {
- $table = new Piwik_DataTable();
+ $table = new DataTable();
$table->addRowsFromSerializedArray($cachedData);
} else {
// otherwise, create data table & cache it
$sql = "SELECT name as 'label', COUNT(*) as 'row_count'$extraCols FROM {$status['Name']} GROUP BY name";
- $table = new Piwik_DataTable();
+ $table = new DataTable();
$table->addRowsFromSimpleArray(Piwik_FetchAll($sql));
$reduceArchiveRowName = array($this, 'reduceArchiveRowName');
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index f91718d097..0f6cca6d00 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -7,6 +7,7 @@
* @category Piwik_Plugins
* @package Piwik_Dashboard
*/
+use Piwik\DataTable\Renderer\Json;
use Piwik\Piwik;
use Piwik\Common;
@@ -66,7 +67,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
{
$this->checkTokenInUrl();
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
echo Common::json_encode(Piwik_GetWidgetsList());
}
@@ -157,7 +158,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
$this->checkTokenInUrl();
if (Piwik::isUserIsAnonymous()) {
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
echo '[]';
return;
@@ -166,7 +167,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
$login = Piwik::getCurrentUserLogin();
$dashboards = $this->dashboard->getAllDashboards($login);
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
echo Common::json_encode($dashboards);
}
@@ -197,7 +198,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
Common::prefixTable('user_dashboard'));
Piwik_Query($query, array($user, $nextId, $name, $layout));
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
echo Common::json_encode($nextId);
}
@@ -235,7 +236,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller
Common::prefixTable('user_dashboard'));
Piwik_Query($query, array($user, $nextId, $name, $layout));
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
echo Common::json_encode($nextId);
return;
}
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php
index 7548104be9..25fb766226 100644
--- a/plugins/Dashboard/Dashboard.php
+++ b/plugins/Dashboard/Dashboard.php
@@ -10,12 +10,13 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
use Piwik\Site;
/**
* @package Piwik_Dashboard
*/
-class Piwik_Dashboard extends Piwik_Plugin
+class Piwik_Dashboard extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php
index 3117122c96..1800849fcf 100644
--- a/plugins/DevicesDetection/API.php
+++ b/plugins/DevicesDetection/API.php
@@ -12,6 +12,7 @@
use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* The DevicesDetection API lets you access reports on your visitors devices, brands, models, Operating system, Browsers.
@@ -58,7 +59,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getType($idSite, $period, $date, $segment = false)
{
@@ -75,7 +76,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getBrand($idSite, $period, $date, $segment = false)
{
@@ -91,7 +92,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getModel($idSite, $period, $date, $segment = false)
{
@@ -106,7 +107,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getOsFamilies($idSite, $period, $date, $segment = false)
{
@@ -122,7 +123,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getOsVersions($idSite, $period, $date, $segment = false)
{
@@ -139,7 +140,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getBrowserFamilies($idSite, $period, $date, $segment = false)
{
@@ -155,7 +156,7 @@ class Piwik_DevicesDetection_API
* @param string $period
* @param string $date
* @param bool|string $segment
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getBrowserVersions($idSite, $period, $date, $segment = false)
{
diff --git a/plugins/DevicesDetection/Archiver.php b/plugins/DevicesDetection/Archiver.php
index 6bf0288894..73a66fb67d 100644
--- a/plugins/DevicesDetection/Archiver.php
+++ b/plugins/DevicesDetection/Archiver.php
@@ -10,8 +10,9 @@
*/
use Piwik\Metrics;
+use Piwik\PluginsArchiver;
-class Piwik_DevicesDetection_Archiver extends Piwik_PluginsArchiver
+class Piwik_DevicesDetection_Archiver extends PluginsArchiver
{
const DEVICE_TYPE_RECORD_NAME = 'DevicesDetection_types';
const DEVICE_BRAND_RECORD_NAME = 'DevicesDetection_brands';
diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php
index 2a734b24e4..7129ee581b 100644
--- a/plugins/DevicesDetection/DevicesDetection.php
+++ b/plugins/DevicesDetection/DevicesDetection.php
@@ -9,13 +9,15 @@
* @category Piwik_Plugins
* @package Piwik_DevicesDetection
*/
+use Piwik\ArchiveProcessor;
use Piwik\Config;
use Piwik\Common;
+use Piwik\Plugin;
require_once PIWIK_INCLUDE_PATH . "/plugins/DevicesDetection/UserAgentParserEnhanced/UserAgentParserEnhanced.php";
require_once PIWIK_INCLUDE_PATH . '/plugins/DevicesDetection/functions.php';
-class Piwik_DevicesDetection extends Piwik_Plugin
+class Piwik_DevicesDetection extends Plugin
{
/**
* @see Piwik_Plugin::getInformation
@@ -229,7 +231,7 @@ class Piwik_DevicesDetection extends Piwik_Plugin
Common::printDebug($deviceInfo);
}
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_DevicesDetection_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -237,7 +239,7 @@ class Piwik_DevicesDetection extends Piwik_Plugin
}
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_DevicesDetection_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php
index 2b8409d394..2ea56e3d0f 100644
--- a/plugins/DoNotTrack/DoNotTrack.php
+++ b/plugins/DoNotTrack/DoNotTrack.php
@@ -8,6 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_DoNotTrack
*/
+use Piwik\Plugin;
+use Piwik\Common;
/**
* Ignore visits where user agent's request contains either:
@@ -16,7 +18,7 @@
*
* @package Piwik_DoNotTrack
*/
-class Piwik_DoNotTrack extends Piwik_Plugin
+class Piwik_DoNotTrack extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php
index 163d265c27..d4a0febccf 100644
--- a/plugins/ExampleAPI/API.php
+++ b/plugins/ExampleAPI/API.php
@@ -8,7 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_ExampleAPI
*/
+use Piwik\DataTable\Row;
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* The ExampleAPI is useful to developers building a custom Piwik plugin.
@@ -126,13 +128,13 @@ class Piwik_ExampleAPI_API
* This data table will be converted to all available formats
* when requested in the API request.
*
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getCompetitionDatatable()
{
- $dataTable = new Piwik_DataTable();
+ $dataTable = new DataTable();
- $row1 = new Piwik_DataTable_Row();
+ $row1 = new Row();
$row1->setColumns(array('name' => 'piwik', 'license' => 'GPL'));
// Rows Metadata is useful to store non stats data for example (logos, urls, etc.)
diff --git a/plugins/ExampleAPI/ExampleAPI.php b/plugins/ExampleAPI/ExampleAPI.php
index 7c96f96c19..da1c3f4c52 100644
--- a/plugins/ExampleAPI/ExampleAPI.php
+++ b/plugins/ExampleAPI/ExampleAPI.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_ExampleAPI
*/
+use Piwik\Plugin;
/**
* ExampleAPI plugin
*
* @package Piwik_ExampleAPI
*/
-class Piwik_ExampleAPI extends Piwik_Plugin
+class Piwik_ExampleAPI extends Plugin
{
}
diff --git a/plugins/ExamplePlugin/Controller.php b/plugins/ExamplePlugin/Controller.php
index 7ff7a79042..3e6c557130 100644
--- a/plugins/ExamplePlugin/Controller.php
+++ b/plugins/ExamplePlugin/Controller.php
@@ -73,7 +73,7 @@ class Piwik_ExamplePlugin_Controller extends Piwik_Controller
$out .= '<h2>General</h2>';
$out .= '<h3>Accessible from your plugin controller</h3>';
- $out .= '<code>$this->date</code> = current selected <b>Piwik_Date</b> object (<a href="https://github.com/piwik/piwik/blob/master/core/Date.php">class</a>)<br />';
+ $out .= '<code>$this->date</code> = current selected <b>Date</b> object (<a href="https://github.com/piwik/piwik/blob/master/core/Date.php">class</a>)<br />';
$out .= '<code>$period = Common::getRequestVar("period");</code> - Get the current selected period<br />';
$out .= '<code>$idSite = Common::getRequestVar("idSite");</code> - Get the selected idSite<br />';
$out .= '<code>$site = new Site($idSite);</code> - Build the Site object (<a href="https://github.com/piwik/piwik/tree/master/core/Site.php">class</a>)<br />';
diff --git a/plugins/ExamplePlugin/ExamplePlugin.php b/plugins/ExamplePlugin/ExamplePlugin.php
index a3143b34bb..7fc7a2cc09 100644
--- a/plugins/ExamplePlugin/ExamplePlugin.php
+++ b/plugins/ExamplePlugin/ExamplePlugin.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_ExamplePlugin
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_ExamplePlugin
*/
-class Piwik_ExamplePlugin extends Piwik_Plugin
+class Piwik_ExamplePlugin extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php
index eeb4d78157..72831e6d0b 100644
--- a/plugins/ExampleRssWidget/ExampleRssWidget.php
+++ b/plugins/ExampleRssWidget/ExampleRssWidget.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_ExampleRssWidget
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_ExampleRssWidget
*/
-class Piwik_ExampleRssWidget extends Piwik_Plugin
+class Piwik_ExampleRssWidget extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/ExampleUI/API.php b/plugins/ExampleUI/API.php
index 87bc64a88c..5857ef112b 100644
--- a/plugins/ExampleUI/API.php
+++ b/plugins/ExampleUI/API.php
@@ -8,7 +8,8 @@
* @category Piwik_Plugins
* @package Piwik_ExampleUI
*/
-use Piwik\Period_Range;
+use Piwik\Period\Range;
+use Piwik\DataTable;
/**
* ExampleUI API is also an example API useful if you are developing a Piwik plugin.
@@ -32,7 +33,7 @@ class Piwik_ExampleUI_API
public function getTemperaturesEvolution($date, $period)
{
- $period = new Period_Range($period, 'last30');
+ $period = new Range($period, 'last30');
$dateStart = $period->getDateStart()->toString('Y-m-d'); // eg. "2009-04-01"
$dateEnd = $period->getDateEnd()->toString('Y-m-d'); // eg. "2009-04-30"
@@ -51,7 +52,7 @@ class Piwik_ExampleUI_API
$value = array('server1' => $server1, 'server2' => $server2);
$temperatures[$subPeriod->getLocalizedShortString()] = $value;
}
- return Piwik_DataTable::makeFromIndexedArray($temperatures);
+ return DataTable::makeFromIndexedArray($temperatures);
}
// we generate an array of random server temperatures
@@ -68,7 +69,7 @@ class Piwik_ExampleUI_API
$temperatures[$xAxisLabel] = $temperatureValues[$i];
}
- return Piwik_DataTable::makeFromIndexedArray($temperatures);
+ return DataTable::makeFromIndexedArray($temperatures);
}
public function getPlanetRatios()
@@ -84,7 +85,7 @@ class Piwik_ExampleUI_API
'Neptune' => 3.883,
);
// convert this array to a DataTable object
- return Piwik_DataTable::makeFromIndexedArray($planetRatios);
+ return DataTable::makeFromIndexedArray($planetRatios);
}
public function getPlanetRatiosWithLogos()
diff --git a/plugins/ExampleUI/ExampleUI.php b/plugins/ExampleUI/ExampleUI.php
index 6808be9109..4e1210cf14 100644
--- a/plugins/ExampleUI/ExampleUI.php
+++ b/plugins/ExampleUI/ExampleUI.php
@@ -18,12 +18,13 @@
- without all columns icon
+ update http://piwik.org/participate/user-interface
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_ExampleUI
*/
-class Piwik_ExampleUI extends Piwik_Plugin
+class Piwik_ExampleUI extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/Feedback/Feedback.php b/plugins/Feedback/Feedback.php
index 5217def3d4..522c09fe96 100644
--- a/plugins/Feedback/Feedback.php
+++ b/plugins/Feedback/Feedback.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_Feedback
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_Feedback
*/
-class Piwik_Feedback extends Piwik_Plugin
+class Piwik_Feedback extends Plugin
{
/**
diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php
index 5d0d0eab5c..db754b3bb3 100644
--- a/plugins/Goals/API.php
+++ b/plugins/Goals/API.php
@@ -12,6 +12,7 @@ use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Site;
/**
@@ -249,11 +250,11 @@ class Piwik_Goals_API
$customVarNameToLookFor = $mapping[$recordName];
// Handle case where date=last30&period=day
- if ($customVariables instanceof Piwik_DataTable_Array) {
+ if ($customVariables instanceof DataTable\Map) {
$customVariableDatatables = $customVariables->getArray();
$dataTables = $dataTable->getArray();
foreach ($customVariableDatatables as $key => $customVariableTableForDate) {
- $dataTableForDate = isset($dataTables[$key]) ? $dataTables[$key] : new Piwik_DataTable();
+ $dataTableForDate = isset($dataTables[$key]) ? $dataTables[$key] : new DataTable();
// we do not enter the IF
// if case idSite=1,3 AND period=day&date=datefrom,dateto,
@@ -268,7 +269,7 @@ class Piwik_Goals_API
}
$this->renameNotDefinedRow($dataTableForDate, $notDefinedStringPretty);
}
- } elseif ($customVariables instanceof Piwik_DataTable) {
+ } elseif ($customVariables instanceof DataTable) {
$row = $customVariables->getRowFromLabel($customVarNameToLookFor);
if ($row) {
$idSubtable = $row->getIdSubDataTable();
@@ -285,7 +286,7 @@ class Piwik_Goals_API
protected function renameNotDefinedRow($dataTable, $notDefinedStringPretty)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $table) {
$this->renameNotDefinedRow($table, $notDefinedStringPretty);
}
@@ -369,7 +370,7 @@ class Piwik_Goals_API
* @param bool $segment
* @param bool|int $idGoal
* @param array $columns Array of metrics to fetch: nb_conversions, conversion_rate, revenue
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function get($idSite, $period, $date, $segment = false, $idGoal = false, $columns = array())
{
@@ -404,7 +405,7 @@ class Piwik_Goals_API
$dataTable->renameColumn($oldName, $columns[$id]);
}
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $row) {
$this->enrichTable($row);
}
@@ -482,7 +483,7 @@ class Piwik_Goals_API
* @param string $segment The segment.
* @param int|bool $idGoal The id of the goal to get data for. If this is set to false,
* data for every goal that belongs to $idSite is returned.
- * @return false|Piwik_DataTable
+ * @return false|DataTable
*/
protected function getGoalSpecificDataTable($recordName, $idSite, $period, $date, $segment, $idGoal)
{
@@ -510,7 +511,7 @@ class Piwik_Goals_API
* @param string|bool $segment The segment.
* @param int|bool $idGoal The id of the goal to get data for. If this is set to false,
* data for every goal that belongs to $idSite is returned.
- * @return false|Piwik_DataTable
+ * @return false|DataTable
*/
public function getDaysToConversion($idSite, $period, $date, $segment = false, $idGoal = false)
{
@@ -534,7 +535,7 @@ class Piwik_Goals_API
* @param string|bool $segment The segment.
* @param int|bool $idGoal The id of the goal to get data for. If this is set to false,
* data for every goal that belongs to $idSite is returned.
- * @return bool|Piwik_DataTable
+ * @return bool|DataTable
*/
public function getVisitsUntilConversion($idSite, $period, $date, $segment = false, $idGoal = false)
{
diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php
index a22cc9ef98..96792174c1 100644
--- a/plugins/Goals/Archiver.php
+++ b/plugins/Goals/Archiver.php
@@ -9,9 +9,12 @@
* @package Piwik_Goals
*/
+use Piwik\DataAccess\LogAggregator;
use Piwik\Metrics;
+use Piwik\DataTable;
+use Piwik\PluginsArchiver;
-class Piwik_Goals_Archiver extends Piwik_PluginsArchiver
+class Piwik_Goals_Archiver extends PluginsArchiver
{
const VISITS_UNTIL_RECORD_NAME = 'visits_until_conv';
const DAYS_UNTIL_CONV_RECORD_NAME = 'days_until_conv';
@@ -96,7 +99,7 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver
);
$selects = array();
foreach ($aggregatesMetadata as $aggregateMetadata) {
- $selects = array_merge($selects, Piwik_DataAccess_LogAggregator::getSelectsFromRangedColumn($aggregateMetadata));
+ $selects = array_merge($selects, LogAggregator::getSelectsFromRangedColumn($aggregateMetadata));
}
$query = $this->getLogAggregator()->queryConversionsByDimension(array(), false, $selects);
@@ -121,16 +124,16 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver
$goals->sumMetrics($idGoal, $values);
if (empty($visitsToConversions[$idGoal])) {
- $visitsToConversions[$idGoal] = new Piwik_DataTable();
+ $visitsToConversions[$idGoal] = new DataTable();
}
- $array = Piwik_DataAccess_LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_CONVERSIONS, $prefixes[self::VISITS_UNTIL_RECORD_NAME]);
- $visitsToConversions[$idGoal]->addDataTable(Piwik_DataTable::makeFromIndexedArray($array));
+ $array = LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_CONVERSIONS, $prefixes[self::VISITS_UNTIL_RECORD_NAME]);
+ $visitsToConversions[$idGoal]->addDataTable(DataTable::makeFromIndexedArray($array));
if (empty($daysToConversions[$idGoal])) {
- $daysToConversions[$idGoal] = new Piwik_DataTable();
+ $daysToConversions[$idGoal] = new DataTable();
}
- $array = Piwik_DataAccess_LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_CONVERSIONS, $prefixes[self::DAYS_UNTIL_CONV_RECORD_NAME]);
- $daysToConversions[$idGoal]->addDataTable(Piwik_DataTable::makeFromIndexedArray($array));
+ $array = LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_CONVERSIONS, $prefixes[self::DAYS_UNTIL_CONV_RECORD_NAME]);
+ $daysToConversions[$idGoal]->addDataTable(DataTable::makeFromIndexedArray($array));
// We don't want to sum Abandoned cart metrics in the overall revenue/conversions/converted visits
// since it is a "negative conversion"
@@ -209,7 +212,7 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver
protected function getOverviewFromGoalTables($tableByGoal)
{
- $overview = new Piwik_DataTable();
+ $overview = new DataTable();
foreach ($tableByGoal as $idGoal => $table) {
if ($this->isStandardGoal($idGoal)) {
$overview->addDataTable($table);
diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php
index d659959ab3..64ab750b6b 100644
--- a/plugins/Goals/Controller.php
+++ b/plugins/Goals/Controller.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_Goals
*/
+use Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
/**
*
@@ -35,7 +37,7 @@ class Piwik_Goals_Controller extends Piwik_Controller
private function formatConversionRate($conversionRate)
{
- if ($conversionRate instanceof Piwik_DataTable) {
+ if ($conversionRate instanceof DataTable) {
if ($conversionRate->getRowsCount() == 0) {
$conversionRate = 0;
} else {
@@ -75,7 +77,7 @@ class Piwik_Goals_Controller extends Piwik_Controller
public function ecommerceReport()
{
- if (!PluginsManager::getInstance()->isPluginActivated('CustomVariables')) {
+ if (!\Piwik\PluginsManager::getInstance()->isPluginActivated('CustomVariables')) {
throw new Exception("Ecommerce Tracking requires that the plugin Custom Variables is enabled. Please enable the plugin CustomVariables (or ask your admin).");
}
@@ -294,14 +296,14 @@ class Piwik_Goals_Controller extends Piwik_Controller
$topDimensionsToLoad = array();
- if (PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
+ if (\Piwik\PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
$topDimensionsToLoad += array(
'country' => 'UserCountry.getCountry',
);
}
$keywordNotDefinedString = '';
- if (PluginsManager::getInstance()->isPluginActivated('Referers')) {
+ if (\Piwik\PluginsManager::getInstance()->isPluginActivated('Referers')) {
$keywordNotDefinedString = Piwik_Referers_API::getKeywordNotDefinedString();
$topDimensionsToLoad += array(
'keyword' => 'Referers.getKeywords',
@@ -313,7 +315,7 @@ class Piwik_Goals_Controller extends Piwik_Controller
$request = new Piwik_API_Request("method=$apiMethod
&format=original
&filter_update_columns_when_show_all_goals=1
- &idGoal=" . Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE . "
+ &idGoal=" . AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE . "
&filter_sort_order=desc
&filter_sort_column=$columnNbConversions" .
// select a couple more in case some are not valid (ie. conversions==0 or they are "Keyword not defined")
diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index dc3445cb88..cd9857e3fd 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -8,15 +8,17 @@
* @category Piwik_Plugins
* @package Piwik_Goals
*/
+use Piwik\ArchiveProcessor;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
use Piwik\Site;
/**
*
* @package Piwik_Goals
*/
-class Piwik_Goals extends Piwik_Plugin
+class Piwik_Goals extends Plugin
{
protected $ecommerceReports = array(
array('Goals_ProductSKU', 'Goals', 'getItemsSku'),
@@ -479,7 +481,7 @@ class Piwik_Goals extends Piwik_Plugin
* Will process Goal stats overall and for each Goal.
* Also processes the New VS Returning visitors conversion stats.
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_Goals_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -491,7 +493,7 @@ class Piwik_Goals extends Piwik_Plugin
* Hooks on Period archiving.
* Sums up Goal conversions stats, and processes overall conversion rate
*/
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_Goals_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -575,7 +577,7 @@ class Piwik_Goals extends Piwik_Plugin
$moneyColumns = array('revenue', 'avg_price');
$prettifyMoneyColumns = array(
- 'ColumnCallbackReplace', array($moneyColumns, array("Piwik", "getPrettyMoney"), array($idSite)));
+ 'ColumnCallbackReplace', array($moneyColumns, '\Piwik\Piwik::getPrettyMoney', array($idSite)));
$result = array(
'show_ecommerce' => true,
diff --git a/plugins/ImageGraph/API.php b/plugins/ImageGraph/API.php
index dd6967b56b..b2811772f0 100644
--- a/plugins/ImageGraph/API.php
+++ b/plugins/ImageGraph/API.php
@@ -11,6 +11,7 @@
use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Translate;
/**
* The ImageGraph.get API call lets you generate beautiful static PNG Graphs for any existing Piwik report.
@@ -145,7 +146,7 @@ class Piwik_ImageGraph_API
$useUnicodeFont = array(
'am', 'ar', 'el', 'fa', 'fi', 'he', 'ja', 'ka', 'ko', 'te', 'th', 'zh-cn', 'zh-tw',
);
- $languageLoaded = Piwik_Translate::getInstance()->getLanguageLoaded();
+ $languageLoaded = Translate::getInstance()->getLanguageLoaded();
$font = self::getFontPath(self::DEFAULT_FONT);
if (in_array($languageLoaded, $useUnicodeFont)) {
$unicodeFontPath = self::getFontPath(self::UNICODE_FONT);
@@ -378,10 +379,10 @@ class Piwik_ImageGraph_API
$reportMetadata = $processedReport['reportMetadata']->getRows();
$i = 0;
- // $reportData instanceof Piwik_DataTable
- foreach ($reportData->getRows() as $row) // Piwik_DataTable_Row[]
+ // $reportData instanceof DataTable
+ foreach ($reportData->getRows() as $row) // Row[]
{
- // $row instanceof Piwik_DataTable_Row
+ // $row instanceof Row
$rowData = $row->getColumns(); // Associative Array
$abscissaSeries[] = Common::unsanitizeInputValue($rowData['label']);
@@ -408,13 +409,13 @@ class Piwik_ImageGraph_API
}
} else // if the report has no dimension we have multiple reports each with only one row within the reportData
{
- // $periodsData instanceof Piwik_DataTable_Simple[]
+ // $periodsData instanceof Simple[]
$periodsData = array_values($reportData->getArray());
$periodsCount = count($periodsData);
for ($i = 0; $i < $periodsCount; $i++) {
- // $periodsData[$i] instanceof Piwik_DataTable_Simple
- // $rows instanceof Piwik_DataTable_Row[]
+ // $periodsData[$i] instanceof Simple
+ // $rows instanceof Row[]
if (empty($periodsData[$i])) {
continue;
}
diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php
index 73743ccbba..3a2f56bb58 100644
--- a/plugins/ImageGraph/ImageGraph.php
+++ b/plugins/ImageGraph/ImageGraph.php
@@ -1,7 +1,9 @@
<?php
use Piwik\Common;
use Piwik\Period;
+use Piwik\Plugin;
use Piwik\Site;
+use Piwik\Config;
/**
* Piwik - Open source web analytics
@@ -13,7 +15,7 @@ use Piwik\Site;
* @package Piwik_ImageGraph
*/
-class Piwik_ImageGraph extends Piwik_Plugin
+class Piwik_ImageGraph extends Plugin
{
static private $CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS = array(
'Referers_getRefererType',
diff --git a/plugins/ImageGraph/StaticGraph.php b/plugins/ImageGraph/StaticGraph.php
index 4fe0523e2a..85778163e0 100644
--- a/plugins/ImageGraph/StaticGraph.php
+++ b/plugins/ImageGraph/StaticGraph.php
@@ -9,6 +9,8 @@
* @package Piwik_ImageGraph
*/
+use Piwik\Loader;
+
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pDraw.class.php";
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pImage.class.php";
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pData.class.php";
@@ -77,7 +79,7 @@ abstract class Piwik_ImageGraph_StaticGraph
if (isset(self::$availableStaticGraphTypes[$graphType])) {
$className = self::$availableStaticGraphTypes[$graphType];
- Piwik_Loader::loadClass($className);
+ Loader::loadClass($className);
return new $className;
} else {
throw new Exception(
@@ -108,7 +110,7 @@ abstract class Piwik_ImageGraph_StaticGraph
}
/**
- * @return rendered static graph
+ * @return Image rendered static graph
*/
public function getRenderedImage()
{
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 05d3913043..5fcfcbe39a 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -8,7 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_Installation
*/
+use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Piwik;
+use Piwik\Config;
use Piwik\Common;
use Piwik\Access;
@@ -261,7 +263,7 @@ class Piwik_Installation_Controller extends Piwik_Controller_Admin
$view->someTablesInstalled = true;
// remove monthly archive tables
- $archiveTables = Piwik_DataAccess_ArchiveTableCreator::getTablesArchivesInstalled();
+ $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
$baseTablesInstalled = count($tablesInstalled) - count($archiveTables);
$minimumCountPiwikTables = 17;
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php
index 1d81de1393..8017e4e535 100644
--- a/plugins/Installation/Installation.php
+++ b/plugins/Installation/Installation.php
@@ -10,12 +10,14 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
+use Piwik\Translate;
/**
*
* @package Piwik_Installation
*/
-class Piwik_Installation extends Piwik_Plugin
+class Piwik_Installation extends Plugin
{
protected $installationControllerName = 'Piwik_Installation_Controller';
@@ -51,7 +53,7 @@ class Piwik_Installation extends Piwik_Plugin
$message = '';
}
- Piwik_Translate::getInstance()->loadCoreTranslation();
+ Translate::getInstance()->loadCoreTranslation();
Piwik_PostEvent('Installation.startInstallation', array($this));
diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php
index da096266b5..1d0bc24ed9 100644
--- a/plugins/LanguagesManager/LanguagesManager.php
+++ b/plugins/LanguagesManager/LanguagesManager.php
@@ -12,12 +12,14 @@
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Plugin;
+use Piwik\Translate;
/**
*
* @package Piwik_LanguagesManager
*/
-class Piwik_LanguagesManager extends Piwik_Plugin
+class Piwik_LanguagesManager extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -82,7 +84,7 @@ class Piwik_LanguagesManager extends Piwik_Plugin
$language = self::getLanguageCodeForCurrentUser();
}
if (!Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($language)) {
- $language = Piwik_Translate::getInstance()->getLanguageDefault();
+ $language = Translate::getInstance()->getLanguageDefault();
}
}
@@ -131,7 +133,7 @@ class Piwik_LanguagesManager extends Piwik_Plugin
$languageCode = Common::extractLanguageCodeFromBrowserLanguage(Common::getBrowserLanguage(), Piwik_LanguagesManager_API::getInstance()->getAvailableLanguages());
}
if (!Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($languageCode)) {
- $languageCode = Piwik_Translate::getInstance()->getLanguageDefault();
+ $languageCode = Translate::getInstance()->getLanguageDefault();
}
return $languageCode;
}
diff --git a/plugins/Live/API.php b/plugins/Live/API.php
index a9fd58a6f6..8a739a0b17 100644
--- a/plugins/Live/API.php
+++ b/plugins/Live/API.php
@@ -9,10 +9,15 @@
* @package Piwik_Live
*/
use Piwik\Config;
+use Piwik\DataAccess\LogAggregator;
+use Piwik\DataTable\Filter\ColumnDelete;
+use Piwik\DataTable\Row;
use Piwik\Period;
-use Piwik\Period_Range;
+use Piwik\Period\Range;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
+use Piwik\DataTable;
use Piwik\Segment;
use Piwik\Site;
@@ -82,7 +87,7 @@ class Piwik_Live_API
$bind = array(
$idSite,
- Piwik_Date::factory(time() - $lastMinutes * 60)->toString('Y-m-d H:i:s')
+ Date::factory(time() - $lastMinutes * 60)->toString('Y-m-d H:i:s')
);
$segment = new Segment($segment, $idSite);
@@ -110,7 +115,7 @@ class Piwik_Live_API
* @param int $filter_limit
* @param bool $flat Whether to flatten the visitor details array
*
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getLastVisitsForVisitor($visitorId, $idSite, $filter_limit = 10, $flat = false)
{
@@ -133,7 +138,7 @@ class Piwik_Live_API
* @param bool|int $minTimestamp (optional) Minimum timestamp to restrict the query to (useful when paginating or refreshing visits)
* @param bool $flat
* @param bool $doNotFetchActions
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getLastVisitsDetails($idSite, $period, $date, $segment = false, $filter_limit = false, $filter_offset = false, $minTimestamp = false, $flat = false, $doNotFetchActions = false)
{
@@ -162,13 +167,13 @@ class Piwik_Live_API
* @param bool $flat whether to flatten the array (eg. 'customVariables' names/values will appear in the root array rather than in 'customVariables' key
* @param bool $doNotFetchActions If set to true, we only fetch visit info and not actions (much faster)
*
- * @return Piwik_DataTable
+ * @return DataTable
*/
private function getCleanedVisitorsFromDetails($visitorDetails, $idSite, $flat = false, $doNotFetchActions = false)
{
$actionsLimit = (int)Config::getInstance()->General['visitor_log_maximum_actions_per_visit'];
- $table = new Piwik_DataTable();
+ $table = new DataTable();
$site = new Site($idSite);
$timezone = $site->getTimezone();
@@ -181,11 +186,11 @@ class Piwik_Live_API
$visitorDetailsArray['siteCurrency'] = $site->getCurrency();
$visitorDetailsArray['siteCurrencySymbol'] = @$currencies[$site->getCurrency()];
$visitorDetailsArray['serverTimestamp'] = $visitorDetailsArray['lastActionTimestamp'];
- $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone);
+ $dateTimeVisit = Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone);
$visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
$visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized(Piwik_Translate('CoreHome_ShortDateFormat'));
- $dateTimeVisitFirstAction = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone);
+ $dateTimeVisitFirstAction = Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone);
$visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized(Piwik_Translate('CoreHome_ShortDateFormat'));
$visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%time%');
@@ -197,7 +202,7 @@ class Piwik_Live_API
if($flat) {
$visitorDetailsArray = $this->flattenVisitorDetailsArray($visitorDetailsArray);
}
- $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
+ $table->addRowFromArray(array(Row::COLUMNS => $visitorDetailsArray));
}
return $table;
}
@@ -240,7 +245,7 @@ class Piwik_Live_API
if (!empty($action['customVariables'])) {
foreach ($action['customVariables'] as $thisCustomVar) {
foreach ($thisCustomVar as $cvKey => $cvValue) {
- $flattenedKeyName = $cvKey . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
+ $flattenedKeyName = $cvKey . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
$visitorDetailsArray[$flattenedKeyName] = $cvValue;
$count++;
}
@@ -252,7 +257,7 @@ class Piwik_Live_API
$count = 1;
foreach($visitorDetailsArray['actionDetails'] as $action) {
if(!empty($action['goalId'])) {
- $flattenedKeyName = 'visitConvertedGoalId' . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
+ $flattenedKeyName = 'visitConvertedGoalId' . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
$visitorDetailsArray[$flattenedKeyName] = $action['goalId'];
$count++;
}
@@ -262,17 +267,17 @@ class Piwik_Live_API
$count = 1;
foreach($visitorDetailsArray['actionDetails'] as $action) {
if(!empty($action['url'])) {
- $flattenedKeyName = 'pageUrl' . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
+ $flattenedKeyName = 'pageUrl' . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
$visitorDetailsArray[$flattenedKeyName] = $action['url'];
}
if(!empty($action['pageTitle'])) {
- $flattenedKeyName = 'pageTitle' . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
+ $flattenedKeyName = 'pageTitle' . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
$visitorDetailsArray[$flattenedKeyName] = $action['pageTitle'];
}
if(!empty($action['siteSearchKeyword'])) {
- $flattenedKeyName = 'siteSearchKeyword' . Piwik_DataTable_Filter_ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
+ $flattenedKeyName = 'siteSearchKeyword' . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP . $count;
$visitorDetailsArray[$flattenedKeyName] = $action['siteSearchKeyword'];
}
$count++;
@@ -354,15 +359,15 @@ class Piwik_Live_API
$dateString = $date;
if ($period == 'range') {
- $processedPeriod = new Period_Range('range', $date);
- if ($parsedDate = Period_Range::parseDateRange($date)) {
+ $processedPeriod = new Range('range', $date);
+ if ($parsedDate = Range::parseDateRange($date)) {
$dateString = $parsedDate[2];
}
} else {
- $processedDate = Piwik_Date::factory($date);
+ $processedDate = Date::factory($date);
if ($date == 'today'
|| $date == 'now'
- || $processedDate->toString() == Piwik_Date::factory('now', $currentTimezone)->toString()
+ || $processedDate->toString() == Date::factory('now', $currentTimezone)->toString()
) {
$processedDate = $processedDate->subDay(1);
}
@@ -375,7 +380,7 @@ class Piwik_Live_API
if (!in_array($date, array('now', 'today', 'yesterdaySameTime'))
&& strpos($date, 'last') === false
&& strpos($date, 'previous') === false
- && Piwik_Date::factory($dateString)->toString('Y-m-d') != Piwik_Date::factory('now', $currentTimezone)->toString()
+ && Date::factory($dateString)->toString('Y-m-d') != Date::factory('now', $currentTimezone)->toString()
) {
$dateEnd = $processedPeriod->getDateEnd()->setTimezone($currentTimezone);
$where[] = " log_visit.visit_last_action_time <= ?";
@@ -551,11 +556,11 @@ class Piwik_Live_API
$sql = "SELECT
case idgoal when " . Piwik_Tracker_GoalManager::IDGOAL_CART . " then '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART . "' else '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER . "' end as type,
idorder as orderId,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('revenue') . " as revenue,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('revenue_subtotal') . " as revenueSubTotal,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('revenue_tax') . " as revenueTax,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('revenue_shipping') . " as revenueShipping,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('revenue_discount') . " as revenueDiscount,
+ " . LogAggregator::getSqlRevenue('revenue') . " as revenue,
+ " . LogAggregator::getSqlRevenue('revenue_subtotal') . " as revenueSubTotal,
+ " . LogAggregator::getSqlRevenue('revenue_tax') . " as revenueTax,
+ " . LogAggregator::getSqlRevenue('revenue_shipping') . " as revenueShipping,
+ " . LogAggregator::getSqlRevenue('revenue_discount') . " as revenueDiscount,
items as items,
log_conversion.server_time as serverTimePretty
@@ -592,7 +597,7 @@ class Piwik_Live_API
log_action_sku.name as itemSKU,
log_action_name.name as itemName,
log_action_category.name as itemCategory,
- " . Piwik_DataAccess_LogAggregator::getSqlRevenue('price') . " as price,
+ " . LogAggregator::getSqlRevenue('price') . " as price,
quantity as quantity
FROM " . Common::prefixTable('log_conversion_item') . "
INNER JOIN " . Common::prefixTable('log_action') . " AS log_action_sku
@@ -652,7 +657,7 @@ class Piwik_Live_API
break;
}
// Convert datetimes to the site timezone
- $dateTimeVisit = Piwik_Date::factory($details['serverTimePretty'], $timezone);
+ $dateTimeVisit = Date::factory($details['serverTimePretty'], $timezone);
$details['serverTimePretty'] = $dateTimeVisit->getLocalized(Piwik_Translate('CoreHome_ShortDateFormat') . ' %time%');
}
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php
index bad3a1bcbf..69c94fdf87 100644
--- a/plugins/Live/Controller.php
+++ b/plugins/Live/Controller.php
@@ -8,8 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_Live
*/
-use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Piwik;
+use Piwik\Config;
/**
* @package Piwik_Live
@@ -67,7 +68,7 @@ class Piwik_Live_Controller extends Piwik_Controller
return $this->render($view, $fetch);
}
- private function render($view, $fetch)
+ private function render(Piwik_View $view, $fetch)
{
$rendered = $view->render();
if ($fetch) {
@@ -102,7 +103,7 @@ class Piwik_Live_Controller extends Piwik_Controller
// disable the tag cloud, pie charts, bar chart icons
$view->disableShowAllViewsIcons();
- // disable the button "show more datas"
+ // disable the button "show more data"
$view->disableShowAllColumns();
// disable the RSS feed
$view->disableShowExportAsRssFeed();
diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php
index d4bd504204..ba6bf5b219 100644
--- a/plugins/Live/Live.php
+++ b/plugins/Live/Live.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_Live
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_Live
*/
-class Piwik_Live extends Piwik_Plugin
+class Piwik_Live extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php
index 1c8ec26952..df7edf761d 100644
--- a/plugins/Live/Visitor.php
+++ b/plugins/Live/Visitor.php
@@ -343,7 +343,7 @@ class Piwik_Live_Visitor
function getKeyword()
{
$keyword = $this->details['referer_keyword'];
- if (PluginsManager::getInstance()->isPluginActivated('Referers')
+ if (\Piwik\PluginsManager::getInstance()->isPluginActivated('Referers')
&& $this->getRefererType() == 'search'
) {
$keyword = Piwik_Referers_API::getCleanKeyword($keyword);
@@ -354,7 +354,7 @@ class Piwik_Live_Visitor
function getRefererUrl()
{
if ($this->getRefererType() == 'search') {
- if (PluginsManager::getInstance()->isPluginActivated('Referers')
+ if (\Piwik\PluginsManager::getInstance()->isPluginActivated('Referers')
&& $this->details['referer_keyword'] == Piwik_Referers_API::LABEL_KEYWORD_NOT_DEFINED
) {
return 'http://piwik.org/faq/general/#faq_144';
@@ -512,7 +512,7 @@ class Piwik_Live_Visitor
function getDeviceType()
{
- if(PluginsManager::getInstance()->isPluginActivated('DevicesDetection')) {
+ if(\Piwik\PluginsManager::getInstance()->isPluginActivated('DevicesDetection')) {
return Piwik_getDeviceTypeLabel($this->details['config_device_type']);
}
return false;
diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php
index 013658b419..28aa0e285c 100644
--- a/plugins/Login/Controller.php
+++ b/plugins/Login/Controller.php
@@ -10,6 +10,7 @@
*/
use Piwik\Config;
use Piwik\Piwik;
+use Piwik\Common;
require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
@@ -315,7 +316,7 @@ class Piwik_Login_Controller extends Piwik_Controller
if (is_null($errorMessage)) // if success, show login w/ success message
{
- $this->redirectToIndex('Login', 'resetPasswordSuccess');
+ return $this->redirectToIndex('Login', 'resetPasswordSuccess');
} else {
// show login page w/ error. this will keep the token in the URL
return $this->login($errorMessage);
@@ -392,7 +393,7 @@ class Piwik_Login_Controller extends Piwik_Controller
/**
* Generate a password reset token. Expires in (roughly) 24 hours.
*
- * @param array user information
+ * @param array $user user information
* @param int $timestamp Unix timestamp
* @return string generated token
*/
diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php
index a46bf6e387..7208328074 100644
--- a/plugins/Login/Login.php
+++ b/plugins/Login/Login.php
@@ -10,12 +10,13 @@
*/
use Piwik\Config;
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_Login
*/
-class Piwik_Login extends Piwik_Plugin
+class Piwik_Login extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/Login/templates/resetPassword.twig b/plugins/Login/templates/resetPassword.twig
index eaa5be0a8d..bd9cf4accc 100755
--- a/plugins/Login/templates/resetPassword.twig
+++ b/plugins/Login/templates/resetPassword.twig
@@ -1,8 +1,8 @@
-{% if infoMessage is defined %}
+{% if infoMessage is defined and infoMessage is not empty %}
<p class="message">{{ infoMessage }}</p>
{% endif %}
{% if formErrors is defined %}
- <p id="login_error">
+ <p class="message_error">
{% for data in formErrors %}
<strong>{{ 'General_Error'|translate }}</strong>
: {{ data }}
diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php
index 941d753fa7..840ae48abc 100644
--- a/plugins/MobileMessaging/MobileMessaging.php
+++ b/plugins/MobileMessaging/MobileMessaging.php
@@ -9,12 +9,13 @@
* @package Piwik_MobileMessaging
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_MobileMessaging
*/
-class Piwik_MobileMessaging extends Piwik_Plugin
+class Piwik_MobileMessaging extends Plugin
{
const DELEGATED_MANAGEMENT_OPTION = 'MobileMessaging_DelegatedManagement';
const PROVIDER_OPTION = 'Provider';
@@ -158,7 +159,7 @@ class Piwik_MobileMessaging extends Piwik_Plugin
public function getRendererInstance(&$reportRenderer, $info)
{
if (self::manageEvent($info)) {
- if (PluginsManager::getInstance()->isPluginActivated('MultiSites')) {
+ if (\Piwik\PluginsManager::getInstance()->isPluginActivated('MultiSites')) {
$reportRenderer = new Piwik_MobileMessaging_ReportRenderer_Sms();
} else {
$reportRenderer = new Piwik_MobileMessaging_ReportRenderer_Exception(
diff --git a/plugins/MobileMessaging/SMSProvider.php b/plugins/MobileMessaging/SMSProvider.php
index 6abc527dcb..402c135b48 100644
--- a/plugins/MobileMessaging/SMSProvider.php
+++ b/plugins/MobileMessaging/SMSProvider.php
@@ -8,6 +8,7 @@
* @category Piwik_Plugins
* @package Piwik_MobileMessaging
*/
+use Piwik\Loader;
/**
* The Piwik_MobileMessaging_SMSProvider abstract class is used as a base class for SMS provider implementations.
@@ -49,7 +50,7 @@ abstract class Piwik_MobileMessaging_SMSProvider
$className = 'Piwik_MobileMessaging_SMSProvider_' . $providerName;
try {
- Piwik_Loader::loadClass($className);
+ Loader::loadClass($className);
return new $className;
} catch (Exception $e) {
throw new Exception(
diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php
index 0c75406004..2906edc981 100755
--- a/plugins/MultiSites/API.php
+++ b/plugins/MultiSites/API.php
@@ -9,9 +9,11 @@
* @package Piwik_MultiSites
*/
use Piwik\Archive;
-use Piwik\Period_Range;
+use Piwik\DataTable\Filter\CalculateEvolutionFilter;
+use Piwik\Period\Range;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Site;
/**
@@ -95,7 +97,7 @@ class Piwik_MultiSites_API
* Only used when a scheduled task is running
* @param bool|string $enhanced When true, return additional goal & ecommerce metrics
* @param bool|string $pattern If specified, only the website which names (or site ID) match the pattern will be returned using SitesManager.getPatternMatchSites
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getAll($period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false, $pattern = false)
{
@@ -104,7 +106,7 @@ class Piwik_MultiSites_API
$idSites = $this->getSitesIdFromPattern($pattern);
if(empty($idSites)) {
- return new Piwik_DataTable();
+ return new DataTable();
}
return $this->buildDataTable(
$idSites,
@@ -154,7 +156,7 @@ class Piwik_MultiSites_API
* @param bool|string $_restrictSitesToLogin Hack used to enforce we restrict the returned data to the specified username
* Only used when a scheduled task is running
* @param bool|string $enhanced When true, return additional goal & ecommerce metrics
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getOne($idSite, $period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false)
{
@@ -214,16 +216,16 @@ class Piwik_MultiSites_API
}
// get the data
- // $dataTable instanceOf Piwik_DataTable_Array
+ // $dataTable instanceOf Set
$dataTable = $archive->getDataTableFromNumeric($fieldsToGet);
// get rid of the DataTable_Array that is created by the IndexedBySite archive type
- if ($dataTable instanceof Piwik_DataTable_Array
+ if ($dataTable instanceof DataTable\Map
&& $multipleWebsitesRequested
) {
$dataTable = $dataTable->mergeChildren();
} else {
- if (!($dataTable instanceof Piwik_DataTable_Array)
+ if (!($dataTable instanceof DataTable\Map)
&& $dataTable->getRowsCount() > 0
) {
$firstSite = is_array($sites) ? reset($sites) : $sites;
@@ -238,18 +240,18 @@ class Piwik_MultiSites_API
// if the period isn't a range & a lastN/previousN date isn't used, we get the same
// data for the last period to show the evolution of visits/actions/revenue
- list($strLastDate, $lastPeriod) = Period_Range::getLastDate($date, $period);
+ list($strLastDate, $lastPeriod) = Range::getLastDate($date, $period);
if ($strLastDate !== false) {
if ($lastPeriod !== false) {
// NOTE: no easy way to set last period date metadata when range of dates is requested.
// will be easier if DataTable_Array::metadata is removed, and metadata that is
- // put there is put directly in Piwik_DataTable::metadata.
+ // put there is put directly in DataTable::metadata.
$dataTable->setMetadata(self::getLastPeriodMetadataName('date'), $lastPeriod);
}
$pastArchive = Archive::build($sites, $period, $strLastDate, $segment, $_restrictSitesToLogin);
$pastData = $pastArchive->getDataTableFromNumeric($fieldsToGet);
- if ($pastData instanceof Piwik_DataTable_Array
+ if ($pastData instanceof DataTable\Map
&& $multipleWebsitesRequested
) {
$pastData = $pastData->mergeChildren();
@@ -264,7 +266,7 @@ class Piwik_MultiSites_API
// remove eCommerce related metrics on non eCommerce Piwik sites
// note: this is not optimal in terms of performance: those metrics should not be retrieved in the first place
if ($enhanced) {
- // $dataTableRows instanceOf Piwik_DataTable_Row[]
+ // $dataTableRows instanceOf Row[]
$dataTableRows = $dataTable->getRows();
foreach ($dataTableRows as $dataTableRow) {
@@ -283,8 +285,7 @@ class Piwik_MultiSites_API
// set the label of each row to the site name
if ($multipleWebsitesRequested) {
- $getNameFor = array('Site', 'getNameFor');
- $dataTable->filter('ColumnCallbackReplace', array('label', $getNameFor));
+ $dataTable->filter('ColumnCallbackReplace', array('label', '\Piwik\Site::getNameFor'));
} else {
$dataTable->filter('ColumnDelete', array('label'));
}
@@ -317,8 +318,8 @@ class Piwik_MultiSites_API
* Performs a binary filter of two
* DataTables in order to correctly calculate evolution metrics.
*
- * @param Piwik_DataTable|Piwik_DataTable_Array $currentData
- * @param Piwik_DataTable|Piwik_DataTable_Array $pastData
+ * @param DataTable|DataTable\Map $currentData
+ * @param DataTable|DataTable\Map $pastData
* @param array $apiMetrics The array of string fields to calculate evolution
* metrics for.
* @throws Exception
@@ -330,7 +331,7 @@ class Piwik_MultiSites_API
. get_class($pastData).".");
}
- if ($currentData instanceof Piwik_DataTable_Array) {
+ if ($currentData instanceof DataTable\Map) {
$pastArray = $pastData->getArray();
foreach ($currentData->getArray() as $subTable) {
$this->calculateEvolutionPercentages($subTable, current($pastArray), $apiMetrics);
@@ -354,13 +355,13 @@ class Piwik_MultiSites_API
* Sets the total visits, actions & revenue for a DataTable returned by
* $this->buildDataTable.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
* @param array $apiMetrics Metrics info.
* @return array Array of three values: total visits, total actions, total revenue
*/
private function setMetricsTotalsMetadata($dataTable, $apiMetrics)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $table) {
$this->setMetricsTotalsMetadata($table, $apiMetrics);
}
@@ -393,13 +394,13 @@ class Piwik_MultiSites_API
* Sets the total evolution metadata for a datatable returned by $this->buildDataTable
* given data for the last period.
*
- * @param Piwik_DataTable $dataTable
- * @param Piwik_DataTable $pastData
+ * @param DataTable $dataTable
+ * @param DataTable $pastData
* @param array $apiMetrics Metrics info.
*/
private function setPastDataMetadata($dataTable, $pastData, $apiMetrics)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
$pastArray = $pastData->getArray();
foreach ($dataTable->getArray() as $subTable) {
$this->setPastDataMetadata($subTable, current($pastArray), $apiMetrics);
@@ -422,7 +423,7 @@ class Piwik_MultiSites_API
// calculate & set evolution
$currentTotal = $dataTable->getMetadata($totalMetadataName);
- $evolution = Piwik_DataTable_Filter_CalculateEvolutionFilter::calculate($currentTotal, $pastTotal);
+ $evolution = CalculateEvolutionFilter::calculate($currentTotal, $pastTotal);
$dataTable->setMetadata($totalEvolutionMetadataName, $evolution);
}
}
diff --git a/plugins/MultiSites/Controller.php b/plugins/MultiSites/Controller.php
index 992cfa6be0..4986ba1abc 100644
--- a/plugins/MultiSites/Controller.php
+++ b/plugins/MultiSites/Controller.php
@@ -12,6 +12,7 @@ use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -153,8 +154,8 @@ class Piwik_MultiSites_Controller extends Piwik_Controller
// if the current date is today, or yesterday,
// in case the website is set to UTC-12), or today in UTC+14, we refresh the page every 5min
if (in_array($date, array('today', date('Y-m-d'),
- 'yesterday', Piwik_Date::factory('yesterday')->toString('Y-m-d'),
- Piwik_Date::factory('now', 'UTC+14')->toString('Y-m-d')))
+ 'yesterday', Date::factory('yesterday')->toString('Y-m-d'),
+ Date::factory('now', 'UTC+14')->toString('Y-m-d')))
) {
$view->autoRefreshTodayReport = Config::getInstance()->General['multisites_refresh_after_seconds'];
@@ -171,32 +172,32 @@ class Piwik_MultiSites_Controller extends Piwik_Controller
* The Multisites reports displays the first calendar date as the earliest day available for all websites.
* Also, today is the later "today" available across all timezones.
* @param array $siteIds Array of IDs for each site being displayed.
- * @return array of two Piwik_Date instances. First is the min-date & the second
+ * @return array of two Date instances. First is the min-date & the second
* is the max date.
*/
private function getMinMaxDateAcrossWebsites($siteIds)
{
- $now = Piwik_Date::now();
+ $now = Date::now();
$minDate = null;
$maxDate = $now->subDay(1)->getTimestamp();
foreach ($siteIds as $idsite) {
// look for 'now' in the website's timezone
$timezone = Site::getTimezoneFor($idsite);
- $date = Piwik_Date::adjustForTimezone($now->getTimestamp(), $timezone);
+ $date = Date::adjustForTimezone($now->getTimestamp(), $timezone);
if ($date > $maxDate) {
$maxDate = $date;
}
// look for the absolute minimum date
$creationDate = Site::getCreationDateFor($idsite);
- $date = Piwik_Date::adjustForTimezone(strtotime($creationDate), $timezone);
+ $date = Date::adjustForTimezone(strtotime($creationDate), $timezone);
if (is_null($minDate) || $date < $minDate) {
$minDate = $date;
}
}
- return array(Piwik_Date::factory($minDate), Piwik_Date::factory($maxDate));
+ return array(Date::factory($minDate), Date::factory($maxDate));
}
protected function applyPrettyMoney(&$sites)
diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php
index a8ccc1ffcf..96f14fabce 100644
--- a/plugins/MultiSites/MultiSites.php
+++ b/plugins/MultiSites/MultiSites.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_MultiSites
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_MultiSites
*/
-class Piwik_MultiSites extends Piwik_Plugin
+class Piwik_MultiSites extends Plugin
{
public function getInformation()
{
diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php
index 9db64023c8..26cf98a5c5 100644
--- a/plugins/Overlay/API.php
+++ b/plugins/Overlay/API.php
@@ -2,6 +2,7 @@
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Access;
+use Piwik\DataTable;
/**
* Piwik - Open source web analytics
@@ -81,7 +82,7 @@ class Piwik_Overlay_API
$url = Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite);
// we don't unsanitize $url here. it will be done in the Transitions plugin.
- $resultDataTable = new Piwik_DataTable;
+ $resultDataTable = new DataTable;
try {
$limitBeforeGrouping = Config::getInstance()->General['overlay_following_pages_limit'];
diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php
index 6f7c00caf9..d3bd8ab3b0 100644
--- a/plugins/Overlay/Controller.php
+++ b/plugins/Overlay/Controller.php
@@ -1,6 +1,7 @@
<?php
use Piwik\Metrics;
use Piwik\Piwik;
+use Piwik\Config;
use Piwik\Common;
/**
@@ -22,7 +23,7 @@ class Piwik_Overlay_Controller extends Piwik_Controller
Piwik::checkUserHasViewAccess($this->idSite);
$template = '@Overlay/index';
- if (Piwik_Config::getInstance()->General['overlay_disable_framed_mode']) {
+ if (Config::getInstance()->General['overlay_disable_framed_mode']) {
$template = '@Overlay/index_noframe';
}
diff --git a/plugins/Overlay/Overlay.php b/plugins/Overlay/Overlay.php
index 5c6d072be5..72a08d5046 100644
--- a/plugins/Overlay/Overlay.php
+++ b/plugins/Overlay/Overlay.php
@@ -9,7 +9,9 @@
* @package Piwik_Overlay
*/
-class Piwik_Overlay extends Piwik_Plugin
+use Piwik\Plugin;
+
+class Piwik_Overlay extends Plugin
{
public function getInformation()
{
diff --git a/plugins/PDFReports/API.php b/plugins/PDFReports/API.php
index c3eea2e13d..4826fe8c80 100644
--- a/plugins/PDFReports/API.php
+++ b/plugins/PDFReports/API.php
@@ -10,7 +10,9 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Site;
+use Piwik\Translate;
/**
* The PDFReports API lets you manage Scheduled Email reports, as well as generate, download or email any existing report.
@@ -119,7 +121,7 @@ class Piwik_PDFReports_API
'format' => $reportFormat,
'parameters' => $parameters,
'reports' => $reports,
- 'ts_created' => Piwik_Date::now()->getDatetime(),
+ 'ts_created' => Date::now()->getDatetime(),
'deleted' => 0,
));
@@ -294,10 +296,10 @@ class Piwik_PDFReports_API
// load specified language
if (empty($language)) {
- $language = Piwik_Translate::getInstance()->getLanguageDefault();
+ $language = Translate::getInstance()->getLanguageDefault();
}
- Piwik_Translate::getInstance()->reloadLanguage($language);
+ Translate::getInstance()->reloadLanguage($language);
$reports = $this->getReports($idSite = false, $_period = false, $idReport);
$report = reset($reports);
@@ -496,7 +498,7 @@ class Piwik_PDFReports_API
}
if (empty($date)) {
- $date = Piwik_Date::now()->subPeriod(1, $report['period'])->toString();
+ $date = Date::now()->subPeriod(1, $report['period'])->toString();
}
$language = Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($report['login']);
@@ -538,7 +540,7 @@ class Piwik_PDFReports_API
// Update flag in DB
Zend_Registry::get('db')->update(Common::prefixTable('report'),
- array('ts_last_sent' => Piwik_Date::now()->getDatetime()),
+ array('ts_last_sent' => Date::now()->getDatetime()),
"idreport = " . $report['idreport']
);
@@ -798,6 +800,6 @@ class Piwik_PDFReports_API
*/
public static function isSegmentEditorActivated()
{
- return PluginsManager::getInstance()->isPluginActivated('SegmentEditor');
+ return \Piwik\PluginsManager::getInstance()->isPluginActivated('SegmentEditor');
}
}
diff --git a/plugins/PDFReports/PDFReports.php b/plugins/PDFReports/PDFReports.php
index 5d93ed38cb..69ddb3d498 100644
--- a/plugins/PDFReports/PDFReports.php
+++ b/plugins/PDFReports/PDFReports.php
@@ -10,13 +10,16 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Config;
+use Piwik\Date;
+use Piwik\Plugin;
use Piwik\Site;
/**
*
* @package Piwik_PDFReports
*/
-class Piwik_PDFReports extends Piwik_Plugin
+class Piwik_PDFReports extends Plugin
{
const MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY = 'MobileMessaging_TopMenu';
const PDF_REPORTS_TOP_MENU_TRANSLATION_KEY = 'PDFReports_EmailReports';
@@ -204,7 +207,7 @@ class Piwik_PDFReports extends Piwik_Plugin
:
$displayFormat != self::DISPLAY_FORMAT_TABLES_ONLY)
&& Piwik::isGdExtensionEnabled()
- && PluginsManager::getInstance()->isPluginActivated('ImageGraph')
+ && \Piwik\PluginsManager::getInstance()->isPluginActivated('ImageGraph')
&& !empty($metadata['imageGraphUrl']);
$processedReport['evolutionGraph'] = $evolutionGraph;
@@ -409,13 +412,13 @@ class Piwik_PDFReports extends Piwik_Plugin
public function getScheduledTasks(&$tasks)
{
- $arbitraryDateInUTC = Piwik_Date::factory('2011-01-01');
+ $arbitraryDateInUTC = Date::factory('2011-01-01');
foreach (Piwik_PDFReports_API::getInstance()->getReports() as $report) {
if (!$report['deleted'] && $report['period'] != Piwik_ScheduledTime::PERIOD_NEVER) {
$midnightInSiteTimezone =
date(
'H',
- Piwik_Date::factory(
+ Date::factory(
$arbitraryDateInUTC,
Site::getTimezoneFor($report['idsite'])
)->getTimestamp()
@@ -461,7 +464,7 @@ class Piwik_PDFReports extends Piwik_Plugin
13,
$isHTML = false,
$tooltip = Piwik_Translate(
- PluginsManager::getInstance()->isPluginActivated('MobileMessaging')
+ \Piwik\PluginsManager::getInstance()->isPluginActivated('MobileMessaging')
? 'MobileMessaging_TopLinkTooltip' : 'PDFReports_TopLinkTooltip'
)
);
@@ -470,7 +473,7 @@ class Piwik_PDFReports extends Piwik_Plugin
function getTopMenuTranslationKey()
{
// if MobileMessaging is not activated, display 'Email reports'
- if (!PluginsManager::getInstance()->isPluginActivated('MobileMessaging'))
+ if (!\Piwik\PluginsManager::getInstance()->isPluginActivated('MobileMessaging'))
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
if (Piwik::isUserIsAnonymous()) {
diff --git a/plugins/PleineLune/PleineLune.php b/plugins/PleineLune/PleineLune.php
index 133cbbfea2..12b581bdc1 100644
--- a/plugins/PleineLune/PleineLune.php
+++ b/plugins/PleineLune/PleineLune.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_PleineLune
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_PleineLune
*/
-class Piwik_PleineLune extends Piwik_Plugin
+class Piwik_PleineLune extends Plugin
{
public function getListHooksRegistered()
{
diff --git a/plugins/PrivacyManager/Controller.php b/plugins/PrivacyManager/Controller.php
index a6770ae74a..a3af0246be 100644
--- a/plugins/PrivacyManager/Controller.php
+++ b/plugins/PrivacyManager/Controller.php
@@ -11,6 +11,7 @@
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
/**
*
@@ -105,7 +106,7 @@ class Piwik_PrivacyManager_Controller extends Piwik_Controller_Admin
*/
public static function isDntSupported()
{
- return PluginsManager::getInstance()->isPluginActivated('DoNotTrack');
+ return \Piwik\PluginsManager::getInstance()->isPluginActivated('DoNotTrack');
}
public function privacySettings()
@@ -214,12 +215,12 @@ class Piwik_PrivacyManager_Controller extends Piwik_Controller_Admin
Piwik::checkUserIsSuperUser();
$anonymizeIP = array();
- PluginsManager::getInstance()->loadPlugin(self::ANONYMIZE_IP_PLUGIN_NAME);
+ \Piwik\PluginsManager::getInstance()->loadPlugin(self::ANONYMIZE_IP_PLUGIN_NAME);
$anonymizeIP["name"] = self::ANONYMIZE_IP_PLUGIN_NAME;
- $anonymizeIP["enabled"] = PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME);
+ $anonymizeIP["enabled"] = \Piwik\PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME);
$anonymizeIP["maskLength"] = Config::getInstance()->Tracker['ip_address_mask_length'];
- $anonymizeIP["info"] = PluginsManager::getInstance()->getLoadedPlugin(self::ANONYMIZE_IP_PLUGIN_NAME)->getInformation();
+ $anonymizeIP["info"] = \Piwik\PluginsManager::getInstance()->getLoadedPlugin(self::ANONYMIZE_IP_PLUGIN_NAME)->getInformation();
return $anonymizeIP;
}
@@ -241,7 +242,7 @@ class Piwik_PrivacyManager_Controller extends Piwik_Controller_Admin
if (!empty($scheduleTimetable) && ($scheduleTimetable - time() > 0)) {
$nextPossibleSchedule = (int)$scheduleTimetable;
} else {
- $date = Piwik_Date::factory("today");
+ $date = Date::factory("today");
$nextPossibleSchedule = $date->addDay(1)->getTimestamp();
}
@@ -250,11 +251,11 @@ class Piwik_PrivacyManager_Controller extends Piwik_Controller_Admin
$deleteDataInfos["lastRun"] = false;
//next run ASAP (with next schedule run)
- $date = Piwik_Date::factory("today");
+ $date = Date::factory("today");
$deleteDataInfos["nextScheduleTime"] = $nextPossibleSchedule;
} else {
$deleteDataInfos["lastRun"] = $optionTable;
- $deleteDataInfos["lastRunPretty"] = Piwik_Date::factory((int)$optionTable)->getLocalized('%day% %shortMonth% %longYear%');
+ $deleteDataInfos["lastRunPretty"] = Date::factory((int)$optionTable)->getLocalized('%day% %shortMonth% %longYear%');
//Calculate next run based on last run + interval
$nextScheduleRun = (int)($deleteDataInfos["lastRun"] + $deleteDataInfos["config"]["delete_logs_schedule_lowest_interval"] * 24 * 60 * 60);
@@ -276,9 +277,9 @@ class Piwik_PrivacyManager_Controller extends Piwik_Controller_Admin
{
$pluginController = new Piwik_CorePluginsAdmin_Controller();
- if ($state == 1 && !PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME)) {
+ if ($state == 1 && !\Piwik\PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME)) {
$pluginController->activate($redirectAfter = false);
- } elseif ($state == 0 && PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME)) {
+ } elseif ($state == 0 && \Piwik\PluginsManager::getInstance()->isPluginActivated(self::ANONYMIZE_IP_PLUGIN_NAME)) {
$pluginController->deactivate($redirectAfter = false);
} else {
//nothing to do
diff --git a/plugins/PrivacyManager/LogDataPurger.php b/plugins/PrivacyManager/LogDataPurger.php
index ac899a6ce4..6d7a06b951 100755
--- a/plugins/PrivacyManager/LogDataPurger.php
+++ b/plugins/PrivacyManager/LogDataPurger.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
/**
* Purges the log_visit, log_conversion and related tables of old visit data.
@@ -155,7 +156,7 @@ class Piwik_PrivacyManager_LogDataPurger
}
// select highest idvisit to delete from
- $dateStart = Piwik_Date::factory("today")->subDay($this->deleteLogsOlderThan);
+ $dateStart = Date::factory("today")->subDay($this->deleteLogsOlderThan);
$sql = "SELECT idvisit
FROM $logVisit
WHERE '" . $dateStart->toString('Y-m-d H:i:s') . "' > visit_last_action_time
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php
index dcbc12814d..710232001b 100644
--- a/plugins/PrivacyManager/PrivacyManager.php
+++ b/plugins/PrivacyManager/PrivacyManager.php
@@ -12,6 +12,8 @@ use Piwik\Config;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
+use Piwik\Plugin;
/**
* @see plugins/PrivacyManager/LogDataPurger.php
@@ -27,7 +29,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/PrivacyManager/ReportsPurger.php';
*
* @package Piwik_PrivacyManager
*/
-class Piwik_PrivacyManager extends Piwik_Plugin
+class Piwik_PrivacyManager extends Plugin
{
const OPTION_LAST_DELETE_PIWIK_LOGS = "lastDelete_piwik_logs";
const OPTION_LAST_DELETE_PIWIK_REPORTS = 'lastDelete_piwik_reports';
@@ -146,7 +148,7 @@ class Piwik_PrivacyManager extends Piwik_Plugin
*/
public static function savePurgeDataSettings($settings)
{
- $plugin = PluginsManager::getInstance()->getLoadedPlugin('PrivacyManager');
+ $plugin = \Piwik\PluginsManager::getInstance()->getLoadedPlugin('PrivacyManager');
foreach (self::$defaultPurgeDataOptions as $optionName => $defaultValue) {
if (isset($settings[$optionName])) {
@@ -189,7 +191,7 @@ class Piwik_PrivacyManager extends Piwik_Plugin
}
// set last run time
- Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Piwik_Date::factory('today')->getTimestamp());
+ Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Date::factory('today')->getTimestamp());
Piwik_PrivacyManager_ReportsPurger::make($settings, self::getAllMetricsToKeep())->purgeData();
}
@@ -226,7 +228,7 @@ class Piwik_PrivacyManager extends Piwik_Plugin
* If deletion / table optimization exceeds execution time, other tasks maybe prevented of being executed
* every time, when the schedule is triggered.
*/
- $lastDeleteDate = Piwik_Date::factory("today")->getTimestamp();
+ $lastDeleteDate = Date::factory("today")->getTimestamp();
Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS, $lastDeleteDate);
// execute the purge
@@ -274,7 +276,7 @@ class Piwik_PrivacyManager extends Piwik_Plugin
*
* @param int $reportDateYear The year of the report in question.
* @param int $reportDateMonth The month of the report in question.
- * @param int|Piwik_Date $reportsOlderThan If an int, the number of months a report must be older than
+ * @param int|Date $reportsOlderThan If an int, the number of months a report must be older than
* in order to be purged. If a date, the date a report must be
* older than in order to be purged.
* @return bool
@@ -293,8 +295,8 @@ class Piwik_PrivacyManager extends Piwik_Plugin
}
// if a integer was supplied, assume it is the number of months a report must be older than
- if (!($reportsOlderThan instanceof Piwik_Date)) {
- $reportsOlderThan = Piwik_Date::factory('today')->subMonth(1 + $reportsOlderThan);
+ if (!($reportsOlderThan instanceof Date)) {
+ $reportsOlderThan = Date::factory('today')->subMonth(1 + $reportsOlderThan);
}
return Piwik_PrivacyManager_ReportsPurger::shouldReportBePurged(
diff --git a/plugins/PrivacyManager/ReportsPurger.php b/plugins/PrivacyManager/ReportsPurger.php
index db4e5cafe3..a8ed8c3bfa 100755
--- a/plugins/PrivacyManager/ReportsPurger.php
+++ b/plugins/PrivacyManager/ReportsPurger.php
@@ -8,7 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_PrivacyManager
*/
+use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Piwik;
+use Piwik\Date;
/**
* Purges archived reports and metrics that are considered old.
@@ -203,21 +205,21 @@ class Piwik_PrivacyManager_ReportsPurger
// get month for which reports as old or older than, should be deleted
// reports whose creation date <= this month will be deleted
// (NOTE: we ignore how far we are in the current month)
- $toRemoveDate = Piwik_Date::factory('today')->subMonth(1 + $this->deleteReportsOlderThan);
+ $toRemoveDate = Date::factory('today')->subMonth(1 + $this->deleteReportsOlderThan);
// find all archive tables that are older than N months
$oldNumericTables = array();
$oldBlobTables = array();
foreach (Piwik::getTablesInstalled() as $table) {
- $type = Piwik_DataAccess_ArchiveTableCreator::getTypeFromTableName($table);
+ $type = ArchiveTableCreator::getTypeFromTableName($table);
if($type === false) {
continue;
}
- $date = Piwik_DataAccess_ArchiveTableCreator::getDateFromTableName($table);
+ $date = ArchiveTableCreator::getDateFromTableName($table);
list($year, $month) = explode('_', $date);
if (self::shouldReportBePurged($year, $month, $toRemoveDate)) {
- if ($type == Piwik_DataAccess_ArchiveTableCreator::NUMERIC_TABLE) {
+ if ($type == ArchiveTableCreator::NUMERIC_TABLE) {
$oldNumericTables[] = $table;
} else {
$oldBlobTables[] = $table;
@@ -233,7 +235,7 @@ class Piwik_PrivacyManager_ReportsPurger
*
* @param int $reportDateYear The year of the report in question.
* @param int $reportDateMonth The month of the report in question.
- * @param Piwik_Date $toRemoveDate The date a report must be older than in order to be purged.
+ * @param Date $toRemoveDate The date a report must be older than in order to be purged.
* @return bool
*/
public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $toRemoveDate)
@@ -285,7 +287,7 @@ class Piwik_PrivacyManager_ReportsPurger
// if not keeping segments make sure segments w/ kept periods are also deleted
if (!$this->keepSegmentReports) {
$this->findSegmentArchives($oldNumericTables);
- $archiveIds = $this->segmentArchiveIds[Piwik_DataAccess_ArchiveTableCreator::getDateFromTableName($table)];
+ $archiveIds = $this->segmentArchiveIds[ArchiveTableCreator::getDateFromTableName($table)];
if (!empty($archiveIds)) {
$where .= " OR idarchive IN (" . implode(',', $archiveIds) . ")";
@@ -308,7 +310,7 @@ class Piwik_PrivacyManager_ReportsPurger
}
foreach ($numericTables as $table) {
- $tableDate = Piwik_DataAccess_ArchiveTableCreator::getDateFromTableName($table);
+ $tableDate = ArchiveTableCreator::getDateFromTableName($table);
$maxIdArchive = Piwik_FetchOne("SELECT MAX(idarchive) FROM $table");
diff --git a/plugins/Provider/Archiver.php b/plugins/Provider/Archiver.php
index ce782f9342..bd9a4fa456 100644
--- a/plugins/Provider/Archiver.php
+++ b/plugins/Provider/Archiver.php
@@ -9,8 +9,9 @@
* @package Piwik_Provider
*/
use Piwik\Metrics;
+use Piwik\PluginsArchiver;
-class Piwik_Provider_Archiver extends Piwik_PluginsArchiver
+class Piwik_Provider_Archiver extends PluginsArchiver
{
const PROVIDER_RECORD_NAME = 'Provider_hostnameExt';
const PROVIDER_FIELD = "location_provider";
diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php
index ca7c05ae8d..fe448e7395 100644
--- a/plugins/Provider/Provider.php
+++ b/plugins/Provider/Provider.php
@@ -9,12 +9,14 @@
* @package Piwik_Provider
*/
use Piwik\Common;
+use Piwik\Plugin;
+use Piwik\ArchiveProcessor;
/**
*
* @package Piwik_Provider
*/
-class Piwik_Provider extends Piwik_Plugin
+class Piwik_Provider extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -192,7 +194,7 @@ class Piwik_Provider extends Piwik_Plugin
/**
* Daily archive: processes the report Visits by Provider
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_Provider_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -200,7 +202,7 @@ class Piwik_Provider extends Piwik_Plugin
}
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_Provider_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php
index a09ec1ab36..540060db4b 100644
--- a/plugins/Provider/functions.php
+++ b/plugins/Provider/functions.php
@@ -9,6 +9,7 @@
* @package Piwik_Provider
*/
use Piwik\Common;
+use Piwik\DataTable;
/**
* Return hostname portion of a domain name
@@ -38,7 +39,7 @@ function Piwik_getHostnameName($in)
*/
function Piwik_getHostnameUrl($in)
{
- if ($in == Piwik_DataTable::LABEL_SUMMARY_ROW) {
+ if ($in == DataTable::LABEL_SUMMARY_ROW) {
return false;
}
if (empty($in)
diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php
index f7f71bb8a8..9f49505e97 100644
--- a/plugins/Proxy/Controller.php
+++ b/plugins/Proxy/Controller.php
@@ -21,73 +21,6 @@ class Piwik_Proxy_Controller extends Piwik_Controller
const TRANSPARENT_PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=';
/**
- * Display the "Export Image" window.
- *
- * @deprecated 1.5.1
- *
- * @internal param string $imageData Base-64 encoded image data (via $_POST)
- */
- static public function exportImageWindow()
- {
- Piwik::checkUserHasSomeViewAccess();
-
- $view = new Piwik_View('@Proxy/exportImageWindow');
- $view->imageData = 'data:image/png;base64,' . Common::getRequestVar('imageData', self::TRANSPARENT_PNG_PIXEL, 'string', $_POST);
- echo $view->render();
- }
-
- function exportImage()
- {
- self::exportImageWindow();
- }
-
- /**
- * Output binary image from base-64 encoded data.
- *
- * @deprecated 1.5.1
- *
- * @internal param string $imageData Base-64 encoded image data (via $_POST)
- */
- static public function outputBinaryImage()
- {
- Piwik::checkUserHasSomeViewAccess();
-
- $rawData = Common::getRequestVar('imageData', '', 'string', $_POST);
-
- // returns false if any illegal characters in input
- $data = base64_decode($rawData);
- if ($data !== false) {
- // check for PNG header
- if (Common::substr($data, 0, 8) === "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a") {
- header('Content-Type: image/png');
-
- // more robust validation (if available)
- if (function_exists('imagecreatefromstring')) {
- // validate image data
- $imgResource = @imagecreatefromstring($data);
- if ($imgResource !== false) {
- // output image and clean-up
- imagepng($imgResource);
- imagedestroy($imgResource);
- exit;
- }
- } else {
- echo $data;
- exit;
- }
- }
- }
-
- Piwik::setHttpStatus('400 Bad Request');
- exit;
- }
-
- function outputImage()
- {
- self::outputBinaryImage();
- }
-
- /**
* Output the merged CSS file.
* This method is called when the asset manager is enabled.
*
diff --git a/plugins/Proxy/Proxy.php b/plugins/Proxy/Proxy.php
index c669215411..fc404bfd2e 100644
--- a/plugins/Proxy/Proxy.php
+++ b/plugins/Proxy/Proxy.php
@@ -8,13 +8,14 @@
* @category Piwik_Plugins
* @package Piwik_Proxy
*/
+use Piwik\Plugin;
/**
* Proxy services for the UI
*
* @package Piwik_Proxy
*/
-class Piwik_Proxy extends Piwik_Plugin
+class Piwik_Proxy extends Plugin
{
/**
* Return information about this plugin.
diff --git a/plugins/Proxy/templates/exportImageWindow.twig b/plugins/Proxy/templates/exportImageWindow.twig
deleted file mode 100644
index 0145a6589f..0000000000
--- a/plugins/Proxy/templates/exportImageWindow.twig
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>{{ 'General_ExportAsImage_js'|translate }}</title>
-</head>
-<body>
-<img title="Piwik Graph" src="{{ imageData }}"/><br/><br/>
-
-<p>{{ 'General_SaveImageOnYourComputer_js'|translate }}</p>
-</body>
-</html>
diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php
index 16168b532a..a8dba84e0d 100644
--- a/plugins/Referers/API.php
+++ b/plugins/Referers/API.php
@@ -9,9 +9,12 @@
* @package Piwik_Referers
*/
use Piwik\Archive;
+use Piwik\DataTable\Row;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
+use Piwik\DataTable;
/**
* The Referrers API lets you access reports about Websites, Search engines, Keywords, Campaigns used to access your website.
@@ -39,11 +42,11 @@ class Piwik_Referers_API
* @param string $name
* @param int $idSite
* @param string $period
- * @param Piwik_Date $date
+ * @param Date $date
* @param string $segment
* @param bool $expanded
* @param int|null $idSubtable
- * @return Piwik_DataTable
+ * @return DataTable
*/
protected function getDataTable($name, $idSite, $period, $date, $segment, $expanded = false, $idSubtable = null)
{
@@ -71,7 +74,7 @@ class Piwik_Referers_API
* subtable ID. The result when using this parameter will be the
* specific report for the given referrer type.
* @param bool $expanded Whether to get report w/ subtables loaded or not.
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getRefererType($idSite, $period, $date, $segment = false, $typeReferer = false,
$idSubtable = false, $expanded = false)
@@ -108,7 +111,7 @@ class Piwik_Referers_API
// set subtable IDs for each row to the label (which holds the int referrer type)
// NOTE: not yet possible to do this w/ DataTable_Array instances
- if (!($dataTable instanceof Piwik_DataTable_Array)) {
+ if (!($dataTable instanceof DataTable\Map)) {
$this->setGetReferrerTypeSubtables($dataTable, $idSite, $period, $date, $segment, $expanded);
}
@@ -125,7 +128,7 @@ class Piwik_Referers_API
{
$dataTable = $this->getRefererType($idSite, $period, $date, $segment, $typeReferer = false, $idSubtable = false, $expanded = true);
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
throw new Exception("Referrers.getAll with multiple sites or dates is not supported (yet).");
}
@@ -190,11 +193,11 @@ class Piwik_Referers_API
}
/**
- * @param Piwik_Datatable $table
+ * @param DataTable $table
*/
private function filterOutKeywordNotDefined($table)
{
- if ($table instanceof Piwik_Datatable) {
+ if ($table instanceof DataTable) {
$row = $table->getRowIdFromLabel('');
if ($row) {
$table->deleteRow($row);
@@ -212,7 +215,7 @@ class Piwik_Referers_API
$table = $response->getResponse($table);
// If period=lastX we only keep the first resultset as we want to return a plain list
- if ($table instanceof Piwik_DataTable_Array) {
+ if ($table instanceof DataTable\Map) {
$tables = $table->getArray();
$table = current($tables);
}
@@ -253,7 +256,7 @@ class Piwik_Referers_API
$searchEngines = $this->getSearchEngines($idSite, $period, $date, $segment);
$searchEngines->applyQueuedFilters();
- if ($searchEngines instanceof Piwik_DataTable_Array) {
+ if ($searchEngines instanceof DataTable\Map) {
$dataTables = $searchEngines->getArray();
// find first datatable containing data
@@ -313,7 +316,7 @@ class Piwik_Referers_API
* @param string $date
* @param string|bool $segment
* @param bool $expanded
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getSocials($idSite, $period, $date, $segment = false, $expanded = false)
{
@@ -346,7 +349,7 @@ class Piwik_Referers_API
* is the array index of an item in the /core/DataFiles/Socials.php file.
* The urls are filtered by the social network at this index.
* If false, no filtering is done and every social URL is returned.
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getUrlsForSocial($idSite, $period, $date, $segment = false, $idSubtable = false)
{
@@ -420,11 +423,11 @@ class Piwik_Referers_API
* Removes idsubdatatable_in_db metadata from a DataTable. Used by Social tables since
* they use fake subtable IDs.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
*/
private function removeSubtableMetadata($dataTable)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $childTable) {
$this->removeSubtableMetadata($childTable);
}
@@ -440,11 +443,11 @@ class Piwik_Referers_API
*
* The IDs are int indexes into the array in /core/DataFiles/Socials.php.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
*/
private function setSocialIdSubtables($dataTable)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $childTable) {
$this->setSocialIdSubtables($childTable);
}
@@ -455,7 +458,7 @@ class Piwik_Referers_API
$i = 1; // start at one because idSubtable=0 is equivalent to idSubtable=false
foreach ($GLOBALS['Piwik_socialUrl'] as $domain => $name) {
if ($name == $socialName) {
- $row->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED] = $i;
+ $row->c[Row::DATATABLE_ASSOCIATED] = $i;
break;
}
@@ -471,12 +474,12 @@ class Piwik_Referers_API
* the grandchildren of the report will be the original report, and it will
* recurse when trying to get a flat report).
*
- * @param Piwik_DataTable $table
- * @return Piwik_DataTable Returns $table for convenience.
+ * @param DataTable $table
+ * @return DataTable Returns $table for convenience.
*/
private function removeSubtableIds($table)
{
- if ($table instanceof Piwik_DataTable_Array) {
+ if ($table instanceof DataTable\Map) {
foreach ($table->getArray() as $childTable) {
$this->removeSubtableIds($childTable);
}
@@ -498,7 +501,7 @@ class Piwik_Referers_API
* If we are getting an expanded datatable, the datatable for the row's referrer
* type is loaded and attached to the appropriate row in the getRefererType report.
*
- * @param Piwik_DataTable $dataTable
+ * @param DataTable $dataTable
* @param string $idSite
* @param string $period
* @param string $date
@@ -512,7 +515,7 @@ class Piwik_Referers_API
if ($typeReferrer != Common::REFERER_TYPE_DIRECT_ENTRY) {
if (!$expanded) // if we don't want the expanded datatable, then don't do any extra queries
{
- $row->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED] = $typeReferrer;
+ $row->c[Row::DATATABLE_ASSOCIATED] = $typeReferrer;
} else // otherwise, we have to get the othe datatables
{
$subtable = $this->getRefererType($idSite, $period, $date, $segment, $type = false,
diff --git a/plugins/Referers/Archiver.php b/plugins/Referers/Archiver.php
index 7c7b484f02..dd7a795e9e 100644
--- a/plugins/Referers/Archiver.php
+++ b/plugins/Referers/Archiver.php
@@ -2,6 +2,7 @@
use Piwik\Common;
use Piwik\Config;
use Piwik\Metrics;
+use Piwik\PluginsArchiver;
/**
* Piwik - Open source web analytics
@@ -13,7 +14,7 @@ use Piwik\Metrics;
* @package Piwik_Referers
*/
-class Piwik_Referers_Archiver extends Piwik_PluginsArchiver
+class Piwik_Referers_Archiver extends PluginsArchiver
{
const SEARCH_ENGINES_RECORD_NAME = 'Referers_keywordBySearchEngine';
const KEYWORDS_RECORD_NAME = 'Referers_searchEngineByKeyword';
diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php
index 06f2c1ca71..97d920e175 100644
--- a/plugins/Referers/Controller.php
+++ b/plugins/Referers/Controller.php
@@ -9,7 +9,7 @@
* @package Piwik_Referers
*/
use Piwik\Metrics;
-use Piwik\Period_Range;
+use Piwik\Period\Range;
use Piwik\Piwik;
use Piwik\Common;
@@ -51,7 +51,7 @@ class Piwik_Referers_Controller extends Piwik_Controller
}
// calculate evolution for visit metrics & distinct metrics
- list($lastPeriodDate, $ignore) = Period_Range::getLastDate();
+ list($lastPeriodDate, $ignore) = Range::getLastDate();
if ($lastPeriodDate !== false) {
$date = Common::getRequestVar('date');
$period = Common::getRequestVar('period');
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index c96ca7927d..449bc0ce41 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -8,7 +8,9 @@
* @category Piwik_Plugins
* @package Piwik_Referers
*/
+use Piwik\ArchiveProcessor;
use Piwik\Piwik;
+use Piwik\Plugin;
/**
* @see plugins/Referers/functions.php
@@ -18,7 +20,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/Referers/functions.php';
/**
* @package Piwik_Referers
*/
-class Piwik_Referers extends Piwik_Plugin
+class Piwik_Referers extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -267,7 +269,7 @@ class Piwik_Referers extends Piwik_Plugin
/**
* Hooks on daily archive to trigger various log processing
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_Referers_Archiver($archiveProcessor);
if ($archiving->shouldArchive()) {
@@ -279,7 +281,7 @@ class Piwik_Referers extends Piwik_Plugin
* Period archiving: sums up daily stats and sums report tables,
* making sure that tables are still truncated.
*/
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_Referers_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/SEO/API.php b/plugins/SEO/API.php
index b7826f30d5..185561df44 100644
--- a/plugins/SEO/API.php
+++ b/plugins/SEO/API.php
@@ -9,6 +9,7 @@
* @package Piwik_SEO
*/
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* @see plugins/Referers/functions.php
@@ -40,7 +41,7 @@ class Piwik_SEO_API
* Returns SEO statistics for a URL.
*
* @param string $url URL to request SEO stats for
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getRank($url)
{
@@ -101,6 +102,6 @@ class Piwik_SEO_API
$data[Piwik_Translate('SEO_Dmoz')] = $dmozRank;
}
- return Piwik_DataTable::makeFromIndexedArray($data);
+ return DataTable::makeFromIndexedArray($data);
}
}
diff --git a/plugins/SEO/Controller.php b/plugins/SEO/Controller.php
index b33aac8986..b509264871 100644
--- a/plugins/SEO/Controller.php
+++ b/plugins/SEO/Controller.php
@@ -9,6 +9,7 @@
* @package Piwik_SEO
*/
use Piwik\Common;
+use Piwik\DataTable\Renderer;
use Piwik\Site;
/**
@@ -36,7 +37,7 @@ class Piwik_SEO_Controller extends Piwik_Controller
$view = new Piwik_View('@SEO/getRank');
$view->urlToRank = Piwik_SEO_RankChecker::extractDomainFromUrl($url);
- $renderer = Piwik_DataTable_Renderer::factory('php');
+ $renderer = Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
diff --git a/plugins/SEO/SEO.php b/plugins/SEO/SEO.php
index 4ff22fdabb..e41c93385c 100644
--- a/plugins/SEO/SEO.php
+++ b/plugins/SEO/SEO.php
@@ -8,11 +8,12 @@
* @category Piwik_Plugins
* @package Piwik_SEO
*/
+use Piwik\Plugin;
/**
* @package Piwik_SEO
*/
-class Piwik_SEO extends Piwik_Plugin
+class Piwik_SEO extends Plugin
{
/**
* @see Piwik_Plugin::getInformation
diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
index 4a83e0f7cd..588b5f096f 100644
--- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
+++ b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
@@ -45,7 +45,7 @@ class PhpSecInfo_Test_Core_Upload_Tmp_Dir extends PhpSecInfo_Test_Core
* We are disabling this function on Windows OSes right now until
* we can be certain of the proper way to check world-readability
*
- * @return unknown
+ * @return bool
*/
function isTestable()
{
diff --git a/plugins/SecurityInfo/SecurityInfo.php b/plugins/SecurityInfo/SecurityInfo.php
index ecd8d2e5f6..785247d2a2 100644
--- a/plugins/SecurityInfo/SecurityInfo.php
+++ b/plugins/SecurityInfo/SecurityInfo.php
@@ -9,12 +9,13 @@
* @package Piwik_SecurityInfo
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_SecurityInfo
*/
-class Piwik_SecurityInfo extends Piwik_Plugin
+class Piwik_SecurityInfo extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php
index 855affb5e6..884c206e78 100644
--- a/plugins/SegmentEditor/API.php
+++ b/plugins/SegmentEditor/API.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Segment;
/**
@@ -142,9 +143,9 @@ class Piwik_SegmentEditor_API
/**
* Modifies an existing stored segment.
*
- * @param $idSegment The ID of the stored segment to modify.
- * @param $name The new name of the segment.
- * @param $definition The new definition of the segment.
+ * @param int $idSegment The ID of the stored segment to modify.
+ * @param string $name The new name of the segment.
+ * @param string $definition The new definition of the segment.
* @param bool $idSite If supplied, associates the stored segment with as single site.
* @param bool $autoArchive Whether to automatically archive data with the segment or not.
* @param bool $enabledAllUsers Whether the stored segment is viewable by all users or just the one that created it.
@@ -168,7 +169,7 @@ class Piwik_SegmentEditor_API
'enable_all_users' => $enabledAllUsers,
'enable_only_idsite' => $idSite,
'auto_archive' => $autoArchive,
- 'ts_last_edit' => Piwik_Date::now()->getDatetime(),
+ 'ts_last_edit' => Date::now()->getDatetime(),
);
$db = Zend_Registry::get('db');
@@ -182,8 +183,8 @@ class Piwik_SegmentEditor_API
/**
* Adds a new stored segment.
*
- * @param $name The new name of the segment.
- * @param $definition The new definition of the segment.
+ * @param string $name The new name of the segment.
+ * @param string $definition The new definition of the segment.
* @param bool $idSite If supplied, associates the stored segment with as single site.
* @param bool $autoArchive Whether to automatically archive data with the segment or not.
* @param bool $enabledAllUsers Whether the stored segment is viewable by all users or just the one that created it.
@@ -207,7 +208,7 @@ class Piwik_SegmentEditor_API
'enable_all_users' => $enabledAllUsers,
'enable_only_idsite' => $idSite,
'auto_archive' => $autoArchive,
- 'ts_created' => Piwik_Date::now()->getDatetime(),
+ 'ts_created' => Date::now()->getDatetime(),
'deleted' => 0,
);
$db->insert(Common::prefixTable("segment"), $bind);
diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php
index 94eefc117d..a4f54d01e7 100644
--- a/plugins/SegmentEditor/SegmentEditor.php
+++ b/plugins/SegmentEditor/SegmentEditor.php
@@ -9,11 +9,12 @@
* @package Piwik_SegmentEditor
*/
use Piwik\Common;
+use Piwik\Plugin;
/**
* @package Piwik_SegmentEditor
*/
-class Piwik_SegmentEditor extends Piwik_Plugin
+class Piwik_SegmentEditor extends Plugin
{
/**
* @see Piwik_Plugin::getInformation
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index c9a12e710c..edc66625e6 100644
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -11,6 +11,7 @@
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Access;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -223,7 +224,7 @@ class Piwik_SitesManager_API
if (empty($timestamp)) $timestamp = time();
- $time = Piwik_Date::factory((int)$timestamp)->getDatetime();
+ $time = Date::factory((int)$timestamp)->getDatetime();
$result = Piwik_FetchAll("
SELECT
idsite
@@ -236,7 +237,7 @@ class Piwik_SitesManager_API
AND visit_last_action_time > ?
AND visit_last_action_time <= ?
LIMIT 1)
- ", array($time, $now = Piwik_Date::now()->addHour(1)->getDatetime()));
+ ", array($time, $now = Date::now()->addHour(1)->getDatetime()));
$idSites = array();
foreach ($result as $idSite) {
$idSites[] = $idSite['idsite'];
@@ -516,8 +517,8 @@ class Piwik_SitesManager_API
$bind['sitesearch_keyword_parameters'] = $searchKeywordParameters;
$bind['sitesearch_category_parameters'] = $searchCategoryParameters;
$bind['ts_created'] = !is_null($startDate)
- ? Piwik_Date::factory($startDate)->getDatetime()
- : Piwik_Date::now()->getDatetime();
+ ? Date::factory($startDate)->getDatetime()
+ : Date::now()->getDatetime();
if (!empty($group)
&& Piwik::isUserIsSuperUser()
@@ -692,7 +693,7 @@ class Piwik_SitesManager_API
* Sets IPs to be excluded from all websites. IPs can contain wildcards.
* Will also apply to websites created in the future.
*
- * @param string Comma separated list of IPs to exclude from being tracked (allows wildcards)
+ * @param string $excludedIps Comma separated list of IPs to exclude from being tracked (allows wildcards)
* @return bool
*/
public function setGlobalExcludedIps($excludedIps)
@@ -853,7 +854,7 @@ class Piwik_SitesManager_API
* Sets list of URL query parameters to be excluded on all websites.
* Will also apply to websites created in the future.
*
- * @param string Comma separated list of URL query parameters to exclude from URLs
+ * @param string $excludedQueryParameters Comma separated list of URL query parameters to exclude from URLs
* @return bool
*/
public function setGlobalExcludedQueryParameters($excludedQueryParameters)
@@ -1015,7 +1016,7 @@ class Piwik_SitesManager_API
$bind['ecommerce'] = (int)(bool)$ecommerce;
}
if (!is_null($startDate)) {
- $bind['ts_created'] = Piwik_Date::factory($startDate)->getDatetime();
+ $bind['ts_created'] = Date::factory($startDate)->getDatetime();
}
$bind['excluded_ips'] = $this->checkAndReturnExcludedIps($excludedIps);
$bind['excluded_parameters'] = $this->checkAndReturnCommaSeparatedStringList($excludedQueryParameters);
diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php
index d5dd1c8be0..afbd9d21ed 100644
--- a/plugins/SitesManager/Controller.php
+++ b/plugins/SitesManager/Controller.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_SitesManager
*/
+use Piwik\DataTable\Renderer\Json;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -51,7 +53,7 @@ class Piwik_SitesManager_Controller extends Piwik_Controller_Admin
$view->currencies = Common::json_encode(Piwik_SitesManager_API::getInstance()->getCurrencyList());
$view->defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
- $view->utcTime = Piwik_Date::now()->getDatetime();
+ $view->utcTime = Date::now()->getDatetime();
$excludedIpsGlobal = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
$view->globalExcludedIps = str_replace(',', "\n", $excludedIpsGlobal);
$excludedQueryParametersGlobal = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
@@ -62,7 +64,7 @@ class Piwik_SitesManager_Controller extends Piwik_Controller_Admin
$view->globalSearchKeywordParameters = Piwik_SitesManager_API::getInstance()->getSearchKeywordParametersGlobal();
$view->globalSearchCategoryParameters = Piwik_SitesManager_API::getInstance()->getSearchCategoryParametersGlobal();
- $view->isSearchCategoryTrackingEnabled = PluginsManager::getInstance()->isPluginActivated('CustomVariables');
+ $view->isSearchCategoryTrackingEnabled = \Piwik\PluginsManager::getInstance()->isPluginActivated('CustomVariables');
$view->allowSiteSpecificUserAgentExclude =
Piwik_SitesManager_API::getInstance()->isSiteSpecificUserAgentExcludeEnabled();
@@ -187,7 +189,7 @@ class Piwik_SitesManager_Controller extends Piwik_Controller_Admin
}
}
- Piwik_DataTable_Renderer_Json::sendHeaderJSON();
+ Json::sendHeaderJSON();
print Common::json_encode($results);
}
}
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php
index 8fbad87b00..7b21bbafd1 100644
--- a/plugins/SitesManager/SitesManager.php
+++ b/plugins/SitesManager/SitesManager.php
@@ -9,12 +9,13 @@
* @package Piwik_SitesManager
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_SitesManager
*/
-class Piwik_SitesManager extends Piwik_Plugin
+class Piwik_SitesManager extends Plugin
{
const KEEP_URL_FRAGMENT_USE_DEFAULT = 0;
const KEEP_URL_FRAGMENT_YES = 1;
diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php
index fe84b328cb..ac04dac368 100644
--- a/plugins/Transitions/API.php
+++ b/plugins/Transitions/API.php
@@ -8,10 +8,17 @@
* @category Piwik_Plugins
* @package Piwik_Transitions
*/
+
+use Piwik\ArchiveProcessor;
+use Piwik\DataAccess\LogAggregator;
+use Piwik\DataTable\Manager;
+use Piwik\DataTable\Row;
use Piwik\Metrics;
use Piwik\Period;
+use Piwik\Period\Day;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Segment;
use Piwik\SegmentExpression;
use Piwik\Site;
@@ -72,11 +79,11 @@ class Piwik_Transitions_API
$segment = new Segment($segment, $idSite);
$site = new Site($idSite);
$period = Period::advancedFactory($period, $date);
- $archiveProcessor = new Piwik_ArchiveProcessor_Day($period, $site, $segment);
+ $archiveProcessor = new ArchiveProcessor\Day($period, $site, $segment);
$logAggregator = $archiveProcessor->getLogAggregator();
// prepare the report
$report = array(
- 'date' => Piwik_Period_Day::advancedFactory($period->getLabel(), $date)->getLocalizedShortString()
+ 'date' => Day::advancedFactory($period->getLabel(), $date)->getLocalizedShortString()
);
// add data to the report
@@ -167,7 +174,7 @@ class Piwik_Transitions_API
* Add the internal referrers to the report:
* previous pages and previous site searches
*
- * @param Piwik_DataAccess_LogAggregator $logAggregator
+ * @param LogAggregator $logAggregator
* @param $report
* @param $idaction
* @param string $actionType
@@ -193,7 +200,7 @@ class Piwik_Transitions_API
* Add the following actions to the report:
* following pages, downloads, outlinks
*
- * @param Piwik_DataAccess_LogAggregator $logAggregator
+ * @param LogAggregator $logAggregator
* @param $report
* @param $idaction
* @param string $actionType
@@ -218,12 +225,12 @@ class Piwik_Transitions_API
*
* @param $idaction
* @param $actionType
- * @param Piwik_DataAccess_LogAggregator $logAggregator
+ * @param LogAggregator $logAggregator
* @param $limitBeforeGrouping
* @param $includeLoops
- * @return array(followingPages:Piwik_DataTable, outlinks:Piwik_DataTable, downloads:Piwik_DataTable)
+ * @return array(followingPages:DataTable, outlinks:DataTable, downloads:DataTable)
*/
- public function queryFollowingActions($idaction, $actionType, Piwik_DataAccess_LogAggregator $logAggregator,
+ public function queryFollowingActions($idaction, $actionType, LogAggregator $logAggregator,
$limitBeforeGrouping = false, $includeLoops = false)
{
$types = array();
@@ -296,12 +303,12 @@ class Piwik_Transitions_API
$this->totalTransitionsToFollowingActions = 0;
$dataTables = array();
foreach ($types as $type => $recordName) {
- $dataTable = new Piwik_DataTable;
+ $dataTable = new DataTable;
if (isset($data[$type])) {
foreach ($data[$type] as &$record) {
$actions = intval($record[Metrics::INDEX_NB_ACTIONS]);
- $dataTable->addRow(new Piwik_DataTable_Row(array(
- Piwik_DataTable_Row::COLUMNS => array(
+ $dataTable->addRow(new Row(array(
+ Row::COLUMNS => array(
'label' => $this->getPageLabel($record, $isTitle),
Metrics::INDEX_NB_ACTIONS => $actions
)
@@ -330,9 +337,9 @@ class Piwik_Transitions_API
*
* @param $idaction
* @param $actionType
- * @param Piwik_ArchiveProcessor_Day $logAggregator
+ * @param Day $logAggregator
* @param $limitBeforeGrouping
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function queryExternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping = false)
{
@@ -395,7 +402,7 @@ class Piwik_Transitions_API
//FIXMEA refactor after integration tests written
$array = new Piwik_DataArray($referrerData, $referrerSubData);
- return Piwik_ArchiveProcessor_Day::getDataTableFromDataArray($array);
+ return Day::getDataTableFromDataArray($array);
}
/**
@@ -403,9 +410,9 @@ class Piwik_Transitions_API
*
* @param $idaction
* @param $actionType
- * @param Piwik_ArchiveProcessor_Day $logAggregator
+ * @param Day $logAggregator
* @param $limitBeforeGrouping
- * @return array(previousPages:Piwik_DataTable, loops:integer)
+ * @return array(previousPages:DataTable, loops:integer)
*/
protected function queryInternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping = false)
{
@@ -451,12 +458,12 @@ class Piwik_Transitions_API
$loops = 0;
$nbPageviews = 0;
- $previousPagesDataTable = new Piwik_DataTable;
+ $previousPagesDataTable = new DataTable;
if (isset($data['result'][1])) {
foreach ($data['result'][1] as &$page) {
$nbActions = intval($page[Metrics::INDEX_NB_ACTIONS]);
- $previousPagesDataTable->addRow(new Piwik_DataTable_Row(array(
- Piwik_DataTable_Row::COLUMNS => array(
+ $previousPagesDataTable->addRow(new Row(array(
+ Row::COLUMNS => array(
'label' => $this->getPageLabel($page, $isTitle),
Metrics::INDEX_NB_ACTIONS => $nbActions
)
@@ -465,12 +472,12 @@ class Piwik_Transitions_API
}
}
- $previousSearchesDataTable = new Piwik_DataTable;
+ $previousSearchesDataTable = new DataTable;
if (isset($data['result'][2])) {
foreach ($data['result'][2] as &$search) {
$nbActions = intval($search[Metrics::INDEX_NB_ACTIONS]);
- $previousSearchesDataTable->addRow(new Piwik_DataTable_Row(array(
- Piwik_DataTable_Row::COLUMNS => array(
+ $previousSearchesDataTable->addRow(new Row(array(
+ Row::COLUMNS => array(
'label' => $search['name'],
Metrics::INDEX_NB_ACTIONS => $nbActions
)
@@ -542,7 +549,7 @@ class Piwik_Transitions_API
* Add the external referrers to the report:
* direct entries, websites, campaigns, search engines
*
- * @param Piwik_DataAccess_LogAggregator $logAggregator
+ * @param LogAggregator $logAggregator
* @param $report
* @param $idaction
* @param string $actionType
@@ -563,7 +570,7 @@ class Piwik_Transitions_API
// load details (i.e. subtables)
$details = array();
if ($idSubTable = $row->getIdSubDataTable()) {
- $subTable = Piwik_DataTable_Manager::getInstance()->getTable($idSubTable);
+ $subTable = Manager::getInstance()->getTable($idSubTable);
foreach ($subTable->getRows() as $subRow) {
$details[] = array(
'label' => $subRow->getColumn('label'),
diff --git a/plugins/Transitions/Transitions.php b/plugins/Transitions/Transitions.php
index 90d1ff2839..b47db2e436 100644
--- a/plugins/Transitions/Transitions.php
+++ b/plugins/Transitions/Transitions.php
@@ -8,11 +8,12 @@
* @category Piwik_Plugins
* @package Piwik_Transitions
*/
+use Piwik\Plugin;
/**
* @package Piwik_Transitions
*/
-class Piwik_Transitions extends Piwik_Plugin
+class Piwik_Transitions extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
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;
}
diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php
index 50b2986ae1..f9f52e8233 100644
--- a/plugins/UserCountryMap/Controller.php
+++ b/plugins/UserCountryMap/Controller.php
@@ -11,6 +11,7 @@
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Site;
+use Piwik\Config;
/**
*
@@ -163,7 +164,7 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller
private function checkUserCountryPluginEnabled()
{
- if (!PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
+ if (!\Piwik\PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
throw new Exception(Piwik_Translate('General_Required', 'Plugin UserCountry'));
}
}
diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php
index 0b3d3298f4..1659288d1c 100644
--- a/plugins/UserCountryMap/UserCountryMap.php
+++ b/plugins/UserCountryMap/UserCountryMap.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_UserCountryMap
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_UserCountryMap
*/
-class Piwik_UserCountryMap extends Piwik_Plugin
+class Piwik_UserCountryMap extends Plugin
{
/**
* @see Piwik_Plugin::getInformation
diff --git a/plugins/UserSettings/API.php b/plugins/UserSettings/API.php
index 7a9f5b6dda..c1c5535c1c 100644
--- a/plugins/UserSettings/API.php
+++ b/plugins/UserSettings/API.php
@@ -11,6 +11,7 @@
use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* @see plugins/UserSettings/functions.php
@@ -111,7 +112,7 @@ class Piwik_UserSettings_API
);
$dataTables = array($dataTable);
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getArray();
}
foreach ($dataTables AS $table) {
@@ -180,7 +181,7 @@ class Piwik_UserSettings_API
$visitsSums = $archive->getDataTableFromNumeric('nb_visits');
// check whether given tables are arrays
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
$tableArray = $dataTable->getArray();
$browserTypesArray = $browserTypes->getArray();
$visitSumsArray = $visitsSums->getArray();
diff --git a/plugins/UserSettings/Archiver.php b/plugins/UserSettings/Archiver.php
index 0c53938257..40f6b94eb3 100644
--- a/plugins/UserSettings/Archiver.php
+++ b/plugins/UserSettings/Archiver.php
@@ -10,11 +10,14 @@
*/
use Piwik\Common;
+use Piwik\DataAccess\LogAggregator;
use Piwik\Metrics;
+use Piwik\DataTable;
+use Piwik\PluginsArchiver;
require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php';
-class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver
+class Piwik_UserSettings_Archiver extends PluginsArchiver
{
const LANGUAGE_RECORD_NAME = 'UserSettings_language';
const PLUGIN_RECORD_NAME = 'UserSettings_plugin';
@@ -69,7 +72,7 @@ class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver
return $tableBrowser;
}
- protected function aggregateByBrowserType(Piwik_DataTable $tableBrowser)
+ protected function aggregateByBrowserType(DataTable $tableBrowser)
{
$tableBrowser->filter('GroupBy', array('label', 'Piwik_getBrowserFamily'));
$this->insertTable(self::BROWSER_TYPE_RECORD_NAME, $tableBrowser);
@@ -90,7 +93,7 @@ class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver
return $table;
}
- protected function aggregateByScreenType(Piwik_DataTable $resolutions)
+ protected function aggregateByScreenType(DataTable $resolutions)
{
$resolutions->filter('GroupBy', array('label', 'Piwik_getScreenTypeFromResolution'));
$this->insertTable(self::SCREEN_TYPE_RECORD_NAME, $resolutions);
@@ -113,8 +116,8 @@ class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver
$query = $this->getLogAggregator()->queryVisitsByDimension(array(), false, $selects, $metrics = array());
$data = $query->fetch();
- $cleanRow = Piwik_DataAccess_LogAggregator::makeArrayOneColumn($data, Metrics::INDEX_NB_VISITS);
- $table = Piwik_DataTable::makeFromIndexedArray($cleanRow);
+ $cleanRow = LogAggregator::makeArrayOneColumn($data, Metrics::INDEX_NB_VISITS);
+ $table = DataTable::makeFromIndexedArray($cleanRow);
$this->insertTable(self::PLUGIN_RECORD_NAME, $table);
}
@@ -132,7 +135,7 @@ class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver
$this->insertTable(self::LANGUAGE_RECORD_NAME, $tableLanguage);
}
- protected function insertTable($recordName, Piwik_DataTable $table)
+ protected function insertTable($recordName, DataTable $table)
{
return $this->getProcessor()->insertBlobRecord($recordName, $table->getSerialized($this->maximumRows, null, Metrics::INDEX_NB_VISITS));
}
diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php
index ad0e5d9316..ce5a37f707 100644
--- a/plugins/UserSettings/UserSettings.php
+++ b/plugins/UserSettings/UserSettings.php
@@ -8,12 +8,14 @@
* @category Piwik_Plugins
* @package Piwik_UserSettings
*/
+use Piwik\ArchiveProcessor;
+use Piwik\Plugin;
/**
*
* @package Piwik_UserSettings
*/
-class Piwik_UserSettings extends Piwik_Plugin
+class Piwik_UserSettings extends Plugin
{
/**
* Mapping between the browser family shortcode and the displayed name
@@ -370,7 +372,7 @@ class Piwik_UserSettings extends Piwik_Plugin
* by Browser, Browser family, etc. Some reports are built from the logs, some reports
* are superset of an existing report (eg. Browser family is built from the Browser report)
*/
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_UserSettings_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -381,7 +383,7 @@ class Piwik_UserSettings extends Piwik_Plugin
/**
* Period archiving: simply sums up daily archives
*/
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_UserSettings_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index 2337d76d63..c4c8dc0806 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -12,6 +12,7 @@ use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Access;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -198,7 +199,7 @@ class Piwik_UsersManager_API
* If a user doesn't have any access to the $idSite ('noaccess'),
* the user will not be in the returned array.
*
- * @param string website ID
+ * @param int website ID
*
* @return array The returned array has the format
* array(
@@ -249,7 +250,7 @@ class Piwik_UsersManager_API
* this website will not be in the returned array.
* If the user doesn't have any access, the returned array will be an empty array.
*
- * @param string User that has to be valid
+ * @param string $userLogin User that has to be valid
*
* @return array The returned array has the format
* array(
@@ -282,7 +283,7 @@ class Piwik_UsersManager_API
/**
* Returns the user information (login, password md5, alias, email, date_registered, etc.)
*
- * @param string the user login
+ * @param string $userLogin the user login
*
* @return array the user information
*/
@@ -302,7 +303,7 @@ class Piwik_UsersManager_API
/**
* Returns the user information (login, password md5, alias, email, date_registered, etc.)
*
- * @param string the user email
+ * @param string $userEmail the user email
*
* @return array the user information
*/
@@ -385,7 +386,7 @@ class Piwik_UsersManager_API
'alias' => $alias,
'email' => $email,
'token_auth' => $token_auth,
- 'date_registered' => Piwik_Date::now()->getDatetime()
+ 'date_registered' => Date::now()->getDatetime()
)
);
@@ -629,7 +630,7 @@ class Piwik_UsersManager_API
* Delete a user given its login.
* The user's access are not deleted.
*
- * @param string the user login.
+ * @param string $userLogin the user login.
*
*/
private function deleteUserOnly($userLogin)
@@ -645,8 +646,8 @@ class Piwik_UsersManager_API
* Delete the user access for the given websites.
* The array of idsite must be either null OR the values must have been checked before for their validity!
*
- * @param string the user login
- * @param array array of idsites on which to delete the access. If null then delete all the access for this user.
+ * @param string $userLogin the user login
+ * @param array $idSites array of idsites on which to delete the access. If null then delete all the access for this user.
*
* @return bool true on success
*/
diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php
index 29f567757c..506c6e6acc 100644
--- a/plugins/UsersManager/Controller.php
+++ b/plugins/UsersManager/Controller.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Config;
use Piwik\Site;
/**
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php
index 58f585da67..8d2aeb7a57 100644
--- a/plugins/UsersManager/UsersManager.php
+++ b/plugins/UsersManager/UsersManager.php
@@ -9,13 +9,14 @@
* @package Piwik_UsersManager
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
* Manage Piwik users
*
* @package Piwik_UsersManager
*/
-class Piwik_UsersManager extends Piwik_Plugin
+class Piwik_UsersManager extends Plugin
{
const PASSWORD_MIN_LENGTH = 6;
const PASSWORD_MAX_LENGTH = 26;
@@ -100,7 +101,7 @@ class Piwik_UsersManager extends Piwik_Plugin
/**
* Returns true if the password is complex enough (at least 6 characters and max 26 characters)
*
- * @param string email
+ * @param $input string
* @return bool
*/
public static function isValidPasswordString($input)
diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php
index ee0def21d1..ee5c0ecd2a 100644
--- a/plugins/VisitFrequency/VisitFrequency.php
+++ b/plugins/VisitFrequency/VisitFrequency.php
@@ -8,12 +8,13 @@
* @category Piwik_Plugins
* @package Piwik_VisitFrequency
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_VisitFrequency
*/
-class Piwik_VisitFrequency extends Piwik_Plugin
+class Piwik_VisitFrequency extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php
index 9075c65532..186c378f83 100644
--- a/plugins/VisitTime/API.php
+++ b/plugins/VisitTime/API.php
@@ -12,6 +12,8 @@ use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Period;
use Piwik\Piwik;
+use Piwik\Date;
+use Piwik\DataTable;
use Piwik\Site;
/**
@@ -64,7 +66,7 @@ class Piwik_VisitTime_API
* @param string $date The start date of the period. Cannot refer to multiple dates.
* @param bool|string $segment The segment.
* @throws Exception
- * @return Piwik_DataTable
+ * @return DataTable
*/
public function getByDayOfWeek($idSite, $period, $date, $segment = false)
{
@@ -105,7 +107,7 @@ class Piwik_VisitTime_API
foreach (array(1, 2, 3, 4, 5, 6, 7) as $day) {
$rows[] = array('label' => $day, 'nb_visits' => 0);
}
- $result = new Piwik_DataTable();
+ $result = new DataTable();
$result->addRowsFromSimpleArray($rows);
$result->addDataTable($dataTable);
@@ -128,9 +130,9 @@ class Piwik_VisitTime_API
if ($period == 'day'
&& ($date == 'today'
- || $date == Piwik_Date::factory('now', $site->getTimezone())->toString())
+ || $date == Date::factory('now', $site->getTimezone())->toString())
) {
- $currentHour = Piwik_Date::factory('now', $site->getTimezone())->toString('G');
+ $currentHour = Date::factory('now', $site->getTimezone())->toString('G');
// If no data for today, this is an exception to the API output rule, as we normally return nothing:
// we shall return all hours of the day, with nb_visits = 0
if ($table->getRowsCount() == 0) {
@@ -160,7 +162,7 @@ function Piwik_getTimeLabel($label)
/**
* Returns the day of the week for a date string, without creating a new
- * Piwik_Date instance.
+ * Date instance.
*
* @param string $dateStr
* @return int The day of the week (1-7)
diff --git a/plugins/VisitTime/Archiver.php b/plugins/VisitTime/Archiver.php
index b695ba4558..fd6c1dcc8b 100644
--- a/plugins/VisitTime/Archiver.php
+++ b/plugins/VisitTime/Archiver.php
@@ -9,7 +9,10 @@
* @package Piwik_VisitTime
*/
-class Piwik_VisitTime_Archiver extends Piwik_PluginsArchiver
+use Piwik\Date;
+use Piwik\PluginsArchiver;
+
+class Piwik_VisitTime_Archiver extends PluginsArchiver
{
const SERVER_TIME_RECORD_NAME = 'VisitTime_serverTime';
const LOCAL_TIME_RECORD_NAME = 'VisitTime_localTime';
@@ -46,13 +49,13 @@ class Piwik_VisitTime_Archiver extends Piwik_PluginsArchiver
protected function convertTimeToLocalTimezone(Piwik_DataArray &$array)
{
- $date = Piwik_Date::factory($this->getProcessor()->getDateStart()->getDateStartUTC())->toString();
+ $date = Date::factory($this->getProcessor()->getDateStart()->getDateStartUTC())->toString();
$timezone = $this->getProcessor()->getSite()->getTimezone();
$converted = array();
foreach ($array->getDataArray() as $hour => $stats) {
$datetime = $date . ' ' . $hour . ':00:00';
- $hourInTz = (int)Piwik_Date::factory($datetime, $timezone)->toString('H');
+ $hourInTz = (int)Date::factory($datetime, $timezone)->toString('H');
$converted[$hourInTz] = $stats;
}
return new Piwik_DataArray($converted);
diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php
index abd69f7809..4d73dd8ae0 100644
--- a/plugins/VisitTime/VisitTime.php
+++ b/plugins/VisitTime/VisitTime.php
@@ -8,15 +8,17 @@
* @category Piwik_Plugins
* @package Piwik_VisitTime
*/
+use Piwik\ArchiveProcessor;
use Piwik\Common;
use Piwik\Period;
+use Piwik\Plugin;
use Piwik\Site;
/**
*
* @package Piwik_VisitTime
*/
-class Piwik_VisitTime extends Piwik_Plugin
+class Piwik_VisitTime extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -167,7 +169,7 @@ class Piwik_VisitTime extends Piwik_Plugin
}
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_VisitTime_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -176,7 +178,7 @@ class Piwik_VisitTime extends Piwik_Plugin
}
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_VisitTime_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/VisitorGenerator/Controller.php b/plugins/VisitorGenerator/Controller.php
index de621bc6ea..1a4f9facd0 100644
--- a/plugins/VisitorGenerator/Controller.php
+++ b/plugins/VisitorGenerator/Controller.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_VisitorGenerator
*/
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Site;
/**
@@ -78,7 +80,7 @@ class Piwik_VisitorGenerator_Controller extends Piwik_Controller_Admin
$api = Piwik_CoreAdminHome_API::getInstance();
$api->invalidateArchivedReports($idSite, implode($dates, ","));
- $browserArchiving = Piwik_ArchiveProcessor_Rules::isBrowserTriggerEnabled();
+ $browserArchiving = Rules::isBrowserTriggerEnabled();
// Init view
$view = new Piwik_View('@VisitorGenerator/generate');
@@ -126,7 +128,7 @@ class Piwik_VisitorGenerator_Controller extends Piwik_Controller_Admin
$start = strpos($url, 'piwik.php?') + strlen('piwik.php?');
$url = substr($url, $start, strrpos($url, " ") - $start);
- $datetime = $date . " " . Piwik_Date::factory($time)->toString("H:i:s");
+ $datetime = $date . " " . Date::factory($time)->toString("H:i:s");
$ip = strlen($ip) < 10 ? "13.5.111.3" : $ip;
// Force date/ip & authenticate
diff --git a/plugins/VisitorGenerator/VisitorGenerator.php b/plugins/VisitorGenerator/VisitorGenerator.php
index 7423f3a900..9ad4fa3d66 100644
--- a/plugins/VisitorGenerator/VisitorGenerator.php
+++ b/plugins/VisitorGenerator/VisitorGenerator.php
@@ -9,12 +9,13 @@
* @package Piwik_VisitorGenerator
*/
use Piwik\Piwik;
+use Piwik\Plugin;
/**
*
* @package Piwik_VisitorGenerator
*/
-class Piwik_VisitorGenerator extends Piwik_Plugin
+class Piwik_VisitorGenerator extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php
index f93abbcb34..55474318db 100644
--- a/plugins/VisitorInterest/API.php
+++ b/plugins/VisitorInterest/API.php
@@ -11,6 +11,7 @@
use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
+use Piwik\DataTable;
/**
* VisitorInterest API lets you access two Visitor Engagement reports: number of visits per number of pages,
@@ -68,7 +69,7 @@ class Piwik_VisitorInterest_API
* @param string $period The period type.
* @param string $date The date type.
* @param string|bool $segment The segment.
- * @return Piwik_DataTable the archived report data.
+ * @return DataTable the archived report data.
*/
public function getNumberOfVisitsByDaysSinceLast($idSite, $period, $date, $segment = false)
{
@@ -89,7 +90,7 @@ class Piwik_VisitorInterest_API
* @param string $period The period type.
* @param string $date The date type.
* @param string|bool $segment The segment.
- * @return Piwik_DataTable the archived report data.
+ * @return DataTable the archived report data.
*/
public function getNumberOfVisitsByVisitCount($idSite, $period, $date, $segment = false)
{
@@ -110,11 +111,11 @@ class Piwik_VisitorInterest_API
* regardless of whether the data table is an data table array or just
* a data table.
*
- * @param Piwik_DataTable $dataTable The data table to modify.
+ * @param DataTable $dataTable The data table to modify.
*/
private static function addVisitsPercentColumn($dataTable)
{
- if ($dataTable instanceof Piwik_DataTable_Array) {
+ if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getArray() as $table) {
self::addVisitsPercentColumn($table);
}
diff --git a/plugins/VisitorInterest/Archiver.php b/plugins/VisitorInterest/Archiver.php
index 4c38bf1a7f..18449cbf4c 100644
--- a/plugins/VisitorInterest/Archiver.php
+++ b/plugins/VisitorInterest/Archiver.php
@@ -9,9 +9,12 @@
* @package Piwik_VisitorInterest
*/
+use Piwik\DataAccess\LogAggregator;
use Piwik\Metrics;
+use Piwik\DataTable;
+use Piwik\PluginsArchiver;
-class Piwik_VisitorInterest_Archiver extends Piwik_PluginsArchiver
+class Piwik_VisitorInterest_Archiver extends PluginsArchiver
{
// third element is unit (s for seconds, default is munutes)
const TIME_SPENT_RECORD_NAME = 'VisitorInterest_timeGap';
@@ -103,14 +106,14 @@ class Piwik_VisitorInterest_Archiver extends Piwik_PluginsArchiver
);
$selects = array();
foreach($aggregatesMetadata as $aggregateMetadata) {
- $selectsFromRangedColumn = Piwik_DataAccess_LogAggregator::getSelectsFromRangedColumn($aggregateMetadata);
+ $selectsFromRangedColumn = LogAggregator::getSelectsFromRangedColumn($aggregateMetadata);
$selects = array_merge( $selects, $selectsFromRangedColumn);
}
$query = $this->getLogAggregator()->queryVisitsByDimension(array(), $where = false, $selects, array());
$row = $query->fetch();
foreach($prefixes as $recordName => $selectAsPrefix) {
- $cleanRow = Piwik_DataAccess_LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_VISITS, $selectAsPrefix);
- $dataTable = Piwik_DataTable::makeFromIndexedArray($cleanRow);
+ $cleanRow = LogAggregator::makeArrayOneColumn($row, Metrics::INDEX_NB_VISITS, $selectAsPrefix);
+ $dataTable = DataTable::makeFromIndexedArray($cleanRow);
$this->getProcessor()->insertBlobRecord($recordName, $dataTable->getSerialized());
}
}
diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php
index 10231517e1..a503253e1c 100644
--- a/plugins/VisitorInterest/VisitorInterest.php
+++ b/plugins/VisitorInterest/VisitorInterest.php
@@ -8,12 +8,14 @@
* @category Piwik_Plugins
* @package Piwik_VisitorInterest
*/
+use Piwik\ArchiveProcessor;
+use Piwik\Plugin;
/**
*
* @package Piwik_VisitorInterest
*/
-class Piwik_VisitorInterest extends Piwik_Plugin
+class Piwik_VisitorInterest extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
@@ -111,7 +113,7 @@ class Piwik_VisitorInterest extends Piwik_Plugin
Piwik_AddAction('template_footerVisitsFrequency', array('Piwik_VisitorInterest', 'footerVisitsFrequency'));
}
- public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
+ public function archivePeriod(ArchiveProcessor\Period $archiveProcessor)
{
$archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
@@ -119,7 +121,7 @@ class Piwik_VisitorInterest extends Piwik_Plugin
}
}
- public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
+ public function archiveDay(ArchiveProcessor\Day $archiveProcessor)
{
$archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
diff --git a/plugins/VisitsSummary/API.php b/plugins/VisitsSummary/API.php
index db4355203c..7dbabcf6d9 100644
--- a/plugins/VisitsSummary/API.php
+++ b/plugins/VisitsSummary/API.php
@@ -161,7 +161,7 @@ class Piwik_VisitsSummary_API
$table = $this->getSumVisitsLength($idSite, $period, $date, $segment);
if (is_object($table)) {
$table->filter('ColumnCallbackReplace',
- array('sum_visit_length', array('Piwik', 'getPrettyTimeFromSeconds')));
+ array('sum_visit_length', '\Piwik\Piwik::getPrettyTimeFromSeconds'));
} else {
$table = Piwik::getPrettyTimeFromSeconds($table);
}
diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php
index 493acaab16..bc30a1e6aa 100644
--- a/plugins/VisitsSummary/Controller.php
+++ b/plugins/VisitsSummary/Controller.php
@@ -8,8 +8,10 @@
* @category Piwik_Plugins
* @package Piwik_VisitsSummary
*/
+use Piwik\DataTable\Row;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Site;
/**
@@ -98,7 +100,7 @@ class Piwik_VisitsSummary_Controller extends Piwik_Controller
"&disable_generic_filters=1";
$request = new Piwik_API_Request($requestString);
$result = $request->process();
- return empty($result) ? new Piwik_DataTable() : $result;
+ return empty($result) ? new DataTable() : $result;
}
static public function getVisits()
@@ -130,11 +132,11 @@ class Piwik_VisitsSummary_Controller extends Piwik_Controller
$view->displaySiteSearch = $displaySiteSearch;
$dataTableVisit = self::getVisitsSummary();
- $dataRow = $dataTableVisit->getRowsCount() == 0 ? new Piwik_DataTable_Row() : $dataTableVisit->getFirstRow();
+ $dataRow = $dataTableVisit->getRowsCount() == 0 ? new Row() : $dataTableVisit->getFirstRow();
$dataTableActions = Piwik_Actions_API::getInstance()->get($idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), Piwik_ViewDataTable::getRawSegmentFromRequest());
$dataActionsRow =
- $dataTableActions->getRowsCount() == 0 ? new Piwik_DataTable_Row() : $dataTableActions->getFirstRow();
+ $dataTableActions->getRowsCount() == 0 ? new Row() : $dataTableActions->getFirstRow();
$view->nbUniqVisitors = (int)$dataRow->getColumn('nb_uniq_visitors');
$nbVisits = (int)$dataRow->getColumn('nb_visits');
diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php
index daf509753c..fec9352492 100644
--- a/plugins/VisitsSummary/VisitsSummary.php
+++ b/plugins/VisitsSummary/VisitsSummary.php
@@ -8,16 +8,17 @@
* @category Piwik_Plugins
* @package Piwik_VisitsSummary
*/
+use Piwik\Plugin;
/**
* Note: This plugin does not hook on Daily and Period Archiving like other Plugins because it reports the
* very core metrics (visits, actions, visit duration, etc.) which are processed in the Core
- * Piwik_ArchiveProcessor_Day class directly.
+ * Day class directly.
* These metrics can be used by other Plugins so they need to be processed up front.
*
* @package Piwik_VisitsSummary
*/
-class Piwik_VisitsSummary extends Piwik_Plugin
+class Piwik_VisitsSummary extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
diff --git a/plugins/Widgetize/Widgetize.php b/plugins/Widgetize/Widgetize.php
index 62fae7ab4a..7bf8cdb7c1 100644
--- a/plugins/Widgetize/Widgetize.php
+++ b/plugins/Widgetize/Widgetize.php
@@ -9,12 +9,13 @@
* @category Piwik_Plugins
* @package Piwik_Widgetize
*/
+use Piwik\Plugin;
/**
*
* @package Piwik_Widgetize
*/
-class Piwik_Widgetize extends Piwik_Plugin
+class Piwik_Widgetize extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered