diff options
55 files changed, 291 insertions, 251 deletions
diff --git a/core/API/Request.php b/core/API/Request.php index b4af213ce6..ce3f0ada18 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -19,7 +19,7 @@ use Piwik\Access; use Piwik\DataTable; use Piwik\Url; use Piwik\API\ResponseBuilder; -use Piwik_FrontController_PluginDeactivatedException; +use Piwik\PluginDeactivatedException; /** * An API request is the object used to make a call to the API and get the result. @@ -128,7 +128,7 @@ class Request * It then reads the parameters from the request string and throws an exception if there are missing parameters. * It then calls the API Proxy which will call the requested method. * - * @throws Piwik_FrontController_PluginDeactivatedException + * @throws PluginDeactivatedException * @return DataTable|mixed The data resulting from the API call */ public function process() @@ -146,7 +146,7 @@ class Request list($module, $method) = $this->extractModuleAndMethod($moduleMethod); if (!\Piwik\PluginsManager::getInstance()->isPluginActivated($module)) { - throw new Piwik_FrontController_PluginDeactivatedException($module); + throw new PluginDeactivatedException($module); } $moduleClass = "Piwik_" . $module . "_API"; @@ -259,9 +259,9 @@ class Request { // we need the URL encoded segment parameter, we fetch it from _SERVER['QUERY_STRING'] instead of default URL decoded _GET $segmentRaw = false; - $segment = Piwik_Common::getRequestVar('segment', '', 'string'); + $segment = Common::getRequestVar('segment', '', 'string'); if (!empty($segment)) { - $request = Piwik_API_Request::getRequestParametersGET(); + $request = Request::getRequestParametersGET(); if(!empty($request['segment'])) { $segmentRaw = $request['segment']; } diff --git a/core/Controller.php b/core/Controller.php index 612b324006..310c7602b8 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -30,7 +30,7 @@ use Piwik\Url; use Piwik_UsersManager_API; use Piwik\View; use Piwik\ViewDataTable; -use Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution; +use Piwik\ViewDataTable\GenerateGraphHtml\ChartEvolution; use Zend_Registry; use false; @@ -149,7 +149,7 @@ abstract class Controller } /** - * Given an Object implementing Piwik_View_Interface, we either: + * Given an Object implementing ViewInterface, we either: * - echo the output of the rendering if fetch = false * - returns the output of the rendering if fetch = true * @@ -185,7 +185,7 @@ abstract class Controller * @param string $currentModuleName * @param string $currentControllerAction * @param string $apiMethod - * @return Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution + * @return ChartEvolution */ protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { @@ -206,7 +206,7 @@ abstract class Controller * @param bool|string $reportDocumentation * @param string $apiMethod The method to request the report from * (by default, this is API.get but it can be changed for custom stuff) - * @return Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution + * @return ChartEvolution */ protected function getLastUnitGraphAcrossPlugins($currentModuleName, $currentControllerAction, $columnsToDisplay, $selectableColumns = array(), $reportDocumentation = false, $apiMethod = 'API.get') diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php index 422df1adcf..1ab8d92c93 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php @@ -11,10 +11,11 @@ namespace Piwik\DataTable\Filter; use Exception; -use Piwik\Metrics; -use Piwik\Piwik; use Piwik\DataTable; use Piwik\DataTable\Filter\AddColumnsProcessedMetrics; +use Piwik\Metrics; +use Piwik\Piwik; +use Piwik_Tracker_GoalManager; /** * @package Piwik @@ -72,7 +73,7 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics { // Add standard processed metrics parent::filter($table); - $roundingPrecision = \Piwik_Tracker_GoalManager::REVENUE_PRECISION; + $roundingPrecision = Piwik_Tracker_GoalManager::REVENUE_PRECISION; $expectedColumns = array(); foreach ($table->getRows() as $key => $row) { $currentColumns = $row->getColumns(); diff --git a/core/FrontController.php b/core/FrontController.php index e57b897cda..fec59e2715 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -357,7 +357,7 @@ class FrontController * @package Piwik * @subpackage FrontController */ -class Piwik_FrontController_PluginDeactivatedException extends Exception +class PluginDeactivatedException extends Exception { public function __construct($module) { diff --git a/core/JqplotDataGenerator.php b/core/JqplotDataGenerator.php index 76d48f5f19..7deaa34c9b 100644 --- a/core/JqplotDataGenerator.php +++ b/core/JqplotDataGenerator.php @@ -13,12 +13,9 @@ namespace Piwik; use Exception; use Piwik\Common; -use Piwik\JqplotDataGenerator\Evolution; use Piwik\Metrics; use Piwik\DataTable; -use Piwik_Visualization; -use Piwik_Visualization_Chart_Pie; -use Piwik_Visualization_Chart_VerticalBar; +use Piwik\Visualization; /** * Generates JSON data used to configure and populate JQPlot graphs. @@ -52,12 +49,12 @@ class JqplotDataGenerator { switch ($type) { case 'evolution': - return new Evolution($properties); + return new \Piwik\JqplotDataGenerator\Evolution($properties); case 'pie': - $visualization = new Piwik_Visualization_Chart_Pie(); + $visualization = new Visualization\Chart\Pie(); return new JqplotDataGenerator($visualization, $properties); case 'bar': - $visualization = new Piwik_Visualization_Chart_VerticalBar(); + $visualization = new Visualization\Chart\VerticalBar(); return new JqplotDataGenerator($visualization, $properties); default: throw new Exception("Unknown JqplotDataGenerator type '$type'."); @@ -161,7 +158,7 @@ class JqplotDataGenerator // the bar charts contain the labels a first series // this series has to be removed from the units - if ($this->visualization instanceof Piwik_Visualization_Chart_VerticalBar) { + if ($this->visualization instanceof Visualization\Chart\VerticalBar) { array_shift($units); } diff --git a/core/JqplotDataGenerator/Evolution.php b/core/JqplotDataGenerator/Evolution.php index 3a36978593..ff4daa2bc3 100644 --- a/core/JqplotDataGenerator/Evolution.php +++ b/core/JqplotDataGenerator/Evolution.php @@ -16,7 +16,6 @@ use Piwik\DataTable; use Piwik\ViewDataTable; use Piwik\Url; use Piwik\JqplotDataGenerator; -use Piwik_Visualization_Chart_Evolution; /** * Generates JQPlot JSON data/config for evolution graphs. @@ -30,7 +29,7 @@ class Evolution extends JqplotDataGenerator */ public function __construct($properties) { - parent::__construct(new Piwik_Visualization_Chart_Evolution(), $properties); + parent::__construct(new \Piwik\Visualization\Chart\Evolution(), $properties); } protected function initChartObjectData($dataTable) @@ -215,7 +214,7 @@ class Evolution extends JqplotDataGenerator foreach ($piwikParameters as $parameter) { unset($queryString[$parameter]); } - if (Piwik_Menu_Main::getInstance()->isUrlFound($queryString)) { + if (\Piwik\Menu\Main::getInstance()->isUrlFound($queryString)) { return $queryString; } return false; diff --git a/core/Twig.php b/core/Twig.php index c00fc2a23d..5a01f5650d 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -16,7 +16,7 @@ use Piwik\Common; use Piwik\AssetManager; use Piwik\Translate; use Piwik\Url; -use Piwik_Visualization_Sparkline; +use Piwik\Visualization\Sparkline; use Twig_Environment; use Twig_Extension_Debug; use Twig_Loader_Chain; @@ -107,9 +107,9 @@ class Twig protected function addFunction_sparkline() { $sparklineFunction = new Twig_SimpleFunction('sparkline', function ($src) { - $width = Piwik_Visualization_Sparkline::DEFAULT_WIDTH; - $height = Piwik_Visualization_Sparkline::DEFAULT_HEIGHT; - return sprintf(Piwik_Twig::SPARKLINE_TEMPLATE, $src, $width, $height); + $width = Sparkline::DEFAULT_WIDTH; + $height = Sparkline::DEFAULT_HEIGHT; + return sprintf(Twig::SPARKLINE_TEMPLATE, $src, $width, $height); }, array('is_safe' => array('html'))); $this->twig->addFunction($sparklineFunction); } diff --git a/core/View.php b/core/View.php index 3d5c68b736..e765791b72 100644 --- a/core/View.php +++ b/core/View.php @@ -22,7 +22,7 @@ use Piwik\Twig; use Piwik\QuickForm2; use Piwik_SitesManager_API; use Piwik_UsersManager_API; -use Piwik_View_Interface; +use Piwik\View\ViewInterface; use Twig_Environment; use Zend_Registry; @@ -38,7 +38,7 @@ if (!defined('PIWIK_USER_PATH')) { * * @package Piwik */ -class View implements Piwik_View_Interface +class View implements ViewInterface { private $template = ''; diff --git a/core/View/OneClickDone.php b/core/View/OneClickDone.php index d87be2dfe0..4e898e1ff7 100644 --- a/core/View/OneClickDone.php +++ b/core/View/OneClickDone.php @@ -9,6 +9,8 @@ * @package Piwik */ +namespace Piwik\View; + /** * Post-update view * @@ -21,7 +23,7 @@ * * @package Piwik */ -class Piwik_View_OneClickDone +class OneClickDone { /** * @var string diff --git a/core/View/ReportsByDimension.php b/core/View/ReportsByDimension.php index 69ac869eb8..b394736271 100644 --- a/core/View/ReportsByDimension.php +++ b/core/View/ReportsByDimension.php @@ -8,6 +8,8 @@ * @category Piwik * @package SmartyPlugins */ +namespace Piwik\View; + use Piwik\FrontController; use Piwik\View; use Piwik\Url; @@ -19,7 +21,7 @@ use Piwik\Url; * loads them by AJAX when clicked. The loaded report is displayed to the right * of the report listing. */ -class Piwik_View_ReportsByDimension extends View +class ReportsByDimension extends View { /** * Constructor. diff --git a/core/View/Interface.php b/core/View/ViewInterface.php index a1730cebef..99f3370cad 100644 --- a/core/View/Interface.php +++ b/core/View/ViewInterface.php @@ -9,12 +9,14 @@ * @package Piwik */ +namespace Piwik\View; + /** * Rendering interface for View and Piwik_Visualization * * @package Piwik */ -interface Piwik_View_Interface +interface ViewInterface { /** * Outputs the data. diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 2e0e591ed1..f89dc6ba0c 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -20,10 +20,12 @@ use Piwik\Date; use Piwik\DataTable; use Piwik\Url; use Piwik\Site; +use Piwik\ViewDataTable\Properties; +use Piwik_API_API; /** * This class is used to load (from the API) and customize the output of a given DataTable. - * The main() method will create an object implementing Piwik_View_Interface + * The main() method will create an object implementing ViewInterface * You can customize the dataTable using the disable* methods. * * You can also customize the dataTable rendering using row metadata: @@ -118,10 +120,10 @@ abstract class ViewDataTable protected $currentControllerName; /** - * This view should be an implementation of the Interface Piwik_View_Interface + * This view should be an implementation of the Interface ViewInterface * The $view object should be created in the main() method. * - * @var Piwik_View_Interface + * @var ViewInterface */ protected $view = null; @@ -189,14 +191,14 @@ abstract class ViewDataTable /** * Gets a view property by reference. * - * @param string $name A valid view property name. @see Piwik_ViewDataTable_Properties for all + * @param string $name A valid view property name. @see Properties for all * valid view properties. * @return mixed * @throws Exception if the property name is invalid. */ public function &__get($name) { - Piwik_ViewDataTable_Properties::checkValidPropertyName($name); + Properties::checkValidPropertyName($name); return $this->viewProperties[$name]; } @@ -204,7 +206,7 @@ abstract class ViewDataTable /** * Sets a view property. * - * @param string $name A valid view property name. @see Piwik_ViewDataTable_Properties for all + * @param string $name A valid view property name. @see Properties for all * valid view properties. * @param mixed $value * @return mixed Returns $value. @@ -212,7 +214,7 @@ abstract class ViewDataTable */ public function __set($name, $value) { - Piwik_ViewDataTable_Properties::checkValidPropertyName($name); + Properties::checkValidPropertyName($name); return $this->viewProperties[$name] = $value; } @@ -264,36 +266,36 @@ abstract class ViewDataTable $type = Common::getRequestVar('viewDataTable', $defaultType, 'string'); switch ($type) { case 'cloud': - $result = new Piwik_ViewDataTable_Cloud(); + $result = new ViewDataTable\Cloud(); break; case 'graphPie': - $result = new Piwik_ViewDataTable_GenerateGraphHTML_ChartPie(); + $result = new ViewDataTable\GenerateGraphHTML\ChartPie(); break; case 'graphVerticalBar': - $result = new Piwik_ViewDataTable_GenerateGraphHTML_ChartVerticalBar(); + $result = new ViewDataTable\GenerateGraphHTML\ChartVerticalBar(); break; case 'graphEvolution': - $result = new Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution(); + $result = new ViewDataTable\GenerateGraphHTML\ChartEvolution(); break; case 'sparkline': - $result = new Piwik_ViewDataTable_Sparkline(); + $result = new ViewDataTable\Sparkline(); break; case 'tableAllColumns': - $result = new Piwik_ViewDataTable_HtmlTable_AllColumns(); + $result = new ViewDataTable\HtmlTable\AllColumns(); break; case 'tableGoals': - $result = new Piwik_ViewDataTable_HtmlTable_Goals(); + $result = new ViewDataTable\HtmlTable\Goals(); break; case 'table': default: - $result = new Piwik_ViewDataTable_HtmlTable(); + $result = new ViewDataTable\HtmlTable(); break; } @@ -452,7 +454,7 @@ abstract class ViewDataTable { if (is_null($this->view)) { throw new Exception('The $this->view object has not been created. - It should be created in the main() method of the Piwik_ViewDataTable_* subclass you are using.'); + It should be created in the main() method of the ViewDataTable_* subclass you are using.'); } return $this->view; } @@ -585,7 +587,7 @@ abstract class ViewDataTable $requestArray = $this->getRequestArray(); // we make the request to the API - $request = new Piwik_API_Request($requestArray); + $request = new API\Request($requestArray); // and get the DataTable structure $dataTable = $request->process(); @@ -672,13 +674,13 @@ abstract class ViewDataTable if (!$this->areGenericFiltersDisabled()) { // Second, generic filters (Sort, Limit, Replace Column Names, etc.) $requestArray = $this->getRequestArray(); - $request = Piwik_API_Request::getRequestArrayFromString($requestArray); + $request = API\Request::getRequestArrayFromString($requestArray); if ($this->viewProperties['enable_sort'] === false) { $request['filter_sort_column'] = $request['filter_sort_order'] = ''; } - $genericFilter = new Piwik_API_DataTableGenericFilter($request); + $genericFilter = new API\DataTableGenericFilter($request); $genericFilter->filter($this->dataTable); } @@ -845,7 +847,7 @@ abstract class ViewDataTable // build javascript variables to set $javascriptVariablesToSet = array(); - $genericFilters = Piwik_API_DataTableGenericFilter::getGenericFiltersInformation(); + $genericFilters = API\DataTableGenericFilter::getGenericFiltersInformation(); foreach ($genericFilters as $filter) { foreach ($filter as $filterVariableName => $filterInfo) { // if there is a default value for this filter variable we set it @@ -1601,7 +1603,7 @@ abstract class ViewDataTable $reportMonth = $reportDate->toString('m'); if (class_exists('Piwik_PrivacyManager') - && Piwik_PrivacyManager::shouldReportBePurged($reportYear, $reportMonth) + && \Piwik_PrivacyManager::shouldReportBePurged($reportYear, $reportMonth) ) { return true; } @@ -1621,7 +1623,7 @@ abstract class ViewDataTable private function getBaseReportUrl($module, $action, $queryParams = array()) { $params = array_merge($queryParams, array('module' => $module, 'action' => $action)); - return Piwik_API_Request::getCurrentUrlWithoutGenericFilters($params); + return API\Request::getCurrentUrlWithoutGenericFilters($params); } /** @@ -1710,7 +1712,7 @@ abstract class ViewDataTable $template = $this->viewProperties['datatable_template']; } - $view = new Piwik_View($template); + $view = new View($template); if (!empty($this->loadingError)) { $view->error = $this->loadingError; diff --git a/core/ViewDataTable/Cloud.php b/core/ViewDataTable/Cloud.php index f9b5adcc6d..42b2d28775 100644 --- a/core/ViewDataTable/Cloud.php +++ b/core/ViewDataTable/Cloud.php @@ -8,17 +8,22 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable; + +use Exception; use Piwik\ViewDataTable; use Piwik\View; +use Piwik; +use Piwik\Visualization\Cloud; /** * Reads the requested DataTable from the API, and prepares the data to give - * to Piwik_Visualization_Cloud that will display the tag cloud (via the template _dataTable_cloud.twig). + * to Cloud that will display the tag cloud (via the template _dataTable_cloud.twig). * * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_Cloud extends ViewDataTable +class Cloud extends ViewDataTable { public function setDisplayLogoInTagCloud($bool) { @@ -29,7 +34,7 @@ class Piwik_ViewDataTable_Cloud extends ViewDataTable { return 'cloud'; } - + public function __construct() { parent::__construct(); @@ -62,7 +67,7 @@ class Piwik_ViewDataTable_Cloud extends ViewDataTable $this->checkStandardDataTable(); $this->postDataTableLoadedFromAPI(); - $visualization = new Piwik_Visualization_Cloud(); + $visualization = new Cloud(); $this->view = $this->buildView($visualization); } } diff --git a/core/ViewDataTable/GenerateGraphHTML.php b/core/ViewDataTable/GenerateGraphHTML.php index 90dd9decff..2d872c508a 100644 --- a/core/ViewDataTable/GenerateGraphHTML.php +++ b/core/ViewDataTable/GenerateGraphHTML.php @@ -8,12 +8,17 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable; + +use Exception; use Piwik\API\Request; use Piwik\Piwik; use Piwik\Common; use Piwik\JqplotDataGenerator; use Piwik\ViewDataTable; use Piwik\View; +use Piwik_Access_NoAccessException; +use Piwik\Visualization\JqplotGraph; /** * This class generates the HTML code to embed graphs in the page. @@ -22,7 +27,7 @@ use Piwik\View; * @package Piwik * @subpackage ViewDataTable */ -abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable +abstract class GenerateGraphHTML extends ViewDataTable { const DEFAULT_GRAPH_HEIGHT = 250; @@ -31,12 +36,12 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable public function __construct() { parent::__construct(); - + $this->disableOffsetInformationAndPaginationControls(); $this->disableExcludeLowPopulation(); $this->disableSearchBox(); $this->enableShowExportAsImageIcon(); - + $this->viewProperties['display_percentage_in_tooltip'] = true; $this->viewProperties['y_axis_unit'] = ''; $this->viewProperties['show_all_ticks'] = 0; @@ -47,7 +52,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable $this->viewProperties['row_picker_visible_rows'] = array(); $this->viewProperties['selectable_columns'] = array(); $this->viewProperties['graph_width'] = '100%'; - $this->viewProperties['graph_height'] = self::DEFAULT_GRAPH_HEIGHT.'px'; + $this->viewProperties['graph_height'] = self::DEFAULT_GRAPH_HEIGHT . 'px'; } /** @@ -108,7 +113,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable $this->setColumnTranslation('nb_conversions', Piwik_Translate('Goals_ColumnConversions')); $this->setColumnTranslation('revenue', Piwik_Translate('General_TotalRevenue')); } - + public function init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable, @@ -116,26 +121,26 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable $defaultProperties = array()) { parent::init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable, - $controllerActionCalledWhenRequestSubTable, $defaultProperties); - + $controllerActionCalledWhenRequestSubTable, $defaultProperties); + // in the case this controller is being executed by another controller // eg. when being widgetized in an IFRAME // we need to put in the URL of the graph data the real module and action $this->viewProperties['request_parameters_to_modify']['module'] = $currentControllerName; $this->viewProperties['request_parameters_to_modify']['action'] = $currentControllerAction; - + // do not sort if sorted column was initially "label" or eg. it would make "Visits by Server time" not pretty if ($this->getSortedColumn() != 'label') { $columns = $this->viewProperties['columns_to_display']; - + $firstColumn = reset($columns); if ($firstColumn == 'label') { $firstColumn = next($columns); } - + $this->setSortedColumn($firstColumn); } - + // selectable columns if ($this->viewProperties['graph_type'] != 'evolution') { $selectableColumns = array('nb_visits', 'nb_actions'); @@ -222,7 +227,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable // Graphs require the full dataset, so no filters $this->disableGenericFilters(); - + // the queued filters will be manually applied later. This is to ensure that filtering using search // will be done on the table before the labels are enhanced (see ReplaceColumnNames) $this->disableQueuedFilters(); @@ -245,8 +250,8 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends ViewDataTable // re-enable generic & queued filters so they do not appear in JS output $this->viewProperties['disable_generic_filters'] = false; $this->viewProperties['disable_queued_filters'] = false; - - $visualization = new Piwik_Visualization_JqplotGraph(); + + $visualization = new JqplotGraph(); $this->view = $this->buildView($visualization); } diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php index 32a3364ada..60eb77bce7 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php @@ -9,10 +9,13 @@ * @package Piwik */ +namespace Piwik\ViewDataTable\GenerateGraphHtml; + use Piwik\Common; use Piwik\Period\Range; use Piwik\Controller; use Piwik\Site; +use Piwik\ViewDataTable\GenerateGraphHTML; /** * Generates HTML embed for the Evolution graph @@ -20,7 +23,7 @@ use Piwik\Site; * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDataTable_GenerateGraphHTML +class ChartEvolution extends GenerateGraphHTML { const GRAPH_HEIGHT = 170; @@ -32,12 +35,12 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat * @var string */ private $originalDate; - + public function __construct() { parent::__construct(); $this->viewProperties['graph_type'] = 'evolution'; - $this->viewProperties['graph_height'] = self::GRAPH_HEIGHT.'px'; + $this->viewProperties['graph_height'] = self::GRAPH_HEIGHT . 'px'; } protected function getViewDataTableId() @@ -51,10 +54,10 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat } public function init($currentControllerName, - $currentControllerAction, - $apiMethodToRequestDataTable, - $controllerActionCalledWhenRequestSubTable = null, - $defaultProperties = array()) + $currentControllerAction, + $apiMethodToRequestDataTable, + $controllerActionCalledWhenRequestSubTable = null, + $defaultProperties = array()) { parent::init($currentControllerName, $currentControllerAction, @@ -185,7 +188,7 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat } // FIXME: This appears to be a hack used to ensure a graph is plotted even if there is no data. there's probably - // a less complicated way of doing it... (this is complicated because it modifies the request used to get + // a less complicated way of doing it... (this is complicated because it modifies the request used to get // data so a loop is entered in JqplotDataGenerator_Evolution::initChartObjectData) if (!empty($this->viewProperties['columns_to_display'])) { $columns = implode(',', $this->viewProperties['columns_to_display']); @@ -194,7 +197,7 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat return parent::getRequestArray(); } - + public function getDefaultDataTableCssClass() { return 'dataTableEvolutionGraph'; diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartPie.php b/core/ViewDataTable/GenerateGraphHTML/ChartPie.php index 5943086709..5f6e33b785 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartPie.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartPie.php @@ -8,6 +8,9 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable\GenerateGraphHtml; + +use Piwik\ViewDataTable\GenerateGraphHTML; /** * Generates HTML embed for the Pie chart @@ -15,7 +18,7 @@ * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_GenerateGraphHTML_ChartPie extends Piwik_ViewDataTable_GenerateGraphHTML +class ChartPie extends GenerateGraphHTML { public function __construct() { @@ -24,7 +27,7 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartPie extends Piwik_ViewDataTable $this->viewProperties['graph_limit'] = 6; $this->viewProperties['allow_multi_select_series_picker'] = false; } - + protected function getViewDataTableId() { return 'graphPie'; diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php b/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php index 6c6e633ba7..05d046494a 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartVerticalBar.php @@ -8,6 +8,9 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable\GenerateGraphHtml; + +use Piwik\ViewDataTable\GenerateGraphHTML; /** * @@ -17,7 +20,7 @@ * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_GenerateGraphHTML_ChartVerticalBar extends Piwik_ViewDataTable_GenerateGraphHTML +class ChartVerticalBar extends GenerateGraphHTML { public function __construct() { @@ -25,7 +28,7 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartVerticalBar extends Piwik_ViewD $this->viewProperties['graph_type'] = 'bar'; $this->viewProperties['graph_limit'] = 6; } - + protected function getViewDataTableId() { return 'graphVerticalBar'; diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php index 0a25665203..67f2d39a94 100644 --- a/core/ViewDataTable/HtmlTable.php +++ b/core/ViewDataTable/HtmlTable.php @@ -8,12 +8,16 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable; + +use Exception; use Piwik\Config; use Piwik\DataTable\Renderer; use Piwik\Piwik; use Piwik\Common; use Piwik\ViewDataTable; use Piwik\View; +use Piwik\Visualization; /** * Outputs an AJAX Table for a given DataTable. @@ -23,7 +27,7 @@ use Piwik\View; * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_HtmlTable extends ViewDataTable +class HtmlTable extends ViewDataTable { /** * PHP array conversion of the DataTable @@ -31,7 +35,7 @@ class Piwik_ViewDataTable_HtmlTable extends ViewDataTable * @var array */ public $arrayDataTable; // phpArray - + public function __construct() { parent::__construct(); @@ -39,13 +43,13 @@ class Piwik_ViewDataTable_HtmlTable extends ViewDataTable $this->viewProperties['enable_sort'] = '1'; $this->viewProperties['disable_row_evolution'] = false; $this->viewProperties['disable_row_actions'] = false; - + $this->setLimit(Config::getInstance()->General['datatable_default_limit']); $this->handleLowPopulation(); $this->setSubtableTemplate("@CoreHome/_dataTable.twig"); $this->viewProperties['datatable_js_type'] = 'dataTable'; } - + public function getJavaScriptProperties() { $result = parent::getJavaScriptProperties(); @@ -83,79 +87,34 @@ class Piwik_ViewDataTable_HtmlTable extends ViewDataTable $this->postDataTableLoadedFromAPI(); $template = $this->idSubtable ? $this->viewProperties['subtable_template'] : $this->viewProperties['datatable_template']; - $this->view = $this->buildView(new Piwik_Visualization_HtmlTable(), $template); + $this->view = $this->buildView(new Visualization\HtmlTable(), $template); } - + public function getDefaultDataTableCssClass() { return 'dataTableNormal'; } - + public function setDataTableCssClass($type) { $this->viewProperties['datatable_css_class'] = $type; } - + public function setJsType($type) { $this->viewProperties['datatable_js_type'] = $type; } - + public function setSubtableTemplate($subtableTemplate) { $this->viewProperties['subtable_template'] = $subtableTemplate; } - + public function showExpanded() { $this->viewProperties['show_expanded'] = true; } - /** - * @return Piwik_View with all data set - */ - protected function buildView() - { - $template = $this->idSubtable ? $this->viewProperties['subtable_template'] : $this->dataTableTemplate; - $view = new Piwik_View($template); - - if (!empty($this->loadingError)) { - $view->error = $this->loadingError; - } - - if (!$this->isDataAvailable) { - $view->dataTable = null; - } else { - $columns = $this->getColumnsToDisplay(); - $columnTranslations = $columnDocumentation = array(); - foreach ($columns as $columnName) { - $columnTranslations[$columnName] = $this->getColumnTranslation($columnName); - $columnDocumentation[$columnName] = $this->getMetricDocumentation($columnName); - } - $nbColumns = count($columns); - // case no data in the array we use the number of columns set to be displayed - if ($nbColumns == 0) { - $nbColumns = count($this->viewProperties['columns_to_display']); - } - - $view->dataTable = $this->dataTable; - $view->dataTableColumns = $columns; - $view->reportDocumentation = $this->getReportDocumentation(); - $view->columnTranslations = $columnTranslations; - $view->columnDocumentation = $columnDocumentation; - $view->nbColumns = $nbColumns; - $view->defaultWhenColumnValueNotDefined = '-'; - - // if it's likely that the report data for this data table has been purged, - // set whether we should display a message to that effect. - $view->showReportDataWasPurgedMessage = $this->hasReportBeenPurged(); - $view->deleteReportsOlderThan = Piwik_GetOption('delete_reports_older_than'); - } - $view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet(); - $view->properties = $this->getViewProperties(); - return $view; - } - protected function handleLowPopulation($columnToApplyFilter = null) { if (Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') == '0') { @@ -168,23 +127,6 @@ class Piwik_ViewDataTable_HtmlTable extends ViewDataTable } /** - * Returns friendly php array from the Piwik_DataTable - * @see Piwik_DataTable_Renderer_Php - * @return array - */ - protected function getPHPArrayFromDataTable() - { - $renderer = Piwik_DataTable_Renderer::factory('php'); - $renderer->setTable($this->dataTable); - $renderer->setSerialize(false); - // we get the php array from the datatable but conserving the original datatable format, - // ie. rows 'columns', 'metadata' and 'idsubdatatable' - $phpArray = $renderer->originalRender(); - return $phpArray; - } - - - /** * Adds a column to the list of columns to be displayed * * @param string $columnName @@ -227,5 +169,4 @@ class Piwik_ViewDataTable_HtmlTable extends ViewDataTable { $this->viewProperties['disable_row_actions'] = true; } - } diff --git a/core/ViewDataTable/HtmlTable/AllColumns.php b/core/ViewDataTable/HtmlTable/AllColumns.php index b2f5305efa..a23cca3cde 100644 --- a/core/ViewDataTable/HtmlTable/AllColumns.php +++ b/core/ViewDataTable/HtmlTable/AllColumns.php @@ -8,13 +8,16 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable\HtmlTable; + use Piwik\Controller; +use Piwik\ViewDataTable\HtmlTable; /** * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_HtmlTable_AllColumns extends Piwik_ViewDataTable_HtmlTable +class AllColumns extends HtmlTable { protected function getViewDataTableId() { diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php index 8b575a0f2f..af4f3cedd0 100644 --- a/core/ViewDataTable/HtmlTable/Goals.php +++ b/core/ViewDataTable/HtmlTable/Goals.php @@ -8,16 +8,21 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable\HtmlTable; + use Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal; use Piwik\Piwik; use Piwik\Common; use Piwik\Site; +use Piwik\ViewDataTable\HtmlTable; +use Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal; +use Piwik_Goals_API; /** * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable +class Goals extends HtmlTable { private $processOnlyIdGoal = null; private $isEcommerce = false; @@ -33,8 +38,8 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable $this->viewProperties['subtable_controller_action'] = null; } - $this->idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); - $this->processOnlyIdGoal = Piwik_Common::getRequestVar('idGoal', Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW, 'string'); + $this->idSite = Common::getRequestVar('idSite', null, 'int'); + $this->processOnlyIdGoal = Common::getRequestVar('idGoal', \Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW, 'string'); $this->isEcommerce = $this->processOnlyIdGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER; $this->viewProperties['show_exclude_low_population'] = true; $this->viewProperties['show_goals'] = true; @@ -44,7 +49,6 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable array('<br />', '<br />', '<a href="http://piwik.org/docs/tracking-goals-web-analytics/" target="_blank">', '</a>'))); } - $this->setMetricDocumentation('nb_visits', Piwik_Translate('Goals_ColumnVisits')); if ($this->isEcommerce) { $this->setMetricDocumentation('revenue_per_visit', Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('General_EcommerceOrders'))); diff --git a/core/ViewDataTable/Properties.php b/core/ViewDataTable/Properties.php index 8813a8889f..5c4c7e1fd4 100644 --- a/core/ViewDataTable/Properties.php +++ b/core/ViewDataTable/Properties.php @@ -9,18 +9,23 @@ * @package Piwik */ +namespace Piwik\ViewDataTable; + +use Exception; +use ReflectionClass; + /** * Contains the list of all core DataTable display properties for use with ViewDataTable. - * + * * @see Piwik_ViewDataTable for more info. - * + * * TODO: change the names of properties to match the const names where appropriate. */ -class Piwik_ViewDataTable_Properties +class Properties { /** * This property determines which Twig template to use when rendering a ViewDataTable. - * + * * TODO: shouldn't have this property. should only use visualization classes. */ const DATATABLE_TEMPLATE = 'datatable_template'; @@ -42,14 +47,14 @@ class Piwik_ViewDataTable_Properties /** * Controls the sort order. Either 'asc' or 'desc'. - * + * * @see self::SORTED_COLUMN */ const SORT_ORDER = 'filter_sort_order'; /** * The limit used when rendering a jqPlot graph. - * + * * TODO: either replace w/ filter_limit, or make it a visualization property. */ const GRAPH_LIMIT = 'graph_limit'; @@ -77,7 +82,7 @@ class Piwik_ViewDataTable_Properties /** * The unit to display in jqPlot graphs. - * + * * TODO: Either this should be a visualization property, or should be named something different. */ const Y_AXIS_UNIT = 'y_axis_unit'; @@ -95,7 +100,7 @@ class Piwik_ViewDataTable_Properties /** * Array property that determines which columns will be shown. Columns not in this array * should not appear in ViewDataTable visualizations. - * + * * Example: array('label', 'nb_visits', 'nb_uniq_visitors') */ const COLUMNS_TO_DISPLAY = 'columns_to_display'; @@ -134,7 +139,7 @@ class Piwik_ViewDataTable_Properties /** * Array property that contains the names of columns that can be selected in the Series Picker. - * + * * TODO: this is only applicable to graph views. move this. */ const SELECTABLE_COLUMNS = 'selectable_columns'; @@ -147,7 +152,7 @@ class Piwik_ViewDataTable_Properties /** * Returns the set of all valid ViewDataTable properties. The result is an array with property * name as a key. Values of the array are undefined. - * + * * @return array */ public static function getAllProperties() @@ -173,7 +178,7 @@ class Piwik_ViewDataTable_Properties $properties = self::getAllProperties(); if (!isset($properties[$name])) { throw new Exception("Invalid ViewDataTable display property '$name'. Is this a visualization property? " - . "If so, set it with \$view->visualization_properties->$name = ..."); + . "If so, set it with \$view->visualization_properties->$name = ..."); } } }
\ No newline at end of file diff --git a/core/ViewDataTable/Sparkline.php b/core/ViewDataTable/Sparkline.php index 30a2c4239b..0560dbab71 100644 --- a/core/ViewDataTable/Sparkline.php +++ b/core/ViewDataTable/Sparkline.php @@ -8,9 +8,13 @@ * @category Piwik * @package Piwik */ +namespace Piwik\ViewDataTable; + +use Exception; use Piwik\Common; use Piwik\DataTable; use Piwik\ViewDataTable; +use Piwik\Visualization\Sparkline; /** * Reads the requested DataTable from the API and prepare data for the Sparkline view. @@ -18,7 +22,7 @@ use Piwik\ViewDataTable; * @package Piwik * @subpackage ViewDataTable */ -class Piwik_ViewDataTable_Sparkline extends ViewDataTable +class Sparkline extends ViewDataTable { protected function getViewDataTableId() { @@ -50,7 +54,7 @@ class Piwik_ViewDataTable_Sparkline extends ViewDataTable $values = array_fill(0, 30, 0); } - $graph = new Piwik_Visualization_Sparkline(); + $graph = new Sparkline(); $graph->setValues($values); $height = Common::getRequestVar('height', 0, 'int'); diff --git a/core/Visualization/Chart.php b/core/Visualization/Chart.php index 04db6d312d..b580f78e1c 100644 --- a/core/Visualization/Chart.php +++ b/core/Visualization/Chart.php @@ -8,8 +8,11 @@ * @category Piwik * @package Piwik */ +namespace Piwik\Visualization; + use Piwik\Piwik; use Piwik\Common; +use Piwik\View\ViewInterface; /** * Generates the data in the Open Flash Chart format, from the given data. @@ -17,7 +20,7 @@ use Piwik\Common; * @package Piwik * @subpackage Piwik_Visualization */ -abstract class Piwik_Visualization_Chart implements Piwik_View_Interface +abstract class Chart implements ViewInterface { // the data kept here conforms to the jqplot data layout @@ -157,8 +160,8 @@ abstract class Piwik_Visualization_Chart implements Piwik_View_Interface // See http://www.jqplot.com/docs/files/jqPlotOptions-txt.html $data = array( 'params' => array( - 'axes' => &$this->axes, - 'series' => &$this->series + 'axes' => &$this->axes, + 'series' => &$this->series ), 'data' => &$this->data, 'tooltip' => &$this->tooltip, @@ -181,5 +184,4 @@ abstract class Piwik_Visualization_Chart implements Piwik_View_Interface } } } - } diff --git a/core/Visualization/Chart/Evolution.php b/core/Visualization/Chart/Evolution.php index db00d00bce..0ad55acb40 100644 --- a/core/Visualization/Chart/Evolution.php +++ b/core/Visualization/Chart/Evolution.php @@ -9,13 +9,17 @@ * @package Piwik */ +namespace Piwik\Visualization\Chart; + +use Piwik\Visualization\Chart; + /** * Customize the Evolution chart style * * @package Piwik * @subpackage Piwik_Visualization */ -class Piwik_Visualization_Chart_Evolution extends Piwik_Visualization_Chart +class Evolution extends Chart { const SERIES_COLOR_COUNT = 8; diff --git a/core/Visualization/Chart/Pie.php b/core/Visualization/Chart/Pie.php index cd0e137ebf..e0f4a37857 100644 --- a/core/Visualization/Chart/Pie.php +++ b/core/Visualization/Chart/Pie.php @@ -9,13 +9,17 @@ * @package Piwik */ +namespace Piwik\Visualization\Chart; + +use Piwik\Visualization\Chart; + /** * Customize & set values for the Flash Pie chart * * @package Piwik * @subpackage Piwik_Visualization */ -class Piwik_Visualization_Chart_Pie extends Piwik_Visualization_Chart +class Pie extends Chart { function customizeChartProperties() { diff --git a/core/Visualization/Chart/VerticalBar.php b/core/Visualization/Chart/VerticalBar.php index dab4a8ef16..c6ec8f08d3 100644 --- a/core/Visualization/Chart/VerticalBar.php +++ b/core/Visualization/Chart/VerticalBar.php @@ -9,13 +9,17 @@ * @package Piwik */ +namespace Piwik\Visualization\Chart; + +use Piwik\Visualization\Chart; + /** * Customize & set values for the Vertical bar chart * * @package Piwik * @subpackage Piwik_Visualization */ -class Piwik_Visualization_Chart_VerticalBar extends Piwik_Visualization_Chart +class VerticalBar extends Chart { public function customizeChartProperties() { diff --git a/core/Visualization/Cloud.php b/core/Visualization/Cloud.php index 0d2d63e0a7..8ea132f7aa 100644 --- a/core/Visualization/Cloud.php +++ b/core/Visualization/Cloud.php @@ -8,7 +8,11 @@ * @category Piwik * @package Piwik */ +namespace Piwik\Visualization; + use Piwik\Common; +use Piwik\View; +use Piwik_DataTable; /** * Generates a tag cloud from a given data array. @@ -19,7 +23,7 @@ use Piwik\Common; * @package Piwik * @subpackage Piwik_Visualization */ -class Piwik_Visualization_Cloud +class Cloud { /** Used by integration tests to make sure output is consistent. */ public static $debugDisableShuffle = false; @@ -44,12 +48,12 @@ class Piwik_Visualization_Cloud /** * Renders this visualization. - * + * * @param Piwik_DataTable $dataTable */ public function render($dataTable, $properties) { - $view = new Piwik_View("@CoreHome/_dataTableViz_tagCloud.twig"); + $view = new View("@CoreHome/_dataTableViz_tagCloud.twig"); $view->properties = $properties; $columnToDisplay = $properties['columns_to_display'][1]; diff --git a/core/Visualization/HtmlTable.php b/core/Visualization/HtmlTable.php index c35c76f5f3..2992f09495 100644 --- a/core/Visualization/HtmlTable.php +++ b/core/Visualization/HtmlTable.php @@ -9,20 +9,25 @@ * @package Piwik */ +namespace Piwik\Visualization; + +use Piwik\DataTable; +use Piwik\View; + /** * DataTable visualization that shows DataTable data in an HTML table. */ -class Piwik_Visualization_HtmlTable +class HtmlTable { /** * Renders this visualization. - * - * @param Piwik_DataTable $dataTable + * + * @param DataTable $dataTable * @param array $properties View Properties. */ - public function render($dataTable, $properties) + public function render(DataTable $dataTable, $properties) { - $view = new Piwik_View("@CoreHome/_dataTableViz_htmlTable.twig"); + $view = new View("@CoreHome/_dataTableViz_htmlTable.twig"); $view->properties = $properties; $view->dataTable = $dataTable; return $view->render(); diff --git a/core/Visualization/JqplotGraph.php b/core/Visualization/JqplotGraph.php index 4a213ae39b..6368880d7c 100644 --- a/core/Visualization/JqplotGraph.php +++ b/core/Visualization/JqplotGraph.php @@ -9,20 +9,26 @@ * @package Piwik */ +namespace Piwik\Visualization; + +use Piwik\View; +use Piwik\JqplotDataGenerator; +use Piwik_DataTable; + /** * DataTable visualization that displays DataTable data in a JQPlot graph. */ -class Piwik_Visualization_JqplotGraph +class JqplotGraph { /** * Renders this visualization. - * + * * @param Piwik_DataTable $dataTable * @param array $properties View Properties. */ public function render($dataTable, $properties) { - $view = new Piwik_View("@CoreHome/_dataTableViz_jqplotGraph.twig"); + $view = new View("@CoreHome/_dataTableViz_jqplotGraph.twig"); $view->properties = $properties; $view->dataTable = $dataTable; $view->data = $this->getGraphData($dataTable, $properties); @@ -35,8 +41,8 @@ class Piwik_Visualization_JqplotGraph private function getGraphData($dataTable, $properties) { $properties = array_merge($properties, $properties['request_parameters_to_modify']); - $dataGenerator = Piwik_JqplotDataGenerator::factory($properties['graph_type'], $properties); - + $dataGenerator = JqplotDataGenerator::factory($properties['graph_type'], $properties); + $jsonData = $dataGenerator->generate($dataTable); return str_replace(array("\r", "\n"), '', $jsonData); } diff --git a/core/Visualization/Sparkline.php b/core/Visualization/Sparkline.php index e7165fbb15..7d5c643436 100644 --- a/core/Visualization/Sparkline.php +++ b/core/Visualization/Sparkline.php @@ -9,6 +9,12 @@ * @package Piwik */ +namespace Piwik\Visualization; + +use Piwik\Common; +use Piwik\View\ViewInterface; +use Sparkline_Line; + /** * @see libs/sparkline/lib/Sparkline_Line.php * @link http://sparkline.org @@ -22,13 +28,13 @@ require_once PIWIK_INCLUDE_PATH . '/libs/sparkline/lib/Sparkline_Line.php'; * @package Piwik * @subpackage Piwik_Visualization */ -class Piwik_Visualization_Sparkline implements Piwik_View_Interface +class Sparkline implements ViewInterface { const DEFAULT_WIDTH = 100; const DEFAULT_HEIGHT = 25; private static $colorNames = array('lineColor', 'red', 'blue', 'green'); - + /** * Width of the sparkline * @var int @@ -146,7 +152,7 @@ class Piwik_Visualization_Sparkline implements Piwik_View_Interface private function setSparklineColors($sparkline) { - $colors = Piwik_Common::getRequestVar('colors', false, 'json'); + $colors = Common::getRequestVar('colors', false, 'json'); if (!empty($colors)) { foreach (self::$colorNames as $name) { if (!empty($colors[$name])) { diff --git a/core/functions.php b/core/functions.php index 81ef9326cc..f049f4db5b 100644 --- a/core/functions.php +++ b/core/functions.php @@ -43,6 +43,16 @@ namespace { EventDispatcher::getInstance()->addObserver($eventName, $function); } + /** + * Posts an event if we are currently running tests. Whether we are running tests is + * determined by looking for the PIWIK_TEST_MODE constant. + */ + function Piwik_PostTestEvent($eventName, $params = array(), $pending = false, $plugins = null) + { + if (defined('PIWIK_TEST_MODE')) { + Piwik_PostEvent($eventName, $params, $pending, $plugins); + } + } /** * Returns translated string or given message if translation is not found. diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php index 36002fe2de..9ce7800197 100644 --- a/plugins/Actions/Controller.php +++ b/plugins/Actions/Controller.php @@ -87,66 +87,66 @@ class Piwik_Actions_Controller extends Controller public function getPageUrls($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getEntryPageUrls($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getExitPageUrls($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getSiteSearchKeywords($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getSiteSearchNoResultKeywords($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getSiteSearchCategories($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getPageUrlsFollowingSiteSearch($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getPageTitlesFollowingSiteSearch($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getPageTitles($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getEntryPageTitles($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getExitPageTitles($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getDownloads($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getOutlinks($fetch = false) { - return ViewDataTable::render($this->pluginName, __FUNCTION__, $fetch); + return ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } } diff --git a/plugins/Annotations/API.php b/plugins/Annotations/API.php index 8e2ec1c167..a26c0dabc8 100755 --- a/plugins/Annotations/API.php +++ b/plugins/Annotations/API.php @@ -12,6 +12,7 @@ use Piwik\Period; use Piwik\Period\Range; use Piwik\Piwik; use Piwik\Date; +use Piwik\ViewDataTable\GenerateGraphHtml\ChartEvolution; /** * @see plugins/Annotations/AnnotationList.php @@ -329,7 +330,7 @@ class Piwik_Annotations_API } else // if the range includes the last N periods { list($date, $lastN) = - Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($period, $date, $lastN); + ChartEvolution::getDateRangeAndLastN($period, $date, $lastN); list($startDate, $endDate) = explode(',', $date); $startDate = Date::factory($startDate); diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 7ccf51921e..b4de7b1d1d 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -161,7 +161,7 @@ class Piwik_CoreAdminHome_Controller extends Admin // get currencies for each viewable site $view->currencySymbols = Piwik_SitesManager_API::getInstance()->getCurrencySymbols(); - $view->serverSideDoNotTrackEnabled = Piwik_PrivacyManager_Controller::isDntSupported(); + $view->serverSideDoNotTrackEnabled = \Piwik_PrivacyManager_Controller::isDntSupported(); echo $view->render(); } diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 52539d400e..15ff5f7d48 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -20,6 +20,7 @@ use Piwik\Url; use Piwik\UpdateCheck; use Piwik\Site; + /** * * @package Piwik_CoreHome @@ -138,7 +139,7 @@ class Piwik_CoreHome_Controller extends Controller public function getRowEvolutionPopover() { $rowEvolution = $this->makeRowEvolution($isMulti = false); - $view = new Piwik_View('@CoreHome/getRowEvolutionPopover'); + $view = new View('@CoreHome/getRowEvolutionPopover'); echo $rowEvolution->renderPopover($this, $view); } @@ -146,7 +147,7 @@ class Piwik_CoreHome_Controller extends Controller public function getMultiRowEvolutionPopover() { $rowEvolution = $this->makeRowEvolution($isMulti = true); - $view = new Piwik_View('@CoreHome/getMultiRowEvolutionPopover'); + $view = new View('@CoreHome/getMultiRowEvolutionPopover'); echo $rowEvolution->renderPopover($this, $view); } diff --git a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php index fa6478c167..d23a2fff83 100644 --- a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php @@ -59,7 +59,7 @@ class Piwik_CoreHome_DataTableRowAction_MultiRowEvolution /** * Render the popover * @param Piwik_CoreHome_Controller - * @param Piwik_View (the popover_rowevolution template) + * @param View (the popover_rowevolution template) */ public function renderPopover($controller, $view) { diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php index 7b2c908bd1..d7469643ff 100644 --- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php @@ -15,6 +15,8 @@ use Piwik\Metrics; use Piwik\Date; use Piwik\ViewDataTable; use Piwik\Url; +use Piwik\ViewDataTable\GenerateGraphHtml\ChartEvolution; +use Piwik\Visualization\Chart\Evolution; /** * ROW EVOLUTION @@ -97,7 +99,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution // handle day, week, month and year: display last X periods $end = $date->toString(); list($this->date, $lastN) = - Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($this->period, $end); + ChartEvolution::getDateRangeAndLastN($this->period, $end); } $this->segment = \Piwik\API\Request::getRawSegmentFromRequest(); @@ -107,7 +109,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution /** * Render the popover * @param Piwik_CoreHome_Controller - * @param Piwik_View (the popover_rowevolution template) + * @param View (the popover_rowevolution template) */ public function renderPopover($controller, $view) { @@ -211,7 +213,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution */ protected function getMetricsToggles() { - $chart = new Piwik_Visualization_Chart_Evolution; + $chart = new Evolution; $i = 0; $metrics = array(); diff --git a/plugins/CoreHome/templates/_dataTable.twig b/plugins/CoreHome/templates/_dataTable.twig index 9aa0757f28..4e12cac5a4 100644 --- a/plugins/CoreHome/templates/_dataTable.twig +++ b/plugins/CoreHome/templates/_dataTable.twig @@ -1,4 +1,4 @@ -{% set summaryRowId = -1 %}{# ID_SUMMARY_ROW #} +{% set summaryRowId = constant('Piwik\\DataTable::ID_SUMMARY_ROW') %}{# ID_SUMMARY_ROW #} {% set isSubtable = javascriptVariablesToSet.idSubtable is defined and javascriptVariablesToSet.idSubtable != 0 %} <div class="dataTable {{ properties.datatable_css_class }} {% if isSubtable %}subDataTable{% endif %}" data-table-type="{{ properties.datatable_js_type|default('dataTable') }}" diff --git a/plugins/CoreHome/templates/_dataTableViz_htmlTable.twig b/plugins/CoreHome/templates/_dataTableViz_htmlTable.twig index 825fb6b6a5..aa3911f628 100644 --- a/plugins/CoreHome/templates/_dataTableViz_htmlTable.twig +++ b/plugins/CoreHome/templates/_dataTableViz_htmlTable.twig @@ -4,7 +4,7 @@ <tbody> {% for rowId, row in dataTable.getRows() %} {%- set rowHasSubtable = row.getIdSubDataTable() and properties.subtable_controller_action is not null -%} - {%- set shouldHighlightRow = rowId == constant("Piwik_DataTable::ID_SUMMARY_ROW") and properties.highlight_summary_row -%} + {%- set shouldHighlightRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') and properties.highlight_summary_row -%} {# display this row if it doesn't have a subtable or if we don't replace the row with the subtable #} {% if not rowHasSubtable or not properties.show_expanded|default(false) or not properties.replace_row_with_subtable|default(false) %} diff --git a/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig b/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig index 7f027b458e..16ef990aa6 100644 --- a/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig +++ b/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig @@ -1,4 +1,4 @@ -{% set seriesColorCount = constant("Piwik_Visualization_Chart_Evolution::SERIES_COLOR_COUNT") %} +{% set seriesColorCount = constant("Evolution::SERIES_COLOR_COUNT") %} <div class="rowevolution multirowevolution"> <div class="popover-title">{{ 'RowEvolution_MultiRowEvolutionTitle'|translate }}</div> <div class="graph"> diff --git a/plugins/CoreHome/templates/getRowEvolutionPopover.twig b/plugins/CoreHome/templates/getRowEvolutionPopover.twig index 4c38c80ac7..fab9fb2437 100644 --- a/plugins/CoreHome/templates/getRowEvolutionPopover.twig +++ b/plugins/CoreHome/templates/getRowEvolutionPopover.twig @@ -1,4 +1,4 @@ -{% set seriesColorCount = constant("Piwik_Visualization_Chart_Evolution::SERIES_COLOR_COUNT") %} +{% set seriesColorCount = constant("Evolution::SERIES_COLOR_COUNT") %} <div class="rowevolution"> <div class="popover-title">{{ popoverTitle | raw }}</div> <div class="graph"> diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 642071148c..efc492417b 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -20,6 +20,7 @@ use Piwik\View; use Piwik\Version; use Piwik\UpdateCheck; use Piwik\Unzip; +use Piwik\View\OneClickDone; /** * @@ -90,7 +91,7 @@ class Piwik_CoreUpdater_Controller extends Controller } // this is a magic template to trigger the Piwik_View_Update - $view = new Piwik_View_OneClickDone(Piwik::getCurrentUserTokenAuth()); + $view = new OneClickDone(Piwik::getCurrentUserTokenAuth()); $view->coreError = $errorMessage; $view->feedbackMessages = $messages; echo $view->render(); diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 467933d1e3..d6b6b0e45f 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -10,6 +10,7 @@ */ use Piwik\Piwik; use Piwik\Date; +use Piwik\Common; use Piwik\ScheduledTask; use Piwik\Plugin; @@ -285,7 +286,7 @@ class Piwik_DBStats extends Plugin $runPrettySizeFilterBeforeGeneric = false; $viewDataTable = empty($properties['default_view_type']) ? 'table' : $properties['default_view_type']; - $viewDataTable = Piwik_Common::getRequestVar('viewDataTable', $viewDataTable); + $viewDataTable = Common::getRequestVar('viewDataTable', $viewDataTable); if ($viewDataTable == 'table') { // add summary row only if displaying a table diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index d279c4fcad..086e949953 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -118,7 +118,7 @@ class Piwik_ExampleUI_Controller extends Controller $view = ViewDataTable::factory( 'sparkline', 'ExampleUI.getTemperaturesEvolution', $controllerAction = 'ExampleUI.generateSparkline'); - $serverRequested = Piwik_Common::getRequestVar('server', false); + $serverRequested = Common::getRequestVar('server', false); if ($serverRequested !== false) { $view->columns_to_display = array($serverRequested); } diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index 1f3488656a..1ac46c9ca0 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -15,6 +15,7 @@ use Piwik\Common; use Piwik\DataTable; use Piwik\Controller; use Piwik\FrontController; +use Piwik\View\ReportsByDimension; use Piwik\ViewDataTable; use Piwik\View; @@ -406,7 +407,7 @@ class Piwik_Goals_Controller extends Controller { $preloadAbandonedCart = $cartNbConversions !== false && $conversions == 0; - $goalReportsByDimension = new Piwik_View_ReportsByDimension(); + $goalReportsByDimension = new ReportsByDimension(); // add ecommerce reports $ecommerceCustomParams = array(); diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 438b178620..3e708d4d79 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -83,7 +83,7 @@ class Piwik_Live_Controller extends Controller public function indexVisitorLog() { - $view = new Piwik_View('@Live/indexVisitorLog.twig'); + $view = new View('@Live/indexVisitorLog.twig'); $view->filterEcommerce = Common::getRequestVar('filterEcommerce', 0, 'int'); $view->visitorLog = $this->getLastVisitsDetails($fetch = true); echo $view->render(); @@ -119,7 +119,7 @@ class Piwik_Live_Controller extends Controller private function setCounters($view) { - $segment = Piwik_API_Request::getRawSegmentFromRequest(); + $segment = Request::getRawSegmentFromRequest(); $last30min = Piwik_Live_API::getInstance()->getCounters($this->idSite, $lastMinutes = 30, $segment); $last30min = $last30min[0]; $today = Piwik_Live_API::getInstance()->getCounters($this->idSite, $lastMinutes = 24 * 60, $segment); diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index c7fe556fe0..dfa08ce8c5 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -9,6 +9,7 @@ * @package Piwik_Live */ use Piwik\Plugin; +use Piwik\Common; use Piwik\WidgetsList; /** @@ -79,7 +80,7 @@ class Piwik_Live extends Plugin // set a very high row count so that the next link in the footer of the data table is always shown 'totalRows' => 10000000, - 'filterEcommerce' => Piwik_Common::getRequestVar('filterEcommerce', 0, 'int'), + 'filterEcommerce' => Common::getRequestVar('filterEcommerce', 0, 'int'), 'pageUrlNotDefined' => Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL')) ), ); diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php index 988f839cfa..017f47dad9 100644 --- a/plugins/Referers/Controller.php +++ b/plugins/Referers/Controller.php @@ -105,7 +105,7 @@ class Piwik_Referers_Controller extends Controller // only display the reports by dimension view if there are visits if ($visits > 0) { - $referrersReportsByDimension = new Piwik_View_ReportsByDimension(); + $referrersReportsByDimension = new View_ReportsByDimension(); $referrersReportsByDimension->addReport( 'Referers_ViewAllReferrers', 'Referers_WidgetGetAll', 'Referers.getAll'); @@ -175,7 +175,7 @@ class Piwik_Referers_Controller extends Controller public function indexWebsites($fetch = false) { - $view = new Piwik_View('@Referers/indexWebsites'); + $view = new View('@Referers/indexWebsites'); $view->websites = $this->getWebsites(true); $view->socials = $this->getSocials(true); if ($fetch) { diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php index abda5df50e..7a6307769f 100644 --- a/plugins/Referers/Referers.php +++ b/plugins/Referers/Referers.php @@ -10,6 +10,7 @@ */ use Piwik\ArchiveProcessor; use Piwik\Piwik; +use Piwik\Common; use Piwik\Plugin; use Piwik\WidgetsList; @@ -309,16 +310,16 @@ class Piwik_Referers extends Plugin private function getDisplayPropertiesForGetRefererType() { - $idSubtable = Piwik_Common::getRequestVar('idSubtable', false); + $idSubtable = Common::getRequestVar('idSubtable', false); $labelColumnTitle = Piwik_Translate('Referers_ColumnRefererType'); switch ($idSubtable) { - case Piwik_Common::REFERER_TYPE_SEARCH_ENGINE: + case Common::REFERER_TYPE_SEARCH_ENGINE: $labelColumnTitle = Piwik_Translate('Referers_ColumnSearchEngine'); break; - case Piwik_Common::REFERER_TYPE_WEBSITE: + case Common::REFERER_TYPE_WEBSITE: $labelColumnTitle = Piwik_Translate('Referers_ColumnWebsite'); break; - case Piwik_Common::REFERER_TYPE_CAMPAIGN: + case Common::REFERER_TYPE_CAMPAIGN: $labelColumnTitle = Piwik_Translate('Referers_ColumnCampaign'); break; default: @@ -420,7 +421,7 @@ class Piwik_Referers extends Plugin 'translations' => array('label' => Piwik_Translate('Referers_ColumnSocial')) ); - $widget = Piwik_Common::getRequestVar('widget', false); + $widget = Common::getRequestVar('widget', false); if (empty($widget)) { $result['show_footer_message'] = Piwik_Translate('Referers_SocialFooterMessage'); } @@ -487,16 +488,16 @@ class Piwik_Referers extends Plugin // get singular label for referrer type $indexTranslation = ''; switch ($referrerType) { - case Piwik_Common::REFERER_TYPE_DIRECT_ENTRY: + case Common::REFERER_TYPE_DIRECT_ENTRY: $indexTranslation = 'Referers_DirectEntry'; break; - case Piwik_Common::REFERER_TYPE_SEARCH_ENGINE: + case Common::REFERER_TYPE_SEARCH_ENGINE: $indexTranslation = 'Referers_ColumnKeyword'; break; - case Piwik_Common::REFERER_TYPE_WEBSITE: + case Common::REFERER_TYPE_WEBSITE: $indexTranslation = 'Referers_ColumnWebsite'; break; - case Piwik_Common::REFERER_TYPE_CAMPAIGN: + case Common::REFERER_TYPE_CAMPAIGN: $indexTranslation = 'Referers_ColumnCampaign'; break; default: diff --git a/plugins/UserSettings/Archiver.php b/plugins/UserSettings/Archiver.php index 8ce5c83b88..d6ff51d459 100644 --- a/plugins/UserSettings/Archiver.php +++ b/plugins/UserSettings/Archiver.php @@ -21,9 +21,9 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; /** * Archiver for UserSettings Plugin * - * @see Piwik_PluginsArchiver + * @see PluginsArchiver */ -class Piwik_UserSettings_Archiver extends Piwik_PluginsArchiver +class Piwik_UserSettings_Archiver extends PluginsArchiver { const LANGUAGE_RECORD_NAME = 'UserSettings_language'; const PLUGIN_RECORD_NAME = 'UserSettings_plugin'; diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index c1285f61cd..9b652577d3 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -190,7 +190,7 @@ class Piwik_VisitTime extends Plugin // create a period instance try { - $oPeriod = Period::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date); + $oPeriod = Period::makePeriodFromQueryParams(Site::getTimezoneFor($idSite), $period, $date); } catch (Exception $ex) { return ''; // if query params are incorrect, forget about the footer message } diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index a46eae1104..a656e73804 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -11,6 +11,7 @@ use Piwik\ArchiveProcessor; use Piwik\FrontController; use Piwik\Plugin; +use Piwik\Metrics; use Piwik\WidgetsList; /** @@ -199,7 +200,7 @@ class Piwik_VisitorInterest extends Plugin 'filter_sort_column' => 'label', 'filter_sort_order' => 'asc', 'translations' => array('label' => Piwik_Translate('VisitorInterest_VisitNum'), - 'nb_visits_percentage' => Piwik_Metrics::getPercentVisitColumn()), + 'nb_visits_percentage' => Metrics::getPercentVisitColumn()), 'show_exclude_low_population' => false, 'show_offset_information' => false, 'show_pagination_control' => false, diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php index c67b850249..4bc553a94d 100644 --- a/plugins/VisitsSummary/Controller.php +++ b/plugins/VisitsSummary/Controller.php @@ -138,7 +138,8 @@ class Piwik_VisitsSummary_Controller extends Controller $dataTableVisit = self::getVisitsSummary(); $dataRow = $dataTableVisit->getRowsCount() == 0 ? new Row() : $dataTableVisit->getFirstRow(); - $dataTableActions = Piwik_Actions_API::getInstance()->get($idSite, Piwik_Common::getRequestVar('period'), Piwik_Common::getRequestVar('date'), Piwik_API_Request::getRawSegmentFromRequest()); + $dataTableActions = Piwik_Actions_API::getInstance()->get($idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), + \Piwik\API\Request::getRawSegmentFromRequest()); $dataActionsRow = $dataTableActions->getRowsCount() == 0 ? new Row() : $dataTableActions->getFirstRow(); diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index b8ec1a6287..18c9b3ef97 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -20,6 +20,7 @@ use Piwik\ReportRenderer; use Piwik\Site; use Piwik\Translate; use Piwik\Db; +use Piwik\Visualization\Cloud; require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php'; @@ -242,7 +243,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase Translate::getInstance()->unloadEnglishTranslation(); // re-enable tag cloud shuffling - Piwik_Visualization_Cloud::$debugDisableShuffle = true; + Cloud::$debugDisableShuffle = true; } public function setUp() diff --git a/tests/PHPUnit/proxy/index.php b/tests/PHPUnit/proxy/index.php index 2cd498fd17..9a812cdb9e 100644 --- a/tests/PHPUnit/proxy/index.php +++ b/tests/PHPUnit/proxy/index.php @@ -5,6 +5,8 @@ */ // make sure the test environment is loaded +use Piwik\Visualization\Cloud; + require realpath(dirname(__FILE__)) . "/../../../tests/PHPUnit/TestingEnvironment.php"; Piwik_TestingEnvironment::addHooks(); @@ -20,7 +22,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; require_once PIWIK_INCLUDE_PATH . '/core/functions.php'; require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php'; -Piwik_Visualization_Cloud::$debugDisableShuffle = true; +Cloud::$debugDisableShuffle = true; Tracker::setTestEnvironment(); Piwik_Tracker_Cache::deleteTrackerCache(); |