diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-07-21 12:01:35 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-07-21 12:01:36 +0400 |
commit | aca8ec33a85e0a70b818b6227145041717d7a69e (patch) | |
tree | 41377e3a9737d63222522ef93ecf8483f3faddfa /plugins/Referers | |
parent | 0a63210e3eae7562af1a3dbee340eb1ee140db3d (diff) |
Refs #4059 Work in progress: Conversion to use Namespaces: Period*, Metrics, Segment, SegmentExpression, PluginsManager.
Removed some deprecated code.
Diffstat (limited to 'plugins/Referers')
-rw-r--r-- | plugins/Referers/API.php | 45 | ||||
-rw-r--r-- | plugins/Referers/Archiver.php | 3 | ||||
-rw-r--r-- | plugins/Referers/Controller.php | 4 | ||||
-rw-r--r-- | plugins/Referers/Referers.php | 8 |
4 files changed, 33 insertions, 27 deletions
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()) { |