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,23 +9,22 @@
|
|||
|
||||
namespace Piwik\Plugins\ImageGraph;
|
||||
|
||||
use Exception;
|
||||
|
||||
use pData;
|
||||
use pImage;
|
||||
use Piwik\Loader;
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\NumberFormatter;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Piwik\BaseFactory;
|
||||
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pDraw.class.php";
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pImage.class.php";
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pData.class.php";
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart/class/pDraw.class.php";
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart/class/pImage.class.php";
|
||||
require_once PIWIK_INCLUDE_PATH . "/libs/pChart/class/pData.class.php";
|
||||
|
||||
/**
|
||||
* The StaticGraph abstract class is used as a base class for different types of static graphs.
|
||||
*
|
||||
*/
|
||||
abstract class StaticGraph
|
||||
abstract class StaticGraph extends BaseFactory
|
||||
{
|
||||
const GRAPH_TYPE_BASIC_LINE = "evolution";
|
||||
const GRAPH_TYPE_VERTICAL_BAR = "verticalBar";
|
||||
|
|
@ -33,7 +32,7 @@ abstract class StaticGraph
|
|||
const GRAPH_TYPE_3D_PIE = "3dPie";
|
||||
const GRAPH_TYPE_BASIC_PIE = "pie";
|
||||
|
||||
static private $availableStaticGraphTypes = array(
|
||||
private static $availableStaticGraphTypes = array(
|
||||
self::GRAPH_TYPE_BASIC_LINE => 'Evolution',
|
||||
self::GRAPH_TYPE_VERTICAL_BAR => 'VerticalBar',
|
||||
self::GRAPH_TYPE_HORIZONTAL_BAR => 'HorizontalBar',
|
||||
|
|
@ -74,29 +73,19 @@ abstract class StaticGraph
|
|||
|
||||
abstract public function renderGraph();
|
||||
|
||||
/**
|
||||
* Return the StaticGraph according to the static graph type $graphType
|
||||
*
|
||||
* @throws Exception If the static graph type is unknown
|
||||
* @param string $graphType
|
||||
* @return \Piwik\Plugins\ImageGraph\StaticGraph
|
||||
*/
|
||||
public static function factory($graphType)
|
||||
protected static function getClassNameFromClassId($graphType)
|
||||
{
|
||||
if (isset(self::$availableStaticGraphTypes[$graphType])) {
|
||||
$className = self::$availableStaticGraphTypes[$graphType];
|
||||
$className = __NAMESPACE__ . "\\StaticGraph\\" . $className;
|
||||
return $className;
|
||||
}
|
||||
|
||||
$className = self::$availableStaticGraphTypes[$graphType];
|
||||
$className = __NAMESPACE__ . "\\StaticGraph\\" . $className;
|
||||
Loader::loadClass($className);
|
||||
return new $className;
|
||||
} else {
|
||||
throw new Exception(
|
||||
Piwik::translate(
|
||||
'General_ExceptionInvalidStaticGraphType',
|
||||
array($graphType, implode(', ', self::getAvailableStaticGraphTypes()))
|
||||
)
|
||||
);
|
||||
}
|
||||
protected static function getInvalidClassIdExceptionMessage($graphType)
|
||||
{
|
||||
return Piwik::translate(
|
||||
'General_ExceptionInvalidStaticGraphType',
|
||||
array($graphType, implode(', ', self::getAvailableStaticGraphTypes()))
|
||||
);
|
||||
}
|
||||
|
||||
public static function getAvailableStaticGraphTypes()
|
||||
|
|
@ -240,8 +229,7 @@ abstract class StaticGraph
|
|||
*/
|
||||
protected static function getOutputPath($filename)
|
||||
{
|
||||
$outputFilename = PIWIK_USER_PATH . '/tmp/assets/' . $filename;
|
||||
$outputFilename = SettingsPiwik::rewriteTmpPathWithHostname($outputFilename);
|
||||
$outputFilename = StaticContainer::get('path.tmp') . '/assets/' . $filename;
|
||||
|
||||
@chmod($outputFilename, 0600);
|
||||
@unlink($outputFilename);
|
||||
|
|
@ -261,6 +249,8 @@ abstract class StaticGraph
|
|||
}
|
||||
}
|
||||
|
||||
$this->pData->setAxisDisplay(0, AXIS_FORMAT_CUSTOM, '\\Piwik\\Plugins\\ImageGraph\\formatYAxis');
|
||||
|
||||
$this->pData->addPoints($this->abscissaSeries, self::ABSCISSA_SERIE_NAME);
|
||||
$this->pData->setAbscissa(self::ABSCISSA_SERIE_NAME);
|
||||
}
|
||||
|
|
@ -312,7 +302,7 @@ abstract class StaticGraph
|
|||
|
||||
$maxWidth = 0;
|
||||
$maxHeight = 0;
|
||||
foreach ($values as $column => $data) {
|
||||
foreach ($values as $data) {
|
||||
foreach ($data as $value) {
|
||||
list($valueWidth, $valueHeight) = $this->getTextWidthHeight($value);
|
||||
|
||||
|
|
@ -353,3 +343,15 @@ abstract class StaticGraph
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Global format method
|
||||
*
|
||||
* required to format y axis values using pcharts internal format callbacks
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
function formatYAxis($value)
|
||||
{
|
||||
return NumberFormatter::getInstance()->format($value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue