diff options
67 files changed, 472 insertions, 795 deletions
diff --git a/core/Metrics.php b/core/Metrics.php index b2ae4c73e5..03f486653c 100644 --- a/core/Metrics.php +++ b/core/Metrics.php @@ -335,6 +335,7 @@ class Metrics 'nb_hits' => 'General_ColumnPageviewsDocumentation', 'exit_rate' => 'General_ColumnExitRateDocumentation' ); + return array_map(array('\\Piwik\\Piwik','translate'), $documentation); } diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 3c1da594c6..6e9afe423c 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -990,6 +990,10 @@ class Manager extends Singleton foreach (VisitDimension::getDimensions($plugin) as $dimension) { $dimension->install(); } + // todo not sure if this makes sense here + foreach (ActionDimension::getDimensions($plugin) as $dimension) { + $dimension->install(); + } } catch (\Exception $e) { throw new \Piwik\Plugin\PluginException($plugin->getPluginName(), $e->getMessage()); } diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index 1dc6a47985..260c163977 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -114,15 +114,14 @@ class Report protected function getMetrics() { - // TODO not all will be defined there... later in Columns directory $translations = Metrics::getDefaultMetricTranslations(); $metrics = array(); foreach ($this->metrics as $metric) { - if (!empty( $translations[$metric])) { - $metric[$metric] = $translations[$metric]; + if (!empty($translations[$metric])) { + $metrics[$metric] = $translations[$metric]; } else { - $metric[$metric] = 'To be defined'; + $metrics[$metric] = 'To be defined'; } } @@ -131,15 +130,12 @@ class Report protected function getMetricsDocumentation() { - // TODO not all will be defined there... later in Columns directory $translations = Metrics::getDefaultMetricsDocumentation(); $documentation = array(); foreach ($this->metrics as $metric) { if (!empty( $translations[$metric])) { - $metric[$metric] = $translations[$metric]; - } else { - $metric[$metric] = 'To be defined see todo'; + $documentation[$metric] = $translations[$metric]; } } diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 036167de8d..a203c3041c 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -34,11 +34,35 @@ class Actions extends \Piwik\Plugin 'ViewDataTable.configure' => 'configureViewDataTable', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'Insights.addReportToOverview' => 'addReportToInsightsOverview' + 'Insights.addReportToOverview' => 'addReportToInsightsOverview', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' ); return $hooks; } + public function addMetricTranslations(&$translations) + { + $metrics = array( + 'nb_pageviews' => 'General_ColumnPageviews', + 'nb_uniq_pageviews' => 'General_ColumnUniquePageviews', + 'nb_downloads' => 'General_Downloads', + 'nb_uniq_downloads' => 'Actions_ColumnUniqueDownloads', + 'nb_outlinks' => 'General_Outlinks', + 'nb_uniq_outlinks' => 'Actions_ColumnUniqueOutlinks', + 'nb_searches' => 'Actions_ColumnSearches', + 'nb_keywords' => 'Actions_ColumnSiteSearchKeywords', + 'avg_time_generation' => 'General_ColumnAverageGenerationTime', + 'exit_rate' => 'General_ColumnExitRate', + 'entry_nb_visits' => 'General_ColumnEntrances', + 'entry_bounce_count' => 'General_ColumnBounces', + 'exit_nb_visits' => 'General_ColumnExits', + 'nb_pages_per_search' => 'Actions_ColumnPagesPerSearch', + 'nb_hits_following_search' => 'General_ColumnViewedAfterSearch', + ); + + $translations = array_merge($translations, $metrics); + } + public function addReportToInsightsOverview(&$reports) { $reports['Actions_getPageUrls'] = array(); diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index 0b9051d1da..2514067547 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -10,12 +10,9 @@ namespace Piwik\Plugins\CustomVariables; use Piwik\ArchiveProcessor; use Piwik\Piwik; -use Piwik\Plugin\ViewDataTable; use Piwik\Tracker\Cache; use Piwik\Tracker; -/** - */ class CustomVariables extends \Piwik\Plugin { public function getInformation() @@ -30,11 +27,10 @@ class CustomVariables extends \Piwik\Plugin */ public function getListHooksRegistered() { - $hooks = array( + return array( 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata' ); - return $hooks; } public function install() diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 70070bbff5..30fa62bda1 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -86,9 +86,7 @@ class DevicesDetection extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'API.getReportMetadata' => 'getReportMetadata', 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', - 'ViewDataTable.configure' => 'configureViewDataTable', ); } @@ -180,129 +178,4 @@ class DevicesDetection extends \Piwik\Plugin } } - public function getReportMetadata(&$reports) - { - $i = 0; - foreach ($this->getRawMetadataReports() as $report) { - list($category, $name, $apiModule, $apiAction, $columnName) = $report; - if ($category == false) - continue; - - $report = array( - 'category' => Piwik::translate($category), - 'name' => Piwik::translate($name), - 'module' => $apiModule, - 'action' => $apiAction, - 'dimension' => Piwik::translate($columnName), - 'order' => $i++ - ); - - $translation = $name . 'Documentation'; - $translated = Piwik::translate($translation, '<br />'); - if ($translated != $translation) { - $report['documentation'] = $translated; - } - - $reports[] = $report; - } - } - - public function configureViewDataTable(ViewDataTable $view) - { - switch ($view->requestConfig->apiMethodToRequestDataTable) { - case 'DevicesDetection.getType': - $this->configureViewForGetType($view); - break; - case 'DevicesDetection.getBrand': - $this->configureViewForGetBrand($view); - break; - case 'DevicesDetection.getModel': - $this->configureViewForGetModel($view); - break; - case 'DevicesDetection.getOsFamilies': - $this->configureViewForGetOsFamilies($view); - break; - case 'DevicesDetection.getOsVersions': - $this->configureViewForGetOsVersions($view); - break; - case 'DevicesDetection.getBrowserFamilies': - $this->configureViewForGetBrowserFamilies($view); - break; - case 'DevicesDetection.getBrowserVersions': - $this->configureViewForGetBrowserVersions($view); - break; - } - } - - private function configureViewForGetType(ViewDataTable $view) - { - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelTypes")); - } - - private function configureViewForGetBrand(ViewDataTable $view) - { - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelBrands")); - } - - private function configureViewForGetModel(ViewDataTable $view) - { - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelModels")); - } - - private function configureViewForGetOsFamilies(ViewDataTable $view) - { - $view->config->title = Piwik::translate('DevicesDetection_OperatingSystemFamilies'); - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("UserSettings_OperatingSystemFamily")); - $view->config->addRelatedReports($this->getOsRelatedReports()); - } - - private function configureViewForGetOsVersions(ViewDataTable $view) - { - $view->config->title = Piwik::translate('DevicesDetection_OperatingSystemVersions'); - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelSystemVersion")); - $view->config->addRelatedReports($this->getOsRelatedReports()); - } - - private function configureViewForGetBrowserFamilies(ViewDataTable $view) - { - $view->config->title = Piwik::translate('UserSettings_BrowserFamilies'); - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelBrowserFamily")); - $view->config->addRelatedReports($this->getBrowserRelatedReports()); - } - - private function configureViewForGetBrowserVersions(ViewDataTable $view) - { - $view->config->show_search = false; - $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate("UserSettings_ColumnBrowserVersion")); - $view->config->addRelatedReports($this->getBrowserRelatedReports()); - } - - private function getOsRelatedReports() - { - return array( - 'DevicesDetection.getOsFamilies' => Piwik::translate('DevicesDetection_OperatingSystemFamilies'), - 'DevicesDetection.getOsVersions' => Piwik::translate('DevicesDetection_OperatingSystemVersions') - ); - } - - private function getBrowserRelatedReports() - { - return array( - 'DevicesDetection.getBrowserFamilies' => Piwik::translate('UserSettings_BrowserFamilies'), - 'DevicesDetection.getBrowserVersions' => Piwik::translate('DevicesDetection_BrowserVersions') - ); - } } diff --git a/plugins/DevicesDetection/Reports/Base.php b/plugins/DevicesDetection/Reports/Base.php new file mode 100644 index 0000000000..9a178bb62c --- /dev/null +++ b/plugins/DevicesDetection/Reports/Base.php @@ -0,0 +1,35 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; + +abstract class Base extends \Piwik\Plugin\Report +{ + protected function init() + { + $this->category = 'DevicesDetection_DevicesDetection'; + } + + protected function getOsRelatedReports() + { + return array( + 'DevicesDetection.getOsFamilies' => Piwik::translate('DevicesDetection_OperatingSystemFamilies'), + 'DevicesDetection.getOsVersions' => Piwik::translate('DevicesDetection_OperatingSystemVersions') + ); + } + + protected function getBrowserRelatedReports() + { + return array( + 'DevicesDetection.getBrowserFamilies' => Piwik::translate('UserSettings_BrowserFamilies'), + 'DevicesDetection.getBrowserVersions' => Piwik::translate('DevicesDetection_BrowserVersions') + ); + } +} diff --git a/plugins/DevicesDetection/Reports/GetBrand.php b/plugins/DevicesDetection/Reports/GetBrand.php new file mode 100644 index 0000000000..c932dcf19c --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetBrand.php @@ -0,0 +1,34 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\Devicebrand; + +class GetBrand extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new Devicebrand(); + $this->name = Piwik::translate('DevicesDetection_DeviceBrand'); + $this->documentation = ''; // TODO + $this->order = 1; + $this->widgetTitle = 'DevicesDetection_DeviceBrand'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelBrands")); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetBrowserFamilies.php b/plugins/DevicesDetection/Reports/GetBrowserFamilies.php new file mode 100644 index 0000000000..1543b5a472 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetBrowserFamilies.php @@ -0,0 +1,37 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\Browserfamilies; +use Piwik\Plugins\DevicesDetection\Columns\BrowserName; + +class GetBrowserFamilies extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new BrowserName(); + $this->name = Piwik::translate('UserSettings_BrowserFamilies'); + $this->documentation = ''; // TODO + $this->order = 5; + $this->widgetTitle = 'UserSettings_BrowserFamilies'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->title = $this->name; + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelBrowserFamily")); + $view->config->addRelatedReports($this->getBrowserRelatedReports()); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetBrowserVersions.php b/plugins/DevicesDetection/Reports/GetBrowserVersions.php new file mode 100644 index 0000000000..cf1a00d3c6 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetBrowserVersions.php @@ -0,0 +1,35 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\Browserversion; + +class GetBrowserVersions extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new Browserversion(); + $this->name = Piwik::translate('DevicesDetection_BrowserVersions'); + $this->documentation = ''; // TODO + $this->order = 6; + $this->widgetTitle = 'DevicesDetection_BrowserVersions'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("UserSettings_ColumnBrowserVersion")); + $view->config->addRelatedReports($this->getBrowserRelatedReports()); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetModel.php b/plugins/DevicesDetection/Reports/GetModel.php new file mode 100644 index 0000000000..1537dcff47 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetModel.php @@ -0,0 +1,34 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\Devicemodel; + +class GetModel extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new Devicemodel(); + $this->name = Piwik::translate('DevicesDetection_DeviceModel'); + $this->documentation = ''; // TODO + $this->order = 2; + $this->widgetTitle = 'DevicesDetection_DeviceModel'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelModels")); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetOsFamilies.php b/plugins/DevicesDetection/Reports/GetOsFamilies.php new file mode 100644 index 0000000000..7ca9af3aa6 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetOsFamilies.php @@ -0,0 +1,37 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\OperatingSystemfamilies; +use Piwik\Plugins\DevicesDetection\Columns\Os; + +class GetOsFamilies extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new Os(); + $this->name = Piwik::translate('DevicesDetection_OperatingSystemFamilies'); + $this->documentation = ''; // TODO + $this->order = 3; + $this->widgetTitle = 'DevicesDetection_OperatingSystemFamilies'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->title = $this->name; + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("UserSettings_OperatingSystemFamily")); + $view->config->addRelatedReports($this->getOsRelatedReports()); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetOsVersions.php b/plugins/DevicesDetection/Reports/GetOsVersions.php new file mode 100644 index 0000000000..05f70b0770 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetOsVersions.php @@ -0,0 +1,36 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\OsVersion; + +class GetOsVersions extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new OsVersion(); + $this->name = Piwik::translate('DevicesDetection_OperatingSystemVersions'); + $this->documentation = ''; // TODO + $this->order = 4; + $this->widgetTitle = 'DevicesDetection_OperatingSystemVersions'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->title = $this->name; + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelSystemVersion")); + $view->config->addRelatedReports($this->getOsRelatedReports()); + } + +} diff --git a/plugins/DevicesDetection/Reports/GetType.php b/plugins/DevicesDetection/Reports/GetType.php new file mode 100644 index 0000000000..db4b2d06e9 --- /dev/null +++ b/plugins/DevicesDetection/Reports/GetType.php @@ -0,0 +1,34 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\DevicesDetection\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\ViewDataTable; +use Piwik\Plugins\DevicesDetection\Columns\Devicetype; + +class GetType extends Base +{ + protected function init() + { + parent::init(); + $this->dimension = new Devicetype(); + $this->name = Piwik::translate('DevicesDetection_DeviceType'); + $this->documentation = ''; // TODO + $this->order = 0; + $this->widgetTitle = 'DevicesDetection_DeviceType'; + } + + public function configureView(ViewDataTable $view) + { + $view->config->show_search = false; + $view->config->show_exclude_low_population = false; + $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelTypes")); + } + +} diff --git a/plugins/DevicesDetection/Widgets.php b/plugins/DevicesDetection/Widgets.php deleted file mode 100644 index 0df651064d..0000000000 --- a/plugins/DevicesDetection/Widgets.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\DevicesDetection; - -use Piwik\WidgetsList; - -class Widgets extends \Piwik\Plugin\Widgets -{ - public function configure(WidgetsList $widgetsList) - { - $detection = new DevicesDetection(); - - foreach ($detection->getRawMetadataReports() as $report) { - list($category, $name, $controllerName, $controllerAction) = $report; - if ($category == false) - continue; - $widgetsList->add($category, $name, $controllerName, $controllerAction); - } - } - -} diff --git a/plugins/Events/Events.php b/plugins/Events/Events.php index 8b0e8d7d90..c50b1f15db 100644 --- a/plugins/Events/Events.php +++ b/plugins/Events/Events.php @@ -11,8 +11,6 @@ namespace Piwik\Plugins\Events; use Piwik\Common; use Piwik\Piwik; -/** - */ class Events extends \Piwik\Plugin { /** @@ -22,8 +20,7 @@ class Events extends \Piwik\Plugin { return array( 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', - 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations', - 'API.getReportMetadata' => 'getReportMetadata', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' ); } @@ -125,33 +122,6 @@ class Events extends \Piwik\Plugin // ); // } - public function getReportMetadata(&$reports) - { - $metrics = $this->getMetricTranslations(); - $documentation = $this->getMetricDocumentation(); - $labelTranslations = $this->getLabelTranslations(); - - $order = 0; - foreach($labelTranslations as $action => $translations) { - $secondaryDimension = $this->getSecondaryDimensionFromRequest(); - $actionToLoadSubtables = API::getInstance()->getActionToLoadSubtables($action, $secondaryDimension); - $reports[] = array( - 'category' => Piwik::translate('Events_Events'), - 'name' => Piwik::translate($translations[0]), - 'module' => 'Events', - 'action' => $action, - 'dimension' => Piwik::translate($translations[1]), - 'metrics' => $metrics, - 'metricsDocumentation' => $documentation, - 'processedMetrics' => false, - 'actionToLoadSubTables' => $actionToLoadSubtables, - 'order' => $order++ - ); - - } - } - - /** * Given getCategory, returns "Event Categories" * diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 80068946bc..8a1cd63d16 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -111,11 +111,25 @@ class Goals extends \Piwik\Plugin 'Goals.getReportsWithGoalMetrics' => 'getActualReportsWithGoalMetrics', 'ViewDataTable.configure' => 'configureViewDataTable', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', - 'ViewDataTable.addViewDataTable' => 'getAvailableDataTableVisualizations' + 'ViewDataTable.addViewDataTable' => 'getAvailableDataTableVisualizations', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' ); return $hooks; } + + public function addMetricTranslations(&$translations) + { + $metrics = array( + 'orders' => 'General_EcommerceOrders', + 'ecommerce_revenue' => 'General_ProductRevenue' + ); + + $metrics = array_map(array('\\Piwik\\Piwik', 'translate'), $metrics); + + $translations = array_merge($translations, $metrics); + } + public function getAvailableDataTableVisualizations(&$visualizations) { $visualizations[] = 'Piwik\\Plugins\\Goals\\Visualizations\\Goals'; diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php index ba4ed28b0c..c7884c2fa0 100644 --- a/plugins/MultiSites/MultiSites.php +++ b/plugins/MultiSites/MultiSites.php @@ -8,10 +8,6 @@ */ namespace Piwik\Plugins\MultiSites; - -/** - * - */ class MultiSites extends \Piwik\Plugin { public function getInformation() @@ -30,7 +26,25 @@ class MultiSites extends \Piwik\Plugin 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' + ); + } + + public function addMetricTranslations(&$translations) + { + $metrics = array( + 'visits_evolution' => 'General_ColumnNbVisits', + 'actions_evolution' => 'General_ColumnNbActions', + 'pageviews_evolution' => 'General_ColumnPageviews', + 'revenue_evolution' => 'General_ColumnRevenue', + 'nb_conversions_evolution' => 'Goals_ColumnConversions', + 'orders_evolution' => 'General_EcommerceOrders', + 'ecommerce_revenue_evolution' => 'General_ProductRevenue', ); + + $metrics = array_map(array('\\Piwik\\Piwik', 'translate'), $metrics); + + $translations = array_merge($translations, $metrics); } public function getClientSideTranslationKeys(&$translations) diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index 5761a23ec5..33096d2ae1 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -15,7 +15,6 @@ use Piwik\Db; use Piwik\FrontController; use Piwik\IP; use Piwik\Piwik; -use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\PrivacyManager\Config as PrivacyManagerConfig; /** diff --git a/plugins/Provider/Reports/GetProvider.php b/plugins/Provider/Reports/GetProvider.php index 90aae85385..7317663b60 100644 --- a/plugins/Provider/Reports/GetProvider.php +++ b/plugins/Provider/Reports/GetProvider.php @@ -27,7 +27,7 @@ class GetProvider extends \Piwik\Plugin\Report public function configureView(ViewDataTable $view) { $view->requestConfig->filter_limit = 5; - $view->config->addTranslation('label', Piwik::translate('Provider_ColumnProvider')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/Referrers/Columns/Campaign.php b/plugins/Referrers/Columns/Campaign.php index 35c5d15df7..1ed4f00333 100644 --- a/plugins/Referrers/Columns/Campaign.php +++ b/plugins/Referrers/Columns/Campaign.php @@ -12,9 +12,9 @@ use Piwik\Piwik; use Piwik\Plugin\VisitDimension; class Campaign extends VisitDimension -{ +{ public function getName() { return Piwik::translate('Referrers_ColumnCampaign'); } -}
\ No newline at end of file +} diff --git a/plugins/Referrers/Columns/Keyword.php b/plugins/Referrers/Columns/Keyword.php index f38dfb7ee8..113faa49e8 100644 --- a/plugins/Referrers/Columns/Keyword.php +++ b/plugins/Referrers/Columns/Keyword.php @@ -9,23 +9,25 @@ namespace Piwik\Plugins\Referrers\Columns; use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; -use Piwik\Plugin\Segment; +use Piwik\Tracker\Request; -class Keyword extends VisitDimension -{ +class Keyword extends Base +{ protected $fieldName = 'referer_keyword'; + protected $fieldType = 'VARCHAR(255) NULL'; - protected function init() + public function getName() { - $segment = new Segment(); - $segment->setSegment('referrerKeyword'); - $segment->setName('General_ColumnKeyword'); - $this->addSegment($segment); + return Piwik::translate('General_ColumnKeyword'); } - public function getName() + public function onNewVisit(Request $request, $visit) { - return Piwik::translate('General_ColumnKeyword'); + $referrerUrl = $request->getParam('urlref'); + $currentUrl = $request->getParam('url'); + + $information = $this->getReferrerInformation($referrerUrl, $currentUrl, $request->getIdSite()); + + return $information['referer_keyword']; } -}
\ No newline at end of file +} diff --git a/plugins/Referrers/Columns/ReferrerCampaign.php b/plugins/Referrers/Columns/ReferrerCampaign.php deleted file mode 100644 index 8cefe48d35..0000000000 --- a/plugins/Referrers/Columns/ReferrerCampaign.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerCampaign extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_ColumnCampaign'); - } -} diff --git a/plugins/Referrers/Columns/ReferrerKeyword.php b/plugins/Referrers/Columns/ReferrerKeyword.php deleted file mode 100644 index 029316893a..0000000000 --- a/plugins/Referrers/Columns/ReferrerKeyword.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Tracker\Request; - -class ReferrerKeyword extends Base -{ - protected $fieldName = 'referer_keyword'; - protected $fieldType = 'VARCHAR(255) NULL'; - - public function getName() - { - return Piwik::translate('General_ColumnKeyword'); - } - - public function onNewVisit(Request $request, $visit) - { - $referrerUrl = $request->getParam('urlref'); - $currentUrl = $request->getParam('url'); - - $information = $this->getReferrerInformation($referrerUrl, $currentUrl, $request->getIdSite()); - - return $information['referer_keyword']; - } -} diff --git a/plugins/Referrers/Columns/ReferrerReferrer.php b/plugins/Referrers/Columns/ReferrerReferrer.php deleted file mode 100644 index 9601913125..0000000000 --- a/plugins/Referrers/Columns/ReferrerReferrer.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerReferrer extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_Referrer'); - } -} diff --git a/plugins/Referrers/Columns/ReferrerSearchEngine.php b/plugins/Referrers/Columns/ReferrerSearchEngine.php deleted file mode 100644 index aa94df5874..0000000000 --- a/plugins/Referrers/Columns/ReferrerSearchEngine.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerSearchEngine extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_ColumnSearchEngine'); - } -} diff --git a/plugins/Referrers/Columns/ReferrerSocial.php b/plugins/Referrers/Columns/ReferrerSocial.php deleted file mode 100644 index 667e219270..0000000000 --- a/plugins/Referrers/Columns/ReferrerSocial.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerSocial extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_ColumnSocial'); - } -} diff --git a/plugins/Referrers/Columns/ReferrerWebsite.php b/plugins/Referrers/Columns/ReferrerWebsite.php deleted file mode 100644 index f8b72c32ba..0000000000 --- a/plugins/Referrers/Columns/ReferrerWebsite.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerWebsite extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_ColumnWebsite'); - } -} diff --git a/plugins/Referrers/Columns/ReferrerWebsitePage.php b/plugins/Referrers/Columns/ReferrerWebsitePage.php deleted file mode 100644 index 48d1b3c331..0000000000 --- a/plugins/Referrers/Columns/ReferrerWebsitePage.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Plugins\Referrers\Columns; - -use Piwik\Piwik; -use Piwik\Plugin\VisitDimension; - -class ReferrerWebsitePage extends VisitDimension -{ - public function getName() - { - return Piwik::translate('Referrers_ColumnWebsitePage'); - } -} diff --git a/plugins/Referrers/Referrers.php b/plugins/Referrers/Referrers.php index 0e3364e49a..a88df8c563 100644 --- a/plugins/Referrers/Referrers.php +++ b/plugins/Referrers/Referrers.php @@ -11,11 +11,7 @@ namespace Piwik\Plugins\Referrers; use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Piwik; -use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; -use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable\AllColumns; -use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; -use Piwik\SettingsPiwik; /** * @see plugins/Referrers/functions.php @@ -33,7 +29,6 @@ class Referrers extends \Piwik\Plugin { $hooks = array( 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', 'Insights.addReportToOverview' => 'addReportToInsightsOverview' ); @@ -48,143 +43,6 @@ class Referrers extends \Piwik\Plugin $reports['Referrers_getSearchEngines'] = array(); } - public function getReportMetadata(&$reports) - { - $reports = array_merge($reports, array( - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Type'), - 'module' => 'Referrers', - 'action' => 'getReferrerType', - 'dimension' => Piwik::translate('Referrers_Type'), - 'constantRowsCount' => true, - 'documentation' => Piwik::translate('Referrers_TypeReportDocumentation') . '<br />' - . '<b>' . Piwik::translate('Referrers_DirectEntry') . ':</b> ' . Piwik::translate('Referrers_DirectEntryDocumentation') . '<br />' - . '<b>' . Piwik::translate('Referrers_SearchEngines') . ':</b> ' . Piwik::translate('Referrers_SearchEnginesDocumentation', - array('<br />', '"' . Piwik::translate('Referrers_SubmenuSearchEngines') . '"')) . '<br />' - . '<b>' . Piwik::translate('Referrers_Websites') . ':</b> ' . Piwik::translate('Referrers_WebsitesDocumentation', - array('<br />', '"' . Piwik::translate('Referrers_SubmenuWebsites') . '"')) . '<br />' - . '<b>' . Piwik::translate('Referrers_Campaigns') . ':</b> ' . Piwik::translate('Referrers_CampaignsDocumentation', - array('<br />', '"' . Piwik::translate('Referrers_Campaigns') . '"')), - 'order' => 1, - ), - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_WidgetGetAll'), - 'module' => 'Referrers', - 'action' => 'getAll', - 'dimension' => Piwik::translate('Referrers_Referrer'), - 'documentation' => Piwik::translate('Referrers_AllReferrersReportDocumentation', '<br />'), - 'order' => 2, - ), - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Keywords'), - 'module' => 'Referrers', - 'action' => 'getKeywords', - 'actionToLoadSubTables' => 'getSearchEnginesFromKeywordId', - 'dimension' => Piwik::translate('General_ColumnKeyword'), - 'documentation' => Piwik::translate('Referrers_KeywordsReportDocumentation', '<br />'), - 'order' => 3, - ), - array( // subtable report - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Keywords'), - 'module' => 'Referrers', - 'action' => 'getSearchEnginesFromKeywordId', - 'dimension' => Piwik::translate('Referrers_ColumnSearchEngine'), - 'documentation' => Piwik::translate('Referrers_KeywordsReportDocumentation', '<br />'), - 'isSubtableReport' => true, - 'order' => 4 - ), - - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Websites'), - 'module' => 'Referrers', - 'action' => 'getWebsites', - 'dimension' => Piwik::translate('Referrers_ColumnWebsite'), - 'documentation' => Piwik::translate('Referrers_WebsitesReportDocumentation', '<br />'), - 'actionToLoadSubTables' => 'getUrlsFromWebsiteId', - 'order' => 5 - ), - array( // subtable report - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Websites'), - 'module' => 'Referrers', - 'action' => 'getUrlsFromWebsiteId', - 'dimension' => Piwik::translate('Referrers_ColumnWebsitePage'), - 'documentation' => Piwik::translate('Referrers_WebsitesReportDocumentation', '<br />'), - 'isSubtableReport' => true, - 'order' => 6, - ), - - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_SearchEngines'), - 'module' => 'Referrers', - 'action' => 'getSearchEngines', - 'dimension' => Piwik::translate('Referrers_ColumnSearchEngine'), - 'documentation' => Piwik::translate('Referrers_SearchEnginesReportDocumentation', '<br />'), - 'actionToLoadSubTables' => 'getKeywordsFromSearchEngineId', - 'order' => 7, - ), - array( // subtable report - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_SearchEngines'), - 'module' => 'Referrers', - 'action' => 'getKeywordsFromSearchEngineId', - 'dimension' => Piwik::translate('General_ColumnKeyword'), - 'documentation' => Piwik::translate('Referrers_SearchEnginesReportDocumentation', '<br />'), - 'isSubtableReport' => true, - 'order' => 8, - ), - - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Campaigns'), - 'module' => 'Referrers', - 'action' => 'getCampaigns', - 'dimension' => Piwik::translate('Referrers_ColumnCampaign'), - 'documentation' => Piwik::translate('Referrers_CampaignsReportDocumentation', - array('<br />', '<a href="http://piwik.org/docs/tracking-campaigns/" target="_blank">', '</a>')), - 'actionToLoadSubTables' => 'getKeywordsFromCampaignId', - 'order' => 9, - ), - array( // subtable report - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Campaigns'), - 'module' => 'Referrers', - 'action' => 'getKeywordsFromCampaignId', - 'dimension' => Piwik::translate('General_ColumnKeyword'), - 'documentation' => Piwik::translate('Referrers_CampaignsReportDocumentation', - array('<br />', '<a href="http://piwik.org/docs/tracking-campaigns/" target="_blank">', '</a>')), - 'isSubtableReport' => true, - 'order' => 10, - ), - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Socials'), - 'module' => 'Referrers', - 'action' => 'getSocials', - 'actionToLoadSubTables' => 'getUrlsForSocial', - 'dimension' => Piwik::translate('Referrers_ColumnSocial'), - 'documentation' => Piwik::translate('Referrers_WebsitesReportDocumentation', '<br />'), - 'order' => 11, - ), - array( - 'category' => Piwik::translate('Referrers_Referrers'), - 'name' => Piwik::translate('Referrers_Socials'), - 'module' => 'Referrers', - 'action' => 'getUrlsForSocial', - 'isSubtableReport' => true, - 'dimension' => Piwik::translate('Referrers_ColumnWebsitePage'), - 'documentation' => Piwik::translate('Referrers_WebsitesReportDocumentation', '<br />'), - 'order' => 12, - ), - )); - } - public function getSegmentsMetadata(&$segments) { $segments[] = array( diff --git a/plugins/Referrers/Reports/GetAll.php b/plugins/Referrers/Reports/GetAll.php index 6dd9108b05..8e0390fe28 100644 --- a/plugins/Referrers/Reports/GetAll.php +++ b/plugins/Referrers/Reports/GetAll.php @@ -31,7 +31,7 @@ class GetAll extends Base $view->config->show_exclude_low_population = false; $view->config->show_goals = true; - $view->config->addTranslation('label', Piwik::translate('Referrers_Referrer')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 20; diff --git a/plugins/Referrers/Reports/GetCampaigns.php b/plugins/Referrers/Reports/GetCampaigns.php index 9658a92f2a..8db3b0a2fa 100644 --- a/plugins/Referrers/Reports/GetCampaigns.php +++ b/plugins/Referrers/Reports/GetCampaigns.php @@ -31,7 +31,7 @@ class GetCampaigns extends Base $view->config->show_goals = true; $view->config->subtable_controller_action = 'getKeywordsFromCampaignId'; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnCampaign')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 25; } diff --git a/plugins/Referrers/Reports/GetKeywords.php b/plugins/Referrers/Reports/GetKeywords.php index c3ead1e132..9d0680aa14 100644 --- a/plugins/Referrers/Reports/GetKeywords.php +++ b/plugins/Referrers/Reports/GetKeywords.php @@ -19,7 +19,7 @@ class GetKeywords extends Base { parent::init(); $this->dimension = new Keyword(); - $this->name = Piwik::translate('CorePluginsAdmin_PluginKeywords'); + $this->name = Piwik::translate('Referrers_Keywords'); $this->documentation = Piwik::translate('Referrers_KeywordsReportDocumentation', '<br />'); $this->actionToLoadSubTables = 'getSearchEnginesFromKeywordId'; $this->order = 3; diff --git a/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php b/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php index 9fbc7b65c9..bb9a82ed24 100644 --- a/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php +++ b/plugins/Referrers/Reports/GetKeywordsFromCampaignId.php @@ -29,7 +29,7 @@ class GetKeywordsFromCampaignId extends Base { $view->config->show_search = false; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('General_ColumnKeyword')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/Referrers/Reports/GetKeywordsFromSearchEngineId.php b/plugins/Referrers/Reports/GetKeywordsFromSearchEngineId.php index 87261debf4..e81202063e 100644 --- a/plugins/Referrers/Reports/GetKeywordsFromSearchEngineId.php +++ b/plugins/Referrers/Reports/GetKeywordsFromSearchEngineId.php @@ -28,7 +28,7 @@ class GetKeywordsFromSearchEngineId extends Base { $view->config->show_search = false; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('General_ColumnKeyword')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/Referrers/Reports/GetReferrerType.php b/plugins/Referrers/Reports/GetReferrerType.php index a127fdf5cc..e856a61367 100644 --- a/plugins/Referrers/Reports/GetReferrerType.php +++ b/plugins/Referrers/Reports/GetReferrerType.php @@ -42,7 +42,7 @@ class GetReferrerType extends Base public function configureView(ViewDataTable $view) { $idSubtable = Common::getRequestVar('idSubtable', false); - $labelColumnTitle = Piwik::translate('Referrers_Type'); + $labelColumnTitle = $this->name; switch ($idSubtable) { case Common::REFERRER_TYPE_SEARCH_ENGINE: diff --git a/plugins/Referrers/Reports/GetSearchEngines.php b/plugins/Referrers/Reports/GetSearchEngines.php index 143bb5078a..fc89e14de0 100644 --- a/plugins/Referrers/Reports/GetSearchEngines.php +++ b/plugins/Referrers/Reports/GetSearchEngines.php @@ -32,7 +32,7 @@ class GetSearchEngines extends Base $view->config->show_exclude_low_population = false; $view->config->show_search = false; $view->config->show_goals = true; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnSearchEngine')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 25; diff --git a/plugins/Referrers/Reports/GetSearchEnginesFromKeywordId.php b/plugins/Referrers/Reports/GetSearchEnginesFromKeywordId.php index e10979b57a..162c215c1a 100644 --- a/plugins/Referrers/Reports/GetSearchEnginesFromKeywordId.php +++ b/plugins/Referrers/Reports/GetSearchEnginesFromKeywordId.php @@ -18,7 +18,7 @@ class GetSearchEnginesFromKeywordId extends Base { parent::init(); $this->dimension = new SearchEngine(); - $this->name = Piwik::translate('CorePluginsAdmin_PluginKeywords'); + $this->name = Piwik::translate('Referrers_Keywords'); $this->documentation = Piwik::translate('Referrers_KeywordsReportDocumentation', '<br />'); $this->isSubtableReport = true; $this->order = 4; @@ -28,7 +28,7 @@ class GetSearchEnginesFromKeywordId extends Base { $view->config->show_search = false; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnSearchEngine')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/Referrers/Reports/GetSocials.php b/plugins/Referrers/Reports/GetSocials.php index 17e3a7cf92..fd3475f226 100644 --- a/plugins/Referrers/Reports/GetSocials.php +++ b/plugins/Referrers/Reports/GetSocials.php @@ -38,7 +38,7 @@ class GetSocials extends Base $view->config->subtable_controller_action = 'getUrlsForSocial'; $view->config->show_exclude_low_population = false; $view->config->show_goals = true; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnSocial')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 10; diff --git a/plugins/Referrers/Reports/GetUrlsForSocial.php b/plugins/Referrers/Reports/GetUrlsForSocial.php index f20b7ff353..51fd006485 100644 --- a/plugins/Referrers/Reports/GetUrlsForSocial.php +++ b/plugins/Referrers/Reports/GetUrlsForSocial.php @@ -28,7 +28,7 @@ class GetUrlsForSocial extends Base { $view->config->show_goals = true; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnWebsitePage')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 10; } diff --git a/plugins/Referrers/Reports/GetUrlsFromWebsiteId.php b/plugins/Referrers/Reports/GetUrlsFromWebsiteId.php index b1f4ad6bcc..a706ad5ee1 100644 --- a/plugins/Referrers/Reports/GetUrlsFromWebsiteId.php +++ b/plugins/Referrers/Reports/GetUrlsFromWebsiteId.php @@ -29,7 +29,7 @@ class GetUrlsFromWebsiteId extends Base $view->config->show_search = false; $view->config->show_exclude_low_population = false; $view->config->tooltip_metadata_name = 'url'; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnWebsitePage')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/Referrers/Reports/GetWebsites.php b/plugins/Referrers/Reports/GetWebsites.php index 28b304eaa2..7f6b507e10 100644 --- a/plugins/Referrers/Reports/GetWebsites.php +++ b/plugins/Referrers/Reports/GetWebsites.php @@ -31,7 +31,7 @@ class GetWebsites extends Base $view->config->subtable_controller_action = 'getUrlsFromWebsiteId'; $view->config->show_exclude_low_population = false; $view->config->show_goals = true; - $view->config->addTranslation('label', Piwik::translate('Referrers_ColumnWebsite')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 25; diff --git a/plugins/UserCountry/Reports/GetCity.php b/plugins/UserCountry/Reports/GetCity.php index 0cd0acb390..51f9a3baa3 100644 --- a/plugins/UserCountry/Reports/GetCity.php +++ b/plugins/UserCountry/Reports/GetCity.php @@ -19,7 +19,7 @@ class GetCity extends Base parent::init(); $this->dimension = new City(); $this->name = Piwik::translate('UserCountry_City'); - $this->documentation = ''; // TODO + $this->documentation = Piwik::translate('UserCountry_getCityDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix(); $this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions'); $this->order = 8; $this->widgetTitle = Piwik::translate('UserCountry_WidgetLocation') @@ -30,8 +30,8 @@ class GetCity extends Base { $view->config->show_exclude_low_population = false; $view->config->show_goals = true; - $view->config->documentation = Piwik::translate('UserCountry_getCityDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix(); - $view->config->addTranslation('label', Piwik::translate('UserCountry_City')); + $view->config->documentation = $this->documentation; + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 5; diff --git a/plugins/UserCountry/Reports/GetContinent.php b/plugins/UserCountry/Reports/GetContinent.php index 1c0c0c35f1..129c740555 100644 --- a/plugins/UserCountry/Reports/GetContinent.php +++ b/plugins/UserCountry/Reports/GetContinent.php @@ -19,7 +19,7 @@ class GetContinent extends Base parent::init(); $this->dimension = new Continent(); $this->name = Piwik::translate('UserCountry_Continent'); - $this->documentation = ''; // TODO + $this->documentation = Piwik::translate('UserCountry_getContinentDocumentation'); $this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions'); $this->order = 6; $this->widgetTitle = Piwik::translate('UserCountry_WidgetLocation') @@ -34,8 +34,8 @@ class GetContinent extends Base $view->config->show_offset_information = false; $view->config->show_pagination_control = false; $view->config->show_limit_control = false; - $view->config->documentation = Piwik::translate('UserCountry_getContinentDocumentation'); - $view->config->addTranslation('label', Piwik::translate('UserCountry_Continent')); + $view->config->documentation = $this->documentation; + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/UserCountry/Reports/GetCountry.php b/plugins/UserCountry/Reports/GetCountry.php index 3c022a1a85..0043c6a33c 100644 --- a/plugins/UserCountry/Reports/GetCountry.php +++ b/plugins/UserCountry/Reports/GetCountry.php @@ -20,7 +20,7 @@ class GetCountry extends Base parent::init(); $this->dimension = new Country(); $this->name = Piwik::translate('UserCountry_Country'); - $this->documentation = ''; // TODO + $this->documentation = Piwik::translate('UserCountry_getCountryDocumentation'); $this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions'); $this->order = 5; $this->widgetTitle = Piwik::translate('UserCountry_WidgetLocation') @@ -31,8 +31,8 @@ class GetCountry extends Base { $view->config->show_goals = true; $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('UserCountry_Country')); - $view->config->documentation = Piwik::translate('UserCountry_getCountryDocumentation'); + $view->config->addTranslation('label', $this->dimension->getName()); + $view->config->documentation = $this->documentation; $view->requestConfig->filter_limit = 5; diff --git a/plugins/UserCountry/Reports/GetRegion.php b/plugins/UserCountry/Reports/GetRegion.php index 174d14b96b..071f6ce326 100644 --- a/plugins/UserCountry/Reports/GetRegion.php +++ b/plugins/UserCountry/Reports/GetRegion.php @@ -19,7 +19,7 @@ class GetRegion extends Base parent::init(); $this->dimension = new Region(); $this->name = Piwik::translate('UserCountry_Region'); - $this->documentation = ''; // TODO + $this->documentation = Piwik::translate('UserCountry_getRegionDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix(); $this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions'); $this->order = 7; $this->widgetTitle = Piwik::translate('UserCountry_WidgetLocation') @@ -30,8 +30,8 @@ class GetRegion extends Base { $view->config->show_exclude_low_population = false; $view->config->show_goals = true; - $view->config->documentation = Piwik::translate('UserCountry_getRegionDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix(); - $view->config->addTranslation('label', Piwik::translate('UserCountry_Region')); + $view->config->documentation = $this->documentation; + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 5; diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index 410a7f5696..2517290158 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -37,7 +37,6 @@ class UserCountry extends \Piwik\Plugin { $hooks = array( 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', @@ -213,55 +212,6 @@ class UserCountry extends \Piwik\Plugin ); } - public function getReportMetadata(&$reports) - { - $metrics = array( - 'nb_visits' => Piwik::translate('General_ColumnNbVisits'), - 'nb_uniq_visitors' => Piwik::translate('General_ColumnNbUniqVisitors'), - 'nb_actions' => Piwik::translate('General_ColumnNbActions'), - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('UserCountry_Country'), - 'module' => 'UserCountry', - 'action' => 'getCountry', - 'dimension' => Piwik::translate('UserCountry_Country'), - 'metrics' => $metrics, - 'order' => 5, - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('UserCountry_Continent'), - 'module' => 'UserCountry', - 'action' => 'getContinent', - 'dimension' => Piwik::translate('UserCountry_Continent'), - 'metrics' => $metrics, - 'order' => 6, - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('UserCountry_Region'), - 'module' => 'UserCountry', - 'action' => 'getRegion', - 'dimension' => Piwik::translate('UserCountry_Region'), - 'metrics' => $metrics, - 'order' => 7, - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('UserCountry_City'), - 'module' => 'UserCountry', - 'action' => 'getCity', - 'dimension' => Piwik::translate('UserCountry_City'), - 'metrics' => $metrics, - 'order' => 8, - ); - } - public function getReportsWithGoalMetrics(&$dimensions) { $dimensions = array_merge($dimensions, array( diff --git a/plugins/UserSettings/Reports/GetBrowser.php b/plugins/UserSettings/Reports/GetBrowser.php index a149df1566..c9c56ccfe9 100644 --- a/plugins/UserSettings/Reports/GetBrowser.php +++ b/plugins/UserSettings/Reports/GetBrowser.php @@ -30,7 +30,7 @@ class GetBrowser extends Base $this->getBasicUserSettingsDisplayProperties($view); $view->config->title = Piwik::translate('UserSettings_Browsers'); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnBrowser')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getBrowserRelatedReports()); if ($view->isViewDataTableId(Graph::ID)) { diff --git a/plugins/UserSettings/Reports/GetBrowserType.php b/plugins/UserSettings/Reports/GetBrowserType.php index 04630d055a..34ab6aab32 100644 --- a/plugins/UserSettings/Reports/GetBrowserType.php +++ b/plugins/UserSettings/Reports/GetBrowserType.php @@ -34,7 +34,7 @@ class GetBrowserType extends Base { $this->getBasicUserSettingsDisplayProperties($view); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnBrowserFamily')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->show_offset_information = false; $view->config->show_pagination_control = false; $view->config->show_limit_control = false; diff --git a/plugins/UserSettings/Reports/GetBrowserVersion.php b/plugins/UserSettings/Reports/GetBrowserVersion.php index 2bf2f7e464..d04f02f234 100644 --- a/plugins/UserSettings/Reports/GetBrowserVersion.php +++ b/plugins/UserSettings/Reports/GetBrowserVersion.php @@ -30,7 +30,7 @@ class GetBrowserVersion extends Base $this->getBasicUserSettingsDisplayProperties($view); $view->config->title = Piwik::translate('UserSettings_ColumnBrowserVersion'); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnBrowserVersion')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getBrowserRelatedReports()); if ($view->isViewDataTableId(Graph::ID)) { diff --git a/plugins/UserSettings/Reports/GetConfiguration.php b/plugins/UserSettings/Reports/GetConfiguration.php index ae75d20f21..89000e75ae 100644 --- a/plugins/UserSettings/Reports/GetConfiguration.php +++ b/plugins/UserSettings/Reports/GetConfiguration.php @@ -28,7 +28,7 @@ class GetConfiguration extends Base { $this->getBasicUserSettingsDisplayProperties($view); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnConfiguration')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_limit = 3; } diff --git a/plugins/UserSettings/Reports/GetLanguage.php b/plugins/UserSettings/Reports/GetLanguage.php index 61b9518beb..3c479f8bc8 100644 --- a/plugins/UserSettings/Reports/GetLanguage.php +++ b/plugins/UserSettings/Reports/GetLanguage.php @@ -29,7 +29,7 @@ class GetLanguage extends Base $view->config->show_search = false; $view->config->columns_to_display = array('label', 'nb_visits'); $view->config->show_exclude_low_population = false; - $view->config->addTranslation('label', Piwik::translate('General_Language')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->requestConfig->filter_sort_column = 'nb_visits'; $view->requestConfig->filter_sort_order = 'desc'; diff --git a/plugins/UserSettings/Reports/GetMobileVsDesktop.php b/plugins/UserSettings/Reports/GetMobileVsDesktop.php index 84ec343f32..20e1bcb335 100644 --- a/plugins/UserSettings/Reports/GetMobileVsDesktop.php +++ b/plugins/UserSettings/Reports/GetMobileVsDesktop.php @@ -30,7 +30,7 @@ class GetMobileVsDesktop extends Base $this->getBasicUserSettingsDisplayProperties($view); $view->config->title = Piwik::translate('UserSettings_MobileVsDesktop'); - $view->config->addTranslation('label', Piwik::translate('UserSettings_MobileVsDesktop')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getWideScreenDeviceTypeRelatedReports()); } diff --git a/plugins/UserSettings/Reports/GetOS.php b/plugins/UserSettings/Reports/GetOS.php index 770a148d92..040e69c418 100644 --- a/plugins/UserSettings/Reports/GetOS.php +++ b/plugins/UserSettings/Reports/GetOS.php @@ -29,7 +29,7 @@ class GetOS extends Base $this->getBasicUserSettingsDisplayProperties($view); $view->config->title = Piwik::translate('UserSettings_OperatingSystems'); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnOperatingSystem')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getOsRelatedReports()); } diff --git a/plugins/UserSettings/Reports/GetOSFamily.php b/plugins/UserSettings/Reports/GetOSFamily.php index 6165beafb6..cb6451f03b 100644 --- a/plugins/UserSettings/Reports/GetOSFamily.php +++ b/plugins/UserSettings/Reports/GetOSFamily.php @@ -28,8 +28,8 @@ class GetOSFamily extends Base { $this->getBasicUserSettingsDisplayProperties($view); - $view->config->title = Piwik::translate('UserSettings_OperatingSystemFamily'); - $view->config->addTranslation('label', Piwik::translate('UserSettings_OperatingSystemFamily')); + $view->config->title = $this->name; + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getOsRelatedReports()); } diff --git a/plugins/UserSettings/Reports/GetPlugin.php b/plugins/UserSettings/Reports/GetPlugin.php index aefd4e710f..938d3e4390 100644 --- a/plugins/UserSettings/Reports/GetPlugin.php +++ b/plugins/UserSettings/Reports/GetPlugin.php @@ -20,8 +20,9 @@ class GetPlugin extends Base $this->dimension = new Plugin(); $this->name = Piwik::translate('UserSettings_WidgetPlugins'); $this->documentation = Piwik::translate('UserSettings_WidgetPluginsDocumentation', '<br />'); - $this->metrics = array('0', 'nb_visits_percentage'); + $this->metrics = array('nb_visits', 'nb_visits_percentage'); $this->constantRowsCount = true; + $this->processedMetrics = array(); $this->order = 4; $this->widgetTitle = 'UserSettings_WidgetPlugins'; } @@ -31,7 +32,7 @@ class GetPlugin extends Base $this->getBasicUserSettingsDisplayProperties($view); $view->config->addTranslations(array( - 'label' => Piwik::translate('General_Plugin'), + 'label' => $this->dimension->getName(), 'nb_visits_percentage' => str_replace(' ', ' ', Piwik::translate('General_ColumnPercentageVisits')) )); diff --git a/plugins/UserSettings/Reports/GetResolution.php b/plugins/UserSettings/Reports/GetResolution.php index 33a00f407d..c61126614a 100644 --- a/plugins/UserSettings/Reports/GetResolution.php +++ b/plugins/UserSettings/Reports/GetResolution.php @@ -28,7 +28,7 @@ class GetResolution extends Base { $this->getBasicUserSettingsDisplayProperties($view); - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnResolution')); + $view->config->addTranslation('label', $this->dimension->getName()); } } diff --git a/plugins/UserSettings/Reports/GetWideScreen.php b/plugins/UserSettings/Reports/GetWideScreen.php index f44d7e4ade..bfadd87a9e 100644 --- a/plugins/UserSettings/Reports/GetWideScreen.php +++ b/plugins/UserSettings/Reports/GetWideScreen.php @@ -32,7 +32,7 @@ class GetWideScreen extends Base $view->config->show_offset_information = false; $view->config->show_pagination_control = false; $view->config->show_limit_control = false; - $view->config->addTranslation('label', Piwik::translate('UserSettings_ColumnTypeOfScreen')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->addRelatedReports($this->getWideScreenDeviceTypeRelatedReports()); } diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 7fb97cfe55..205d407790 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -9,10 +9,8 @@ namespace Piwik\Plugins\UserSettings; use Piwik\Piwik; -use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; -use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; /** * @@ -162,62 +160,19 @@ class UserSettings extends \Piwik\Plugin */ public function getListHooksRegistered() { - $hooks = array( - 'API.getReportMetadata' => 'getReportMetadata', + return array( 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' ); - return $hooks; } - public function getRawReportMetadata() + public function addMetricTranslations(&$translations) { - return $this->reportMetadata; - } - - /** - * Registers reports metadata - * - * @param array $reports - */ - public function getReportMetadata(&$reports) - { - $i = 0; - foreach ($this->getRawReportMetadata() as $report) { - list($category, $name, $apiModule, $apiAction, $columnName) = $report; - if ($category == false) continue; - - $report = array( - 'category' => Piwik::translate($category), - 'name' => Piwik::translate($name), - 'module' => $apiModule, - 'action' => $apiAction, - 'dimension' => Piwik::translate($columnName), - 'order' => $i++ - ); + $metrics = array( + 'nb_visits_percentage' => str_replace(' ', ' ', Piwik::translate('General_ColumnPercentageVisits')) + ); - $translation = $name . 'Documentation'; - $translated = Piwik::translate($translation, '<br />'); - if ($translated != $translation) { - $report['documentation'] = $translated; - } - - if ($apiAction == 'getMobileVsDesktop') { - $report['constantRowsCount'] = true; - } - - // getPlugin returns only a subset of metrics - if ($apiAction == 'getPlugin') { - $report['metrics'] = array( - 'nb_visits', - 'nb_visits_percentage' => Piwik::translate('General_ColumnPercentageVisits') - ); - // There is no processedMetrics for this report - $report['processedMetrics'] = array(); - // Always has same number of rows, 1 per plugin - $report['constantRowsCount'] = true; - } - $reports[] = $report; - } + $translations = array_merge($translations, $metrics); } /** diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php new file mode 100644 index 0000000000..f805d936b1 --- /dev/null +++ b/plugins/VisitFrequency/VisitFrequency.php @@ -0,0 +1,42 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\VisitFrequency; + +use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; +use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; + +class VisitFrequency extends \Piwik\Plugin +{ + /** + * @see Piwik\Plugin::getListHooksRegistered + */ + public function getListHooksRegistered() + { + return array( + 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations' + ); + } + + public function addMetricTranslations(&$translations) + { + $metrics = array( + 'nb_visits_returning' => 'VisitFrequency_ColumnReturningVisits', + 'nb_actions_returning' => 'VisitFrequency_ColumnActionsByReturningVisits', + 'avg_time_on_site_returning' => 'VisitFrequency_ColumnAverageVisitDurationForReturningVisitors', + 'bounce_rate_returning' => 'VisitFrequency_ColumnBounceRateForReturningVisits', + 'nb_actions_per_visit_returning' => 'VisitFrequency_ColumnAvgActionsPerReturningVisit', + 'nb_uniq_visitors_returning' => 'VisitFrequency_ColumnUniqueReturningVisitors' + ); + + $translations = array_merge($translations, $metrics); + } + +} diff --git a/plugins/VisitTime/Reports/GetByDayOfWeek.php b/plugins/VisitTime/Reports/GetByDayOfWeek.php index 444aa68849..3905beaac2 100644 --- a/plugins/VisitTime/Reports/GetByDayOfWeek.php +++ b/plugins/VisitTime/Reports/GetByDayOfWeek.php @@ -37,7 +37,7 @@ class GetByDayOfWeek extends Base $view->config->enable_sort = false; $view->config->show_footer_message = Piwik::translate('General_ReportGeneratedFrom', $this->getDateRangeForFooterMessage()); - $view->config->addTranslation('label', Piwik::translate('VisitTime_DayOfWeek')); + $view->config->addTranslation('label', $this->dimension->getName()); if ($view->isViewDataTableId(Graph::ID)) { $view->config->max_graph_elements = false; diff --git a/plugins/VisitTime/Reports/GetVisitInformationPerServerTime.php b/plugins/VisitTime/Reports/GetVisitInformationPerServerTime.php index ea282ff83c..68fd602aee 100644 --- a/plugins/VisitTime/Reports/GetVisitInformationPerServerTime.php +++ b/plugins/VisitTime/Reports/GetVisitInformationPerServerTime.php @@ -34,7 +34,7 @@ class GetVisitInformationPerServerTime extends Base $view->requestConfig->request_parameters_to_modify['hideFutureHoursWhenToday'] = 1; $view->config->show_goals = true; - $view->config->addTranslation('label', Piwik::translate('VisitTime_ColumnServerTime')); + $view->config->addTranslation('label', $this->dimension->getName()); if ($view->isViewDataTableId(Graph::ID)) { $view->config->max_graph_elements = false; diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 710479bcc8..e848170ba8 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -30,48 +30,11 @@ class VisitTime extends \Piwik\Plugin { $hooks = array( 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata' ); return $hooks; } - public function getReportMetadata(&$reports) - { - $reports[] = array( - 'category' => Piwik::translate('VisitsSummary_VisitsSummary'), - 'name' => Piwik::translate('VisitTime_WidgetLocalTime'), - 'module' => 'VisitTime', - 'action' => 'getVisitInformationPerLocalTime', - 'dimension' => Piwik::translate('VisitTime_ColumnLocalTime'), - 'documentation' => Piwik::translate('VisitTime_WidgetLocalTimeDocumentation', array('<strong>', '</strong>')), - 'constantRowsCount' => true, - 'order' => 20 - ); - - $reports[] = array( - 'category' => Piwik::translate('VisitsSummary_VisitsSummary'), - 'name' => Piwik::translate('VisitTime_WidgetServerTime'), - 'module' => 'VisitTime', - 'action' => 'getVisitInformationPerServerTime', - 'dimension' => Piwik::translate('VisitTime_ColumnServerTime'), - 'documentation' => Piwik::translate('VisitTime_WidgetServerTimeDocumentation', array('<strong>', '</strong>')), - 'constantRowsCount' => true, - 'order' => 15, - ); - - $reports[] = array( - 'category' => Piwik::translate('VisitsSummary_VisitsSummary'), - 'name' => Piwik::translate('VisitTime_VisitsByDayOfWeek'), - 'module' => 'VisitTime', - 'action' => 'getByDayOfWeek', - 'dimension' => Piwik::translate('VisitTime_DayOfWeek'), - 'documentation' => Piwik::translate('VisitTime_WidgetByDayOfWeekDocumentation'), - 'constantRowsCount' => true, - 'order' => 25, - ); - } - public function getReportsWithGoalMetrics(&$dimensions) { $dimensions[] = array('category' => Piwik::translate('VisitTime_ColumnServerTime'), diff --git a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php index 065c60ca94..9c2363ba29 100644 --- a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php +++ b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php @@ -39,7 +39,7 @@ class GetNumberOfVisitsPerVisitDuration extends Base $view->requestConfig->filter_sort_column = 'label'; $view->requestConfig->filter_sort_order = 'asc'; - $view->config->addTranslation('label', Piwik::translate('VisitorInterest_ColumnVisitDuration')); + $view->config->addTranslation('label', $this->dimension->getName()); $view->config->enable_sort = false; $view->config->show_exclude_low_population = false; $view->config->show_offset_information = false; diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index f641b61c3f..f036b53f7d 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -12,7 +12,6 @@ use Piwik\ArchiveProcessor; use Piwik\FrontController; use Piwik\Metrics; use Piwik\Piwik; -use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\Cloud; use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; @@ -21,76 +20,6 @@ use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; */ class VisitorInterest extends \Piwik\Plugin { - /** - * @see Piwik\Plugin::getListHooksRegistered - */ - public function getListHooksRegistered() - { - return array( - 'API.getReportMetadata' => 'getReportMetadata' - ); - } - - public function getReportMetadata(&$reports) - { - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('VisitorInterest_WidgetLengths'), - 'module' => 'VisitorInterest', - 'action' => 'getNumberOfVisitsPerVisitDuration', - 'dimension' => Piwik::translate('VisitorInterest_ColumnVisitDuration'), - 'metrics' => array('nb_visits'), - 'processedMetrics' => false, - 'constantRowsCount' => true, - 'documentation' => Piwik::translate('VisitorInterest_WidgetLengthsDocumentation') - . '<br />' . Piwik::translate('General_ChangeTagCloudView'), - 'order' => 15 - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('VisitorInterest_WidgetPages'), - 'module' => 'VisitorInterest', - 'action' => 'getNumberOfVisitsPerPage', - 'dimension' => Piwik::translate('VisitorInterest_ColumnPagesPerVisit'), - 'metrics' => array('nb_visits'), - 'processedMetrics' => false, - 'constantRowsCount' => true, - 'documentation' => Piwik::translate('VisitorInterest_WidgetPagesDocumentation') - . '<br />' . Piwik::translate('General_ChangeTagCloudView'), - 'order' => 20 - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('VisitorInterest_visitsByVisitCount'), - 'module' => 'VisitorInterest', - 'action' => 'getNumberOfVisitsByVisitCount', - 'dimension' => Piwik::translate('VisitorInterest_visitsByVisitCount'), - 'metrics' => array( - 'nb_visits', - 'nb_visits_percentage' => Piwik::translate('General_ColumnPercentageVisits'), - ), - 'processedMetrics' => false, - 'constantRowsCount' => true, - 'documentation' => Piwik::translate('VisitorInterest_WidgetVisitsByNumDocumentation') - . '<br />' . Piwik::translate('General_ChangeTagCloudView'), - 'order' => 25 - ); - - $reports[] = array( - 'category' => Piwik::translate('General_Visitors'), - 'name' => Piwik::translate('VisitorInterest_VisitsByDaysSinceLast'), - 'module' => 'VisitorInterest', - 'action' => 'getNumberOfVisitsByDaysSinceLast', - 'dimension' => Piwik::translate('VisitorInterest_VisitsByDaysSinceLast'), - 'metrics' => array('nb_visits'), - 'processedMetrics' => false, - 'constantRowsCount' => true, - 'documentation' => Piwik::translate('VisitorInterest_WidgetVisitsByDaysSinceLastDocumentation'), - 'order' => 30 - ); - } function postLoad() { diff --git a/plugins/VisitsSummary/Reports/Get.php b/plugins/VisitsSummary/Reports/Get.php index d7f0172bb9..4dbb1e5606 100644 --- a/plugins/VisitsSummary/Reports/Get.php +++ b/plugins/VisitsSummary/Reports/Get.php @@ -18,7 +18,18 @@ class Get extends \Piwik\Plugin\Report $this->category = 'VisitsSummary_VisitsSummary'; $this->name = Piwik::translate('VisitsSummary_VisitsSummary'); $this->documentation = ''; // TODO - $this->metrics = array('0', '1', '2', '3', '4', 'avg_time_on_site', 'max_actions'); + $this->metrics = array( + 'nb_uniq_visitors', + 'nb_visits', + 'nb_actions', + 'nb_actions_per_visit', + 'bounce_rate', + 'avg_time_on_site', + 'max_actions' + ); + // Used to process metrics, not displayed/used directly +// 'sum_visit_length', +// 'nb_visits_converted', $this->order = 1; } } diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php index dfff94ac4d..c73e58afe1 100644 --- a/plugins/VisitsSummary/VisitsSummary.php +++ b/plugins/VisitsSummary/VisitsSummary.php @@ -8,8 +8,6 @@ */ namespace Piwik\Plugins\VisitsSummary; -use Piwik\Piwik; - /** * 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 @@ -25,32 +23,7 @@ class VisitsSummary extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'API.getReportMetadata' => 'getReportMetadata', - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - ); - } - - public function getReportMetadata(&$reports) - { - $reports[] = array( - 'category' => Piwik::translate('VisitsSummary_VisitsSummary'), - 'name' => Piwik::translate('VisitsSummary_VisitsSummary'), - 'module' => 'VisitsSummary', - 'action' => 'get', - 'metrics' => array( - 'nb_uniq_visitors', - 'nb_visits', - 'nb_actions', - 'nb_actions_per_visit', - 'bounce_rate', - 'avg_time_on_site' => Piwik::translate('General_VisitDuration'), - 'max_actions' => Piwik::translate('General_ColumnMaxActions'), -// Used to process metrics, not displayed/used directly -// 'sum_visit_length', -// 'nb_visits_converted', - ), - 'processedMetrics' => false, - 'order' => 1 + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles' ); } |