Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/API/APIable.php4
-rw-r--r--modules/DataTable/Filter.php5
-rw-r--r--modules/DataTable/Filter/Null.php (renamed from modules/DataTable/Filter/Empty.php)2
-rw-r--r--modules/DataTable/Filter/ReplaceColumnNames.php37
-rw-r--r--modules/DataTable/Manager.php2
-rw-r--r--modules/DataTable/Renderer/Json.php2
-rw-r--r--modules/DataTable/Renderer/Php.php3
-rw-r--r--modules/DataTable/Renderer/Xml.php2
-rw-r--r--modules/Plugin.php18
9 files changed, 43 insertions, 32 deletions
diff --git a/modules/API/APIable.php b/modules/API/APIable.php
index 1edefd771e..3912954ec5 100755
--- a/modules/API/APIable.php
+++ b/modules/API/APIable.php
@@ -40,10 +40,6 @@ abstract class Piwik_Apiable
*/
static public $methodsNotToPublish = array();
- protected function __construct()
- {
- }
-
/**
* @see self::$methodsNotToPublish
* @param string Method name not to be published
diff --git a/modules/DataTable/Filter.php b/modules/DataTable/Filter.php
index 4bd93267c3..aae890c1ab 100644
--- a/modules/DataTable/Filter.php
+++ b/modules/DataTable/Filter.php
@@ -25,6 +25,9 @@
*/
abstract class Piwik_DataTable_Filter
{
+ /*
+ * @var Piwik_DataTable
+ */
protected $table;
public function __construct($table)
@@ -44,7 +47,7 @@ require_once "DataTable/Filter/ColumnCallbackAddDetail.php";
require_once "DataTable/Filter/ColumnCallbackReplace.php";
require_once "DataTable/Filter/DetailCallbackAddDetail.php";
require_once "DataTable/Filter/AddConstantDetail.php";
-require_once "DataTable/Filter/Empty.php";
+require_once "DataTable/Filter/Null.php";
require_once "DataTable/Filter/ExcludeLowPopulation.php";
require_once "DataTable/Filter/Limit.php";
require_once "DataTable/Filter/Pattern.php";
diff --git a/modules/DataTable/Filter/Empty.php b/modules/DataTable/Filter/Null.php
index e15f74063f..680572a6df 100644
--- a/modules/DataTable/Filter/Empty.php
+++ b/modules/DataTable/Filter/Null.php
@@ -16,7 +16,7 @@
* @package Piwik_DataTable
* @subpackage Piwik_DataTable_Filter
*/
-class Piwik_DataTable_Filter_Empty extends Piwik_DataTable_Filter
+class Piwik_DataTable_Filter_Null extends Piwik_DataTable_Filter
{
public function __construct( $table )
diff --git a/modules/DataTable/Filter/ReplaceColumnNames.php b/modules/DataTable/Filter/ReplaceColumnNames.php
index 4296128511..bbe3a06df3 100644
--- a/modules/DataTable/Filter/ReplaceColumnNames.php
+++ b/modules/DataTable/Filter/ReplaceColumnNames.php
@@ -37,6 +37,7 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter
Piwik_Archive::INDEX_SUM_VISIT_LENGTH => 'sum_visit_length',
Piwik_Archive::INDEX_BOUNCE_COUNT => 'bounce_count',
);
+
/**
* @param DataTable Table
* @param array Mapping to apply. Must have the format
@@ -57,22 +58,36 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter
protected function filter()
{
- foreach($this->table->getRows() as $key => $row)
+ $this->filterTable($this->table);
+ }
+
+ protected function filterTable($table)
+ {
+ foreach($table->getRows() as $key => $row)
{
- $columns = $row->getColumns();
+ $this->renameColumns($row);
- foreach($this->mappingToApply as $oldName => $newName)
+ try {
+ $subTable = Piwik_DataTable_Manager::getInstance()->getTable( $row->getIdSubDataTable() );
+ $this->filterTable($subTable);
+ } catch(Exception $e){
+ // case idSubTable == null, or if the table is not loaded in memory
+ }
+ }
+ }
+
+ protected function renameColumns($row)
+ {
+ $columns = $row->getColumns();
+ foreach($this->mappingToApply as $oldName => $newName)
+ {
+ if(isset($columns[$oldName]))
{
- // if the old column is there
- if(isset($columns[$oldName]))
- {
- $columns[$newName] = $columns[$oldName];
- unset($columns[$oldName]);
- }
+ $columns[$newName] = $columns[$oldName];
+ unset($columns[$oldName]);
}
-
- $row->setColumns($columns);
}
+ $row->setColumns($columns);
}
}
diff --git a/modules/DataTable/Manager.php b/modules/DataTable/Manager.php
index 743073ea80..cf5cc3345b 100644
--- a/modules/DataTable/Manager.php
+++ b/modules/DataTable/Manager.php
@@ -71,7 +71,7 @@ class Piwik_DataTable_Manager
if(!isset($this->tables[$idTable]))
{
- throw new Exception("The request table $idTable couldn't be found.");
+ throw new Exception("The requested table id=$idTable couldn't be found in the DataTable Manager");
}
return $this->tables[$idTable];
diff --git a/modules/DataTable/Renderer/Json.php b/modules/DataTable/Renderer/Json.php
index 158fa8dae8..918de6dc9f 100644
--- a/modules/DataTable/Renderer/Json.php
+++ b/modules/DataTable/Renderer/Json.php
@@ -32,7 +32,7 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer
protected function renderTable($table)
{
$renderer = new Piwik_DataTable_Renderer_Php($table, $serialize = false);
- $array = $renderer->flatRender();
+ $array = $renderer->flatRender(null, (bool)Piwik_Common::getRequestVar('expanded', false));
if(!is_array($array))
{
diff --git a/modules/DataTable/Renderer/Php.php b/modules/DataTable/Renderer/Php.php
index 7d80ed23e4..5f34005441 100644
--- a/modules/DataTable/Renderer/Php.php
+++ b/modules/DataTable/Renderer/Php.php
@@ -74,7 +74,7 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer
{
$serializeSave = $this->serialize;
$this->serialize = false;
- $flatArray[$keyName] = $this->flatRender($table);
+ $flatArray[$keyName] = $this->flatRender($table, $doRenderSubTablesIfAvailable);
$this->serialize = $serializeSave;
}
}
@@ -125,6 +125,7 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer
}
return $flatArray;
}
+
public function render( $dataTable = null)
{
if(is_null($dataTable))
diff --git a/modules/DataTable/Renderer/Xml.php b/modules/DataTable/Renderer/Xml.php
index e9e5da4215..66bf13bd1d 100644
--- a/modules/DataTable/Renderer/Xml.php
+++ b/modules/DataTable/Renderer/Xml.php
@@ -36,7 +36,7 @@ class Piwik_DataTable_Renderer_Xml extends Piwik_DataTable_Renderer
{
$renderer = new Piwik_DataTable_Renderer_Php($table, $serialize = false);
- $array = $renderer->flatRender();
+ $array = $renderer->flatRender(null, (bool)Piwik_Common::getRequestVar('expanded', false));
// case DataTable_Array
if($table instanceof Piwik_DataTable_Array)
diff --git a/modules/Plugin.php b/modules/Plugin.php
index 4f12b64b46..3d406f405e 100644
--- a/modules/Plugin.php
+++ b/modules/Plugin.php
@@ -17,11 +17,12 @@
* @package Piwik
*/
abstract class Piwik_Plugin
-{
- function __construct()
- {
- }
-
+{
+ /**
+ * Returns the plugin details
+ */
+ abstract function getInformation();
+
public function registerTranslation( $langCode )
{
$infos = $this->getInformation();
@@ -59,18 +60,13 @@ abstract class Piwik_Plugin
}
else
{
- throw new Exception("The language file couldn't be find for this plugin '$name'.");
+ throw new Exception("Language file not found for the plugin '$name'.");
}
Piwik_Translate::getInstance()->addTranslationArray($translations);
}
/**
- * Returns the plugin details
- */
- abstract function getInformation();
-
- /**
* Returns the plugin name
*/
public function getName()