#11326 fixed dark theme in security hardening

This commit is contained in:
Daniel Cebrian 2023-07-25 14:25:16 +02:00
parent 62a70dee2c
commit a3d5bd80f9
3 changed files with 180 additions and 1 deletions

View File

@ -1108,6 +1108,22 @@ function get_build_setup_charts($type, $options, $data)
&& empty($options['scales']['r']['pointLabels']) === false
&& is_array($options['scales']['r']['pointLabels']) === true
) {
if (isset($options['scales']['r']['pointLabels']['color']) === true) {
$scales->getR()->pointLabels()->setColor($options['scales']['r']['pointLabels']['color']);
}
if (isset($options['scales']['r']['grid']['display']) === true) {
$scales->getR()->grid()->setDrawOnChartArea($options['scales']['r']['grid']['display']);
}
if (isset($options['scales']['r']['grid']['color']) === true) {
$scales->getR()->grid()->setColor($options['scales']['r']['grid']['color']);
}
if (isset($options['scales']['r']['angleLines']['color']) === true) {
$scales->getR()->angleLines()->setColor($options['scales']['r']['angleLines']['color']);
}
if (isset($options['scales']['r']['pointLabels']['fonts']) === true
&& empty($options['scales']['r']['pointLabels']['fonts']) === false
&& is_array($options['scales']['r']['pointLabels']['fonts']) === true

View File

@ -4,6 +4,7 @@ namespace Artica\PHPChartJS\Options;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use Artica\PHPChartJS\Options\Scales\AngleLines;
use Artica\PHPChartJS\Options\Scales\GridLines;
use Artica\PHPChartJS\Options\Scales\PointLabels;
use Artica\PHPChartJS\Options\Scales\ScaleLabel;
@ -129,6 +130,13 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
*/
protected $grid;
/**
* AngleLines
*
* @var AngleLines
*/
protected $angleLines;
/**
* @var ScaleLabel
*/
@ -164,7 +172,7 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
return $this;
}
/**
* @return string
*/
@ -585,6 +593,26 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
return $this->grid;
}
/**
* @return AngleLines
*/
public function getAngleLines()
{
return $this->angleLines;
}
/**
* @return AngleLines
*/
public function angleLines()
{
if (is_null($this->angleLines)) {
$this->angleLines = new AngleLines();
}
return $this->angleLines;
}
/**
* @return ScaleLabel
*/

View File

@ -0,0 +1,135 @@
<?php
namespace Artica\PHPChartJS\Options\Scales;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use Artica\PHPChartJS\Delegate\NumberUtils;
use Artica\PHPChartJS\Delegate\StringUtils;
use JsonSerializable;
/**
* Class AngleLines
*
* @package Artica\PHPChartJS\Options\Scales
*/
class AngleLines implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
use StringUtils;
use NumberUtils;
/**
* @var bool
*/
private $display;
/**
* @var string|string[]
*/
private $color;
/**
* @var float[]|null
*/
private $borderDash;
/**
* @var float
*/
private $borderDashOffset;
/**
* @return bool
*/
public function isDisplay()
{
return $this->display;
}
/**
* @param bool $display
*
* @return $this
*/
public function setDisplay($display)
{
$this->display = $display;
return $this;
}
/**
* @return string|string[]
*/
public function getColor()
{
return $this->color;
}
/**
* @param string|string[] $color
*
* @return $this
*/
public function setColor($color)
{
if (is_array($color)) {
$this->color = $this->recursiveToString($color);
} else {
$this->color = is_null($color) ? null : strval($color);
}
return $this;
}
/**
* @return float[]|null
*/
public function getBorderDash()
{
return $this->borderDash;
}
/**
* @param float[] $borderDash
*
* @return $this
*/
public function setBorderDash($borderDash)
{
if (is_array($borderDash)) {
$this->borderDash = $this->recursiveToFloat($borderDash);
}
return $this;
}
/**
* @return float
*/
public function getBorderDashOffset()
{
return $this->borderDashOffset;
}
/**
* @param float $borderDashOffset
*
* @return $this
*/
public function setBorderDashOffset($borderDashOffset)
{
$this->borderDashOffset = floatval($borderDashOffset);
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return $this->getArrayCopy();
}
}