update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -9,12 +9,12 @@
|
|||
namespace Piwik\Plugins\ImageGraph;
|
||||
|
||||
use Exception;
|
||||
use Piwik\API\Request;
|
||||
use Piwik\Archive\DataTableFactory;
|
||||
use Piwik\Common;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Period;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\API\API as APIMetadata;
|
||||
use Piwik\Plugins\ImageGraph\StaticGraph;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Translate;
|
||||
|
|
@ -41,7 +41,7 @@ class API extends \Piwik\Plugin\API
|
|||
const MAX_WIDTH = 2048;
|
||||
const MAX_HEIGHT = 2048;
|
||||
|
||||
static private $DEFAULT_PARAMETERS = array(
|
||||
private static $DEFAULT_PARAMETERS = array(
|
||||
StaticGraph::GRAPH_TYPE_BASIC_LINE => array(
|
||||
self::FILENAME_KEY => 'BasicLine',
|
||||
self::TRUNCATE_KEY => 6,
|
||||
|
|
@ -74,11 +74,7 @@ class API extends \Piwik\Plugin\API
|
|||
),
|
||||
);
|
||||
|
||||
static private $DEFAULT_GRAPH_TYPE_OVERRIDE = array(
|
||||
'UserSettings_getPlugin' => array(
|
||||
false // override if !$isMultiplePeriod
|
||||
=> StaticGraph::GRAPH_TYPE_HORIZONTAL_BAR,
|
||||
),
|
||||
private static $DEFAULT_GRAPH_TYPE_OVERRIDE = array(
|
||||
'Referrers_getReferrerType' => array(
|
||||
false // override if !$isMultiplePeriod
|
||||
=> StaticGraph::GRAPH_TYPE_HORIZONTAL_BAR,
|
||||
|
|
@ -126,7 +122,8 @@ class API extends \Piwik\Plugin\API
|
|||
$gridColor = API::DEFAULT_GRID_COLOR,
|
||||
$idSubtable = false,
|
||||
$legendAppendMetric = true,
|
||||
$segment = false
|
||||
$segment = false,
|
||||
$idDimension = false
|
||||
)
|
||||
{
|
||||
Piwik::checkUserHasViewAccess($idSite);
|
||||
|
|
@ -155,10 +152,23 @@ class API extends \Piwik\Plugin\API
|
|||
if (!empty($idGoal)) {
|
||||
$apiParameters = array('idGoal' => $idGoal);
|
||||
}
|
||||
if (!empty($idDimension)) {
|
||||
$apiParameters = array('idDimension' => $idDimension);
|
||||
}
|
||||
// Fetch the metadata for given api-action
|
||||
$metadata = APIMetadata::getInstance()->getMetadata(
|
||||
$idSite, $apiModule, $apiAction, $apiParameters, $languageLoaded, $period, $date,
|
||||
$hideMetricsDoc = false, $showSubtableReports = true);
|
||||
$parameters = array(
|
||||
'idSite' => $idSite,
|
||||
'apiModule' => $apiModule,
|
||||
'apiAction' => $apiAction,
|
||||
'apiParameters' => $apiParameters,
|
||||
'language' => $languageLoaded,
|
||||
'period' => $period,
|
||||
'date' => $date,
|
||||
'hideMetricsDoc' => false,
|
||||
'showSubtableReports' => true
|
||||
);
|
||||
|
||||
$metadata = Request::processRequest('API.getMetadata', $parameters);
|
||||
if (!$metadata) {
|
||||
throw new Exception('Invalid API Module and/or API Action');
|
||||
}
|
||||
|
|
@ -288,20 +298,22 @@ class API extends \Piwik\Plugin\API
|
|||
}
|
||||
}
|
||||
|
||||
$processedReport = APIMetadata::getInstance()->getRowEvolution(
|
||||
$idSite,
|
||||
$period,
|
||||
$date,
|
||||
$apiModule,
|
||||
$apiAction,
|
||||
$labels,
|
||||
$segment,
|
||||
$plottedMetric,
|
||||
$languageLoaded,
|
||||
$idGoal,
|
||||
$legendAppendMetric,
|
||||
$labelUseAbsoluteUrl = false
|
||||
$parameters = array(
|
||||
'idSite' => $idSite,
|
||||
'period' => $period,
|
||||
'date' => $date,
|
||||
'apiModule' => $apiModule,
|
||||
'apiAction' => $apiAction,
|
||||
'label' => $labels,
|
||||
'segment' => $segment,
|
||||
'column' => $plottedMetric,
|
||||
'language' => $languageLoaded,
|
||||
'idGoal' => $idGoal,
|
||||
'idDimension' => $idDimension,
|
||||
'legendAppendMetric' => $legendAppendMetric,
|
||||
'labelUseAbsoluteUrl' => false
|
||||
);
|
||||
$processedReport = Request::processRequest('API.getRowEvolution', $parameters);
|
||||
|
||||
//@review this test will need to be updated after evaluating the @review comment in API/API.php
|
||||
if (!$processedReport) {
|
||||
|
|
@ -345,22 +357,25 @@ class API extends \Piwik\Plugin\API
|
|||
$ordinateLabels[$plottedMetric] = $processedReport['label'] . ' (' . $metrics[$plottedMetric]['name'] . ')';
|
||||
}
|
||||
} else {
|
||||
$processedReport = APIMetadata::getInstance()->getProcessedReport(
|
||||
$idSite,
|
||||
$period,
|
||||
$date,
|
||||
$apiModule,
|
||||
$apiAction,
|
||||
$segment,
|
||||
$apiParameters = false,
|
||||
$idGoal,
|
||||
$languageLoaded,
|
||||
$showTimer = true,
|
||||
$hideMetricsDoc = false,
|
||||
$idSubtable,
|
||||
$showRawMetrics = false
|
||||
$parameters = array(
|
||||
'idSite' => $idSite,
|
||||
'period' => $period,
|
||||
'date' => $date,
|
||||
'apiModule' => $apiModule,
|
||||
'apiAction' => $apiAction,
|
||||
'segment' => $segment,
|
||||
'apiParameters' => false,
|
||||
'idGoal' => $idGoal,
|
||||
'idDimension' => $idDimension,
|
||||
'language' => $languageLoaded,
|
||||
'showTimer' => true,
|
||||
'hideMetricsDoc' => false,
|
||||
'idSubtable' => $idSubtable,
|
||||
'showRawMetrics' => false
|
||||
);
|
||||
$processedReport = Request::processRequest('API.getProcessedReport', $parameters);
|
||||
}
|
||||
|
||||
// prepare abscissa and ordinate series
|
||||
$abscissaSeries = array();
|
||||
$abscissaLogos = array();
|
||||
|
|
@ -420,6 +435,9 @@ class API extends \Piwik\Plugin\API
|
|||
$rowData = $rows[0]->getColumns(); // associative Array
|
||||
|
||||
foreach ($ordinateColumns as $column) {
|
||||
if(!isset($rowData[$column])) {
|
||||
continue;
|
||||
}
|
||||
$ordinateValue = $rowData[$column];
|
||||
$parsedOrdinateValue = $this->parseOrdinateValue($ordinateValue);
|
||||
|
||||
|
|
@ -494,7 +512,10 @@ class API extends \Piwik\Plugin\API
|
|||
if ($idGoal != '') {
|
||||
$idGoal = '_' . $idGoal;
|
||||
}
|
||||
$fileName = self::$DEFAULT_PARAMETERS[$graphType][self::FILENAME_KEY] . '_' . $apiModule . '_' . $apiAction . $idGoal . ' ' . str_replace(',', '-', $date) . ' ' . $idSite . '.png';
|
||||
if ($idDimension != '') {
|
||||
$idDimension = '__' . $idDimension;
|
||||
}
|
||||
$fileName = self::$DEFAULT_PARAMETERS[$graphType][self::FILENAME_KEY] . '_' . $apiModule . '_' . $apiAction . $idGoal . $idDimension . ' ' . str_replace(',', '-', $date) . ' ' . $idSite . '.png';
|
||||
$fileName = str_replace(array(' ', '/'), '_', $fileName);
|
||||
|
||||
if (!Filesystem::isValidFilename($fileName)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue