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
|
||||
|
|
@ -8,38 +8,32 @@
|
|||
*/
|
||||
namespace Piwik\Plugins\ImageGraph;
|
||||
|
||||
use Piwik\API\Request;
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\Period;
|
||||
use Piwik\Period\Range;
|
||||
use Piwik\Scheduler\Scheduler;
|
||||
use Piwik\Site;
|
||||
use Piwik\TaskScheduler;
|
||||
use Piwik\Url;
|
||||
use Piwik\Period\Factory as PeriodFactory;
|
||||
|
||||
class ImageGraph extends \Piwik\Plugin
|
||||
{
|
||||
public function getInformation()
|
||||
{
|
||||
$suffix = ' Debug: <a href="' . Url::getCurrentQueryStringWithParametersModified(
|
||||
array('module' => 'ImageGraph', 'action' => 'index')) . '">All images</a>';
|
||||
$info = parent::getInformation();
|
||||
$info['description'] .= ' ' . $suffix;
|
||||
return $info;
|
||||
}
|
||||
|
||||
static private $CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS = array(
|
||||
private static $CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS = array(
|
||||
'Referrers_getReferrerType',
|
||||
);
|
||||
|
||||
// row evolution support not yet implemented for these APIs
|
||||
static private $REPORTS_DISABLED_EVOLUTION_GRAPH = array(
|
||||
private static $REPORTS_DISABLED_EVOLUTION_GRAPH = array(
|
||||
'Referrers_getAll',
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
public function registerEvents()
|
||||
{
|
||||
$hooks = array(
|
||||
'API.getReportMetadata.end' => array('function' => 'getReportMetadata',
|
||||
|
|
@ -87,21 +81,41 @@ class ImageGraph extends \Piwik\Plugin
|
|||
|
||||
$piwikSite = new Site($idSite);
|
||||
if ($periodForSinglePeriodGraph == 'range') {
|
||||
// for period=range, show the configured sub-periods
|
||||
$periodForMultiplePeriodGraph = Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
|
||||
$dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
|
||||
} else {
|
||||
$periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
|
||||
$dateForMultiplePeriodGraph = Range::getRelativeToEndDate(
|
||||
$periodForSinglePeriodGraph,
|
||||
'last' . self::GRAPH_EVOLUTION_LAST_PERIODS,
|
||||
$dateForSinglePeriodGraph,
|
||||
$piwikSite
|
||||
);
|
||||
} else if ($info['period'] == 'day' || !Config::getInstance()->General['graphs_show_evolution_within_selected_period']) {
|
||||
// for period=day, always show the last n days
|
||||
// if graphs_show_evolution_within_selected_period=false, show the last n periods
|
||||
$periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
|
||||
$dateForMultiplePeriodGraph = Range::getRelativeToEndDate(
|
||||
$periodForSinglePeriodGraph,
|
||||
'last' . self::GRAPH_EVOLUTION_LAST_PERIODS,
|
||||
$dateForSinglePeriodGraph,
|
||||
$piwikSite
|
||||
);
|
||||
} else {
|
||||
// if graphs_show_evolution_within_selected_period=true, show the days withing the period
|
||||
// (except if the period is day, see above)
|
||||
$periodForMultiplePeriodGraph = 'day';
|
||||
$period = PeriodFactory::build($info['period'], $info['date']);
|
||||
$start = $period->getDateStart()->toString();
|
||||
$end = $period->getDateEnd()->toString();
|
||||
$dateForMultiplePeriodGraph = $start . ',' . $end;
|
||||
}
|
||||
}
|
||||
|
||||
$token_auth = Common::getRequestVar('token_auth', false);
|
||||
|
||||
$segment = Request::getRawSegmentFromRequest();
|
||||
|
||||
/** @var Scheduler $scheduler */
|
||||
$scheduler = StaticContainer::getContainer()->get('Piwik\Scheduler\Scheduler');
|
||||
$isRunningTask = $scheduler->isRunningTask();
|
||||
|
||||
// add the idSubtable if it exists
|
||||
$idSubtable = Common::getRequestVar('idSubtable', false);
|
||||
|
||||
$urlPrefix = "index.php?";
|
||||
foreach ($reports as &$report) {
|
||||
$reportModule = $report['module'];
|
||||
|
|
@ -130,16 +144,18 @@ class ImageGraph extends \Piwik\Plugin
|
|||
$parameters['date'] = $dateForSinglePeriodGraph;
|
||||
}
|
||||
|
||||
// add the idSubtable if it exists
|
||||
$idSubtable = Common::getRequestVar('idSubtable', false);
|
||||
if ($idSubtable !== false) {
|
||||
$parameters['idSubtable'] = $idSubtable;
|
||||
}
|
||||
|
||||
if (!empty($_GET['_restrictSitesToLogin']) && TaskScheduler::isTaskBeingExecuted()) {
|
||||
if (!empty($_GET['_restrictSitesToLogin']) && $isRunningTask) {
|
||||
$parameters['_restrictSitesToLogin'] = $_GET['_restrictSitesToLogin'];
|
||||
}
|
||||
|
||||
if (!empty($segment)) {
|
||||
$parameters['segment'] = $segment;
|
||||
}
|
||||
|
||||
$report['imageGraphUrl'] = $urlPrefix . Url::getQueryStringFromParameters($parameters);
|
||||
|
||||
// thanks to API.getRowEvolution, reports with dimensions can now be plotted using an evolution graph
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue