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
path: root/core
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-07-20 10:55:54 +0400
committermattab <matthieu.aubry@gmail.com>2013-07-20 10:55:54 +0400
commit7ca35544d15cdb41b17283e693c8a14777c923ad (patch)
tree7f2fea58e44ed81147da163874060200f750fa44 /core
parent66536db9562185ba7e98ca3ef3a4349ca92b8c45 (diff)
Converting to namespace: Period, Site
Diffstat (limited to 'core')
-rw-r--r--core/Access.php2
-rw-r--r--core/Archive.php14
-rw-r--r--core/Archive/DataCollection.php4
-rw-r--r--core/Archive/DataTableFactory.php7
-rw-r--r--core/Archive/Parameters.php2
-rw-r--r--core/ArchiveProcessor.php12
-rw-r--r--core/ArchiveProcessor/Rules.php4
-rw-r--r--core/Controller.php17
-rw-r--r--core/DataAccess/ArchiveSelector.php6
-rw-r--r--core/DataAccess/ArchiveWriter.php5
-rw-r--r--core/DataAccess/LogAggregator.php5
-rwxr-xr-xcore/DataTable/Filter/CalculateEvolutionFilter.php3
-rw-r--r--core/DataTable/Renderer/Csv.php3
-rw-r--r--core/Period.php46
-rw-r--r--core/Period/Day.php5
-rw-r--r--core/Period/Month.php5
-rw-r--r--core/Period/Range.php11
-rw-r--r--core/Period/Week.php5
-rw-r--r--core/Period/Year.php5
-rw-r--r--core/Piwik.php4
-rw-r--r--core/Site.php7
-rw-r--r--core/ViewDataTable.php6
-rw-r--r--core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php3
-rw-r--r--core/ViewDataTable/HtmlTable/Goals.php3
24 files changed, 109 insertions, 75 deletions
diff --git a/core/Access.php b/core/Access.php
index 931e958567..ab92cf97c1 100644
--- a/core/Access.php
+++ b/core/Access.php
@@ -425,7 +425,7 @@ class Access
$idSites = $this->getSitesIdWithAtLeastViewAccess();
}
- $idSites = \Piwik_Site::getIdSitesFromIdSitesString($idSites);
+ $idSites = \Piwik\Site::getIdSitesFromIdSitesString($idSites);
if (empty($idSites)) {
throw new NoAccessException("The parameter 'idSite=' is missing from the request.");
}
diff --git a/core/Archive.php b/core/Archive.php
index 993390b46d..5ba77c6523 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -122,19 +122,19 @@ class Archive
*/
public static function build($idSites, $period, $strDate, $segment = false, $_restrictSitesToLogin = false)
{
- $websiteIds = Piwik_Site::getIdSitesFromIdSitesString($idSites, $_restrictSitesToLogin);
+ $websiteIds = Site::getIdSitesFromIdSitesString($idSites, $_restrictSitesToLogin);
- if (Piwik_Period::isMultiplePeriod($strDate, $period)) {
+ if (Period::isMultiplePeriod($strDate, $period)) {
$oPeriod = new Piwik_Period_Range($period, $strDate);
$allPeriods = $oPeriod->getSubperiods();
} else {
- $timezone = count($websiteIds) == 1 ? Piwik_Site::getTimezoneFor($websiteIds[0]) : false;
- $oPeriod = Piwik_Period::makePeriodFromQueryParams($timezone, $period, $strDate);
+ $timezone = count($websiteIds) == 1 ? Site::getTimezoneFor($websiteIds[0]) : false;
+ $oPeriod = Period::makePeriodFromQueryParams($timezone, $period, $strDate);
$allPeriods = array($oPeriod);
}
$segment = new Piwik_Segment($segment, $websiteIds);
$idSiteIsAll = $idSites == self::REQUEST_ALL_WEBSITES_FLAG;
- $isMultipleDate = Piwik_Period::isMultiplePeriod($strDate, $period);
+ $isMultipleDate = Period::isMultiplePeriod($strDate, $period);
return Archive::factory($segment, $allPeriods, $websiteIds, $idSiteIsAll, $isMultipleDate);
}
@@ -431,7 +431,7 @@ class Archive
{
$today = Piwik_Date::today();
- /* @var Piwik_Period $period */
+ /* @var Period $period */
foreach ($this->params->getPeriods() as $period) {
$periodStr = $period->getRangeString();
@@ -439,7 +439,7 @@ class Archive
$twoDaysAfterPeriod = $period->getDateEnd()->addDay(2);
foreach ($this->params->getIdSites() as $idSite) {
- $site = new Piwik_Site($idSite);
+ $site = new Site($idSite);
// if the END of the period is BEFORE the website creation date
// we already know there are no stats for this period
diff --git a/core/Archive/DataCollection.php b/core/Archive/DataCollection.php
index 9dc9a38e63..f6b50b485b 100644
--- a/core/Archive/DataCollection.php
+++ b/core/Archive/DataCollection.php
@@ -83,8 +83,8 @@ class Piwik_Archive_DataCollection
* the period's range string. Eg,
*
* array(
- * '2012-01-01,2012-01-31' => new Piwik_Period(...),
- * '2012-02-01,2012-02-28' => new Piwik_Period(...),
+ * '2012-01-01,2012-01-31' => new Period(...),
+ * '2012-02-01,2012-02-28' => new Period(...),
* )
*
* @var array
diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php
index 6bee96d344..0b3cf23743 100644
--- a/core/Archive/DataTableFactory.php
+++ b/core/Archive/DataTableFactory.php
@@ -9,6 +9,7 @@
* @package Piwik
*/
+use Piwik\Site;
const FIX_ME_OMG = 'this is a warning and reminder to fix this code ';
/**
@@ -352,14 +353,14 @@ class Piwik_Archive_DataTableFactory
}
/**
- * Converts site IDs and period string ranges into Piwik_Site instances and
- * Piwik_Period instances in DataTable metadata.
+ * Converts site IDs and period string ranges into Site instances and
+ * Period instances in DataTable metadata.
*/
private function transformMetadata($table)
{
$periods = $this->periods;
$table->filter(function ($table) use($periods) {
- $table->metadata['site'] = new Piwik_Site($table->metadata['site']);
+ $table->metadata['site'] = new Site($table->metadata['site']);
$table->metadata['period'] = empty($periods[$table->metadata['period']])
? FIX_ME_OMG
: $periods[$table->metadata['period']];
diff --git a/core/Archive/Parameters.php b/core/Archive/Parameters.php
index 51b0a9e454..0db74b0a58 100644
--- a/core/Archive/Parameters.php
+++ b/core/Archive/Parameters.php
@@ -10,7 +10,7 @@ class Piwik_Archive_Parameters
private $idSites = array();
/**
- * The list of Piwik_Period's to query archive data for.
+ * The list of Period's to query archive data for.
*
* @var array
*/
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index bcbfcc1de2..42185a219b 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -9,7 +9,9 @@
* @package Piwik
*/
use Piwik\Config;
+use Piwik\Period;
use Piwik\Piwik;
+use Piwik\Site;
/**
* The ArchiveProcessor class is used by the Archive object to make sure the given Archive is processed and available in the DB.
@@ -80,12 +82,12 @@ abstract class Piwik_ArchiveProcessor
* Site of the current archive
* Can be accessed by plugins (that is why it's public)
*
- * @var Piwik_Site
+ * @var Site
*/
private $site = null;
/**
- * @var Piwik_Period
+ * @var Period
*/
private $period = null;
@@ -94,7 +96,7 @@ abstract class Piwik_ArchiveProcessor
*/
private $segment = null;
- public function __construct(Piwik_Period $period, Piwik_Site $site, Piwik_Segment $segment)
+ public function __construct(Period $period, Site $site, Piwik_Segment $segment)
{
$this->period = $period;
$this->site = $site;
@@ -114,7 +116,7 @@ abstract class Piwik_ArchiveProcessor
}
/**
- * @return Piwik_Period
+ * @return Period
*/
protected function getPeriod()
{
@@ -122,7 +124,7 @@ abstract class Piwik_ArchiveProcessor
}
/**
- * @return Piwik_Site
+ * @return Site
*/
public function getSite()
{
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index a4ddd03e35..b8b91cd703 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -9,8 +9,10 @@
* @package Piwik
*/
use Piwik\Config;
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Site;
/**
* This class contains Archiving rules/logic which are used in several places
@@ -137,7 +139,7 @@ class Piwik_ArchiveProcessor_Rules
return false;
}
- public static function getMinTimeProcessedForTemporaryArchive(Piwik_Date $dateStart, Piwik_Period $period, Piwik_Segment $segment, Piwik_Site $site)
+ public static function getMinTimeProcessedForTemporaryArchive(Piwik_Date $dateStart, Period $period, Piwik_Segment $segment, Site $site)
{
$now = time();
$minimumArchiveTime = $now - Piwik_ArchiveProcessor_Rules::getTodayArchiveTimeToLive();
diff --git a/core/Controller.php b/core/Controller.php
index 55857f7ce8..06d946ad56 100644
--- a/core/Controller.php
+++ b/core/Controller.php
@@ -9,9 +9,12 @@
* @package Piwik
*/
use Piwik\Config;
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Access;
+use Piwik\Site;
+
/**
* Parent class of all plugins Controllers (located in /plugins/PluginName/Controller.php
@@ -47,7 +50,7 @@ abstract class Piwik_Controller
protected $idSite;
/**
- * @var Piwik_Site
+ * @var Site
*/
protected $site = null;
@@ -66,7 +69,7 @@ abstract class Piwik_Controller
$date = Common::getRequestVar('date', 'yesterday', 'string');
try {
$this->idSite = Common::getRequestVar('idSite', false, 'int');
- $this->site = new Piwik_Site($this->idSite);
+ $this->site = new Site($this->idSite);
$date = $this->getDateParameterInTimezone($date, $this->site->getTimezone());
$this->setDate($date);
} catch (Exception $e) {
@@ -290,7 +293,7 @@ abstract class Piwik_Controller
* @param string $period
* @param string $lastN
* @param string $endDate
- * @param Piwik_Site $site
+ * @param Site $site
* @return string
*/
public static function getDateRangeRelativeToEndDate($period, $lastN, $endDate, $site)
@@ -401,7 +404,7 @@ abstract class Piwik_Controller
$periodStr = Common::getRequestVar('period');
if ($periodStr != 'range') {
$date = Piwik_Date::factory($this->strDate);
- $period = Piwik_Period::factory($periodStr, $date);
+ $period = Period::factory($periodStr, $date);
} else {
$period = new Piwik_Period_Range($periodStr, $rawDate, $this->site->getTimezone());
}
@@ -671,7 +674,7 @@ abstract class Piwik_Controller
/**
* Returns default website that Piwik should load
*
- * @return Piwik_Site
+ * @return Site
*/
protected function getDefaultWebsiteId()
{
@@ -759,7 +762,7 @@ abstract class Piwik_Controller
/**
* Returns pretty date for use in period selector widget.
*
- * @param Piwik_Period $period
+ * @param Period $period
* @return string
*/
public static function getCalendarPrettyDate($period)
@@ -782,7 +785,7 @@ abstract class Piwik_Controller
*/
public static function getPrettyDate($date, $period)
{
- return self::getCalendarPrettyDate(Piwik_Period::factory($period, Piwik_Date::factory($date)));
+ return self::getCalendarPrettyDate(Period::factory($period, Piwik_Date::factory($date)));
}
diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php
index 1eac19955c..54d18596d6 100644
--- a/core/DataAccess/ArchiveSelector.php
+++ b/core/DataAccess/ArchiveSelector.php
@@ -8,8 +8,10 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Site;
/**
* Data Access object used to query archives
@@ -31,7 +33,7 @@ class Piwik_DataAccess_ArchiveSelector
const NB_VISITS_CONVERTED_RECORD_LOOKED_UP = "nb_visits_converted";
- static public function getArchiveIdAndVisits(Piwik_Site $site, Piwik_Period $period, Piwik_Segment $segment, $minDatetimeArchiveProcessedUTC, $requestedPlugin)
+ static public function getArchiveIdAndVisits(Site $site, Period $period, Piwik_Segment $segment, $minDatetimeArchiveProcessedUTC, $requestedPlugin)
{
$dateStart = $period->getDateStart();
$bindSQL = array($site->getId(),
@@ -146,7 +148,7 @@ class Piwik_DataAccess_ArchiveSelector
$monthToPeriods = array();
foreach ($periods as $period) {
- /** @var Piwik_Period $period */
+ /** @var Period $period */
$table = Piwik_DataAccess_ArchiveTableCreator::getNumericTable($period->getDateStart());
$monthToPeriods[$table][] = $period;
}
diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php
index f864af9ae1..bcd14e51c7 100644
--- a/core/DataAccess/ArchiveWriter.php
+++ b/core/DataAccess/ArchiveWriter.php
@@ -9,6 +9,7 @@
* @package Piwik
*/
use Piwik\Config;
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
@@ -30,7 +31,7 @@ class Piwik_DataAccess_ArchiveWriter
'name',
'value');
- public function __construct($idSite, Piwik_Segment $segment, Piwik_Period $period, $requestedPlugin, $isArchiveTemporary)
+ public function __construct($idSite, Piwik_Segment $segment, Period $period, $requestedPlugin, $isArchiveTemporary)
{
$this->idArchive = false;
$this->idSite = $idSite;
@@ -113,7 +114,7 @@ class Piwik_DataAccess_ArchiveWriter
return self::makeLockName($this->idSite, $this->period, $this->segment);
}
- protected static function makeLockName($idsite, Piwik_Period $period, Piwik_Segment $segment)
+ protected static function makeLockName($idsite, Period $period, Piwik_Segment $segment)
{
$config = Config::getInstance();
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index 8be8a516f2..0d51091fc7 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -9,6 +9,7 @@
* @package Piwik
*/
use Piwik\Common;
+use Piwik\Site;
/**
* This class queries the Visitor logs tables (visits, actions, conversions, ecommerce)
@@ -50,13 +51,13 @@ class Piwik_DataAccess_LogAggregator
/** @var \Piwik_Date */
protected $dateEnd;
- /** @var \Piwik_Site */
+ /** @var \Piwik\Site */
protected $site;
/** @var \Piwik_Segment */
protected $segment;
- public function __construct(Piwik_Date $dateStart, Piwik_Date $dateEnd, Piwik_Site $site, Piwik_Segment $segment)
+ public function __construct(Piwik_Date $dateStart, Piwik_Date $dateEnd, Site $site, Piwik_Segment $segment)
{
$this->dateStart = $dateStart;
$this->dateEnd = $dateEnd;
diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php
index f4ad1ea480..e38fb93136 100755
--- a/core/DataTable/Filter/CalculateEvolutionFilter.php
+++ b/core/DataTable/Filter/CalculateEvolutionFilter.php
@@ -8,6 +8,7 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Site;
/**
* A DataTable filter that calculates the evolution of a metric and adds
@@ -66,7 +67,7 @@ class Piwik_DataTable_Filter_CalculateEvolutionFilter extends Piwik_DataTable_Fi
// we don't add the new column
if ($currentValue === false
&& $this->isRevenueEvolution
- && !Piwik_Site::isEcommerceEnabledFor($row->getColumn('label'))
+ && !Site::isEcommerceEnabledFor($row->getColumn('label'))
) {
return false;
}
diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php
index 0e1a3f39d4..77d282f659 100644
--- a/core/DataTable/Renderer/Csv.php
+++ b/core/DataTable/Renderer/Csv.php
@@ -8,6 +8,7 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
@@ -354,7 +355,7 @@ class Piwik_DataTable_Renderer_Csv extends Piwik_DataTable_Renderer
} else if (strpos($date, ',') !== false) {
$period = new Piwik_Period_Range('range', $date);
} else {
- $period = Piwik_Period::factory($period, Piwik_Date::factory($date));
+ $period = Period::factory($period, Piwik_Date::factory($date));
}
$prettyDate = $period->getLocalizedLongString();
diff --git a/core/Period.php b/core/Period.php
index 01705ccbe7..6e74ad4095 100644
--- a/core/Period.php
+++ b/core/Period.php
@@ -8,10 +8,18 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik;
+use Exception;
use Piwik\Piwik;
+use Piwik_Date;
+use Piwik_Period_Day;
+use Piwik_Period_Month;
+use Piwik_Period_Range;
+use Piwik_Period_Week;
+use Piwik_Period_Year;
/**
- * Creating a new Piwik_Period subclass:
+ * Creating a new Period subclass:
*
* Every overloaded method must start with the code
* if(!$this->subperiodsProcessed)
@@ -22,13 +30,13 @@ use Piwik\Piwik;
* This is for performance improvements, computing the subperiods is done a per demand basis.
*
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-abstract class Piwik_Period
+abstract class Period
{
/**
* Array of subperiods
- * @var Piwik_Period[]
+ * @var \Piwik\Period[]
*/
protected $subperiods = array();
protected $subperiodsProcessed = false;
@@ -58,7 +66,7 @@ abstract class Piwik_Period
* @param string $strPeriod "day", "week", "month", "year"
* @param Piwik_Date $date Piwik_Date object
* @throws Exception
- * @return Piwik_Period
+ * @return \Piwik\Period
*/
static public function factory($strPeriod, Piwik_Date $date)
{
@@ -85,7 +93,6 @@ abstract class Piwik_Period
}
}
-
/**
* Indicate if $dateString and $period correspond to multiple periods
*
@@ -108,29 +115,28 @@ abstract class Piwik_Period
* method above. It doesn't require an instance of Piwik_Date and works for
* period=range. Generally speaking, anything that can be passed as period
* and range to the API methods can directly be forwarded to this factory
- * method in order to get a suitable instance of Piwik_Period.
+ * method in order to get a suitable instance of Period.
*
* @param string $strPeriod "day", "week", "month", "year", "range"
* @param string $strDate
- * @return Piwik_Period
+ * @return \Piwik\Period
*/
static public function advancedFactory($strPeriod, $strDate)
{
- if (Piwik_Period::isMultiplePeriod($strDate, $strPeriod) || $strPeriod == 'range') {
+ if (Period::isMultiplePeriod($strDate, $strPeriod) || $strPeriod == 'range') {
return new Piwik_Period_Range($strPeriod, $strDate);
}
- return Piwik_Period::factory($strPeriod, Piwik_Date::factory($strDate));
+ return Period::factory($strPeriod, Piwik_Date::factory($strDate));
}
-
/**
- * Creates a period instance using a Piwik_Site instance and two strings describing
+ * Creates a period instance using a Site instance and two strings describing
* the period & date.
*
* @param string $timezone
* @param string $period The period string: day, week, month, year, range
* @param string $date The date or date range string.
- * @return Piwik_Period
+ * @return \Piwik\Period
*/
public static function makePeriodFromQueryParams($timezone, $period, $date)
{
@@ -144,12 +150,12 @@ abstract class Piwik_Period
if (!($date instanceof Piwik_Date)) {
if ($date == 'now' || $date == 'today') {
$date = date('Y-m-d', Piwik_Date::factory('now', $timezone)->getTimestamp());
- } elseif ($date == 'yesterday' || $date == 'yesterdaySameTime' ) {
+ } elseif ($date == 'yesterday' || $date == 'yesterdaySameTime') {
$date = date('Y-m-d', Piwik_Date::factory('now', $timezone)->subDay(1)->getTimestamp());
}
- $date = Piwik_Date::factory( $date );
+ $date = Piwik_Date::factory($date);
}
- $oPeriod = Piwik_Period::factory($period, $date);
+ $oPeriod = Period::factory($period, $date);
}
return $oPeriod;
}
@@ -255,7 +261,7 @@ abstract class Piwik_Period
* Returns Period_Day for a period made of days (week, month),
* Period_Month for a period made of months (year)
*
- * @return array Piwik_Period
+ * @return array Period
*/
public function getSubperiods()
{
@@ -270,7 +276,7 @@ abstract class Piwik_Period
*
* Protected because it not yet supported to add periods after the initialization
*
- * @param Piwik_Period $period Valid Piwik_Period object
+ * @param \Piwik\Period $period Valid Period object
*/
protected function addSubperiod($period)
{
@@ -315,9 +321,9 @@ abstract class Piwik_Period
abstract public function getLocalizedShortString();
abstract public function getLocalizedLongString();
-
+
public function getRangeString()
{
- return $this->getDateStart()->toString("Y-m-d").",".$this->getDateEnd()->toString("Y-m-d");
+ return $this->getDateStart()->toString("Y-m-d") . "," . $this->getDateEnd()->toString("Y-m-d");
}
}
diff --git a/core/Period/Day.php b/core/Period/Day.php
index 14cdd16bd7..198662dbe7 100644
--- a/core/Period/Day.php
+++ b/core/Period/Day.php
@@ -8,12 +8,13 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
/**
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-class Piwik_Period_Day extends Piwik_Period
+class Piwik_Period_Day extends Period
{
protected $label = 'day';
diff --git a/core/Period/Month.php b/core/Period/Month.php
index fdb8a78dbc..c65bc4179e 100644
--- a/core/Period/Month.php
+++ b/core/Period/Month.php
@@ -8,12 +8,13 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
/**
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-class Piwik_Period_Month extends Piwik_Period
+class Piwik_Period_Month extends Period
{
protected $label = 'month';
diff --git a/core/Period/Range.php b/core/Period/Range.php
index f69a0d304e..e8020ad875 100644
--- a/core/Period/Range.php
+++ b/core/Period/Range.php
@@ -9,14 +9,15 @@
* @package Piwik
*/
use Piwik\Common;
+use Piwik\Period;
/**
* from a starting date to an ending date
*
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-class Piwik_Period_Range extends Piwik_Period
+class Piwik_Period_Range extends Period
{
protected $label = 'range';
@@ -328,14 +329,14 @@ class Piwik_Period_Range extends Piwik_Period
protected function fillArraySubPeriods($startDate, $endDate, $period)
{
$arrayPeriods = array();
- $endSubperiod = Piwik_Period::factory($period, $endDate);
+ $endSubperiod = Period::factory($period, $endDate);
$arrayPeriods[] = $endSubperiod;
// set end date to start of end period since we're comparing against start date.
$endDate = $endSubperiod->getDateStart();
while ($endDate->isLater($startDate)) {
$endDate = self::removePeriod($period, $endDate, 1);
- $subPeriod = Piwik_Period::factory($period, $endDate);
+ $subPeriod = Period::factory($period, $endDate);
$arrayPeriods[] = $subPeriod;
}
$arrayPeriods = array_reverse($arrayPeriods);
@@ -351,7 +352,7 @@ class Piwik_Period_Range extends Piwik_Period
* @param bool|string $period The period to use (either 'day', 'week', 'month', 'year');
*
* @return array An array with two elements, a string for the date before $date and
- * a Piwik_Period instance for the period before $date.
+ * a Period instance for the period before $date.
*/
public static function getLastDate($date = false, $period = false)
{
diff --git a/core/Period/Week.php b/core/Period/Week.php
index 9b84f05b11..1933a0aa5c 100644
--- a/core/Period/Week.php
+++ b/core/Period/Week.php
@@ -8,12 +8,13 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
/**
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-class Piwik_Period_Week extends Piwik_Period
+class Piwik_Period_Week extends Period
{
protected $label = 'week';
diff --git a/core/Period/Year.php b/core/Period/Year.php
index 7ab5efbabe..d83e2ac842 100644
--- a/core/Period/Year.php
+++ b/core/Period/Year.php
@@ -8,12 +8,13 @@
* @category Piwik
* @package Piwik
*/
+use Piwik\Period;
/**
* @package Piwik
- * @subpackage Piwik_Period
+ * @subpackage Period
*/
-class Piwik_Period_Year extends Piwik_Period
+class Piwik_Period_Year extends Period
{
protected $label = 'year';
diff --git a/core/Piwik.php b/core/Piwik.php
index 0e07c888ca..4e87890aa3 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -26,7 +26,7 @@ use Piwik_Log_Message;
use Piwik_Plugin;
use Piwik_PluginsManager;
use Piwik_Session;
-use Piwik_Site;
+use Piwik\Site;
use Piwik_Tracker;
use Piwik_Tracker_Cache;
use Piwik_Tracker_Db;
@@ -1311,7 +1311,7 @@ class Piwik
static public function getCurrency($idSite)
{
$symbols = self::getCurrencyList();
- $site = new Piwik_Site($idSite);
+ $site = new Site($idSite);
$currency = $site->getCurrency();
if (isset($symbols[$currency])) {
return $symbols[$currency][0];
diff --git a/core/Site.php b/core/Site.php
index f341aa7208..da655b9a74 100644
--- a/core/Site.php
+++ b/core/Site.php
@@ -9,11 +9,16 @@
* @package Piwik
*/
+namespace Piwik;
+use Exception;
+use Piwik_Date;
+use Piwik_SitesManager_API;
+
/**
*
* @package Piwik
*/
-class Piwik_Site
+class Site
{
/**
* @var int|null
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index be9770ce6d..05b59f0b29 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -9,8 +9,10 @@
* @package Piwik
*/
use Piwik\Config;
+use Piwik\Period;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Site;
/**
* This class is used to load (from the API) and customize the output of a given DataTable.
@@ -1527,7 +1529,7 @@ abstract class Piwik_ViewDataTable
if ($strPeriod == 'range') {
$idSite = Common::getRequestVar('idSite', '');
if (intval($idSite) != 0) {
- $site = new Piwik_Site($idSite);
+ $site = new Site($idSite);
$timezone = $site->getTimezone();
} else {
$timezone = 'UTC';
@@ -1536,7 +1538,7 @@ abstract class Piwik_ViewDataTable
$period = new Piwik_Period_Range('range', $strDate, $timezone);
$reportDate = $period->getDateStart();
} // if a multiple period, this function is irrelevant
- else if (Piwik_Period::isMultiplePeriod($strDate, $strPeriod)) {
+ else if (Period::isMultiplePeriod($strDate, $strPeriod)) {
return false;
} // otherwise, use the date as given
else {
diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
index 125c1c92ed..9fd005e132 100644
--- a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
+++ b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php
@@ -10,6 +10,7 @@
*/
use Piwik\Common;
+use Piwik\Site;
/**
* Generates HTML embed for the Evolution graph
@@ -132,7 +133,7 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat
$lastNParamName = self::getLastNParamName($period);
$lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int');
- $site = new Piwik_Site(Common::getRequestVar('idSite'));
+ $site = new Site(Common::getRequestVar('idSite'));
$dateRange = Piwik_Controller::getDateRangeRelativeToEndDate($period, 'last' . $lastN, $endDate, $site);
diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php
index dbe8fc8338..4fa4980d72 100644
--- a/core/ViewDataTable/HtmlTable/Goals.php
+++ b/core/ViewDataTable/HtmlTable/Goals.php
@@ -10,6 +10,7 @@
*/
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Site;
/**
* @package Piwik
@@ -114,7 +115,7 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable
'name' => Piwik_Translate('Goals_EcommerceOrder')
);
- $site = new Piwik_Site($idSite);
+ $site = new Site($idSite);
//Case Ecommerce report table
if ($this->isEcommerce) {
$goals = array($ecommerceGoal);