From d00c23dcc758453e00815ba1dd8341a0acdef667 Mon Sep 17 00:00:00 2001 From: Felipe Figueroa Date: Wed, 9 May 2018 17:28:22 -0300 Subject: [PATCH] fixes call to classes without using their namespace --- src/graph/AxisPrototype.php | 4 ++-- src/graph/GanttGraph.php | 2 +- src/graph/Graph.php | 10 +++++----- src/graph/Legend.php | 5 ++--- src/graph/PieGraph.php | 3 ++- src/graph/PolarAxis.php | 3 ++- src/graph/PolarLogScale.php | 4 +++- src/graph/RadarAxis.php | 4 +++- src/graph/RadarGraph.php | 7 ++++--- src/graph/RadarGrid.php | 4 ++-- src/image/DigitalLED74.php | 2 +- src/plot/AccBarPlot.php | 6 +++--- src/plot/AccLinePlot.php | 2 ++ src/plot/BarPlot.php | 12 ++++++------ src/plot/Contour.php | 1 + src/plot/ErrorPlot.php | 2 ++ src/plot/FieldPlot.php | 1 + src/plot/GanttVLine.php | 3 ++- src/plot/GroupBarPlot.php | 2 ++ src/plot/IconPlot.php | 1 + src/plot/LineErrorPlot.php | 2 ++ src/plot/LinePlot.php | 4 ++-- src/plot/MileStone.php | 2 +- src/plot/PiePlot3D.php | 3 ++- src/plot/PlotLine.php | 2 ++ src/plot/PolarPlot.php | 8 ++++---- src/plot/ScatterPlot.php | 1 + src/plot/StockPlot.php | 8 ++++---- src/text/GTextTable.php | 36 +++++++++++++++++++----------------- src/text/GTextTableCell.php | 21 ++++++++++++--------- src/text/LanguageConv.php | 6 ++++-- src/text/SuperScriptText.php | 6 ++++-- src/text/TextProperty.php | 10 ++++++---- src/themes/Theme.php | 7 +++---- src/util/Helper.php | 2 +- 35 files changed, 114 insertions(+), 82 deletions(-) diff --git a/src/graph/AxisPrototype.php b/src/graph/AxisPrototype.php index 0d434266..23eef8ba 100644 --- a/src/graph/AxisPrototype.php +++ b/src/graph/AxisPrototype.php @@ -6,7 +6,7 @@ namespace Amenadiel\JpGraph\Graph; -use Amenadiel\JpGraph\Text\Text; +use Amenadiel\JpGraph\Text; use Amenadiel\JpGraph\Util; /** @@ -56,7 +56,7 @@ public function __construct($img, $aScale, $color = [0, 0, 0]) $this->img = $img; $this->scale = $aScale; $this->color = $color; - $this->title = new Text(''); + $this->title = new Text\Text(''); if ($aScale->type == 'y') { $this->title_margin = 25; diff --git a/src/graph/GanttGraph.php b/src/graph/GanttGraph.php index 01238063..be32261f 100644 --- a/src/graph/GanttGraph.php +++ b/src/graph/GanttGraph.php @@ -783,7 +783,7 @@ public function Stroke($aStrokeFileName = '') // Should we do any final image transformation if ($this->iImgTrans) { - $tform = new Imae\ImgTrans($this->img->img); + $tform = new Image\ImgTrans($this->img->img); $this->img->img = $tform->Skew3D( $this->iImgTransHorizon, $this->iImgTransSkewDist, diff --git a/src/graph/Graph.php b/src/graph/Graph.php index 036fe61f..159f49da 100644 --- a/src/graph/Graph.php +++ b/src/graph/Graph.php @@ -361,7 +361,7 @@ public function Add($aPlot) $cl = $aPlot; } - if ($cl instanceof Text) { + if ($cl instanceof Text\Text) { $this->AddText($aPlot); } elseif (($cl instanceof Plot\PlotLine)) { $this->AddLine($aPlot); @@ -419,7 +419,7 @@ public function AddY2($aPlot) $cl = $aPlot; } - if ($cl instanceof Text) { + if ($cl instanceof Text\Text) { $this->AddText($aPlot, true); } elseif (($cl instanceof Plot\PlotLine)) { $this->AddLine($aPlot, true); @@ -450,7 +450,7 @@ public function AddY($aN, $aPlot) if (($cl instanceof Text\Text) || ($cl instanceof Plot\PlotLine) || ($cl instanceof Plot\PlotBand)) { - JpGraph::RaiseL(25013); //('You can only add standard plots to multiple Y-axis'); + Util\JpGraphError::RaiseL(25013); //('You can only add standard plots to multiple Y-axis'); } else { $this->ynplots[$aN][] = $aPlot; } @@ -578,7 +578,7 @@ public function SetBackgroundImage($aFileName, $aBgType = BGIMG_FILLPLOT, $aImgF // Get extension to determine image type if ($aImgFormat == 'auto') { $e = explode('.', $aFileName); - if (!$e) { + if (empty($e)) { Util\JpGraphError::RaiseL(25018, $aFileName); //('Incorrect file name for Graph::SetBackgroundImage() : '.$aFileName.' Must have a valid image extension (jpg,gif,png) when using autodetection of image type'); } @@ -996,7 +996,7 @@ public function StrokeCSIM($aScriptName = 'auto', $aCSIMName = '', $aBorder = 0) { if ($aCSIMName == '') { // create a random map name - srand((float) microtime() * 1000000); + srand((integer) (microtime() * 1000000)); $r = rand(0, 100000); $aCSIMName = '__mapname' . $r . '__'; } diff --git a/src/graph/Legend.php b/src/graph/Legend.php index cba3b5a1..e94e8464 100644 --- a/src/graph/Legend.php +++ b/src/graph/Legend.php @@ -6,7 +6,6 @@ namespace Amenadiel\JpGraph\Graph; -use Amenadiel\JpGraph\Graph; use Amenadiel\JpGraph\Plot; use Amenadiel\JpGraph\Util; @@ -184,7 +183,7 @@ public function SetAbsPos($aX, $aY, $aHAlign = 'right', $aVAlign = 'top') public function Pos($aX, $aY, $aHAlign = 'right', $aVAlign = 'top') { if (!($aX < 1 && $aY < 1)) { - JpGraphError::RaiseL(25120); //(" Position for legend must be given as percentage in range 0-1"); + Util\JpGraphError::RaiseL(25120); //(" Position for legend must be given as percentage in range 0-1"); } $this->xpos = $aX; $this->ypos = $aY; @@ -472,7 +471,7 @@ public function Stroke($aImg) if ($p[3] < -100) { // p[1][0] == iPattern, p[1][1] == iPatternColor, p[1][2] == iPatternDensity if ($patternFactory == null) { - $patternFactory = new Graph\RectPatternFactory(); + $patternFactory = new RectPatternFactory(); } $prect = $patternFactory->Create($p[1][0], $p[1][1], 1); $prect->SetBackground($p[1][3]); diff --git a/src/graph/PieGraph.php b/src/graph/PieGraph.php index c144aace..3a4dfc6f 100644 --- a/src/graph/PieGraph.php +++ b/src/graph/PieGraph.php @@ -8,6 +8,7 @@ use Amenadiel\JpGraph\Image; use Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Text; /** * @class PieGraph @@ -48,7 +49,7 @@ public function Add($aObj) $cl = $aObj; } - if ($cl instanceof Text) { + if ($cl instanceof Text\Text) { $this->AddText($aObj); } elseif (($cl instanceof Plot\IconPlot)) { $this->AddIcon($aObj); diff --git a/src/graph/PolarAxis.php b/src/graph/PolarAxis.php index 78d08736..13f05a06 100644 --- a/src/graph/PolarAxis.php +++ b/src/graph/PolarAxis.php @@ -6,6 +6,7 @@ namespace Amenadiel\JpGraph\Graph; +use Amenadiel\JpGraph\Text; use Amenadiel\JpGraph\Util; /** @@ -208,7 +209,7 @@ public function StrokeAngleLabels($pos, $type) $d = max($this->img->plotwidth, $this->img->plotheight) * 1.42; $a = $this->angle_step; - $t = new Text(); + $t = new Text\Text(); $t->SetColor($this->angle_fontcolor); $t->SetFont($this->angle_fontfam, $this->angle_fontstyle, $this->angle_fontsize); $xright = $this->img->width - $this->img->right_margin; diff --git a/src/graph/PolarLogScale.php b/src/graph/PolarLogScale.php index c5e0640b..b01753ad 100644 --- a/src/graph/PolarLogScale.php +++ b/src/graph/PolarLogScale.php @@ -15,7 +15,9 @@ public function __construct($aMax, $graph, $aClockwise = false) { parent::__construct(0, $aMax, 'x'); $this->graph = $graph; - $this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE); + if ($this->ticks instanceof LogTicks) { + $this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE); + } $this->clockwise = $aClockwise; } diff --git a/src/graph/RadarAxis.php b/src/graph/RadarAxis.php index 6f2262ae..1210c27f 100644 --- a/src/graph/RadarAxis.php +++ b/src/graph/RadarAxis.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Graph; +use Amenadiel\JpGraph\Text; + /** * @class RadarAxis * // Description: Implements axis for the radar graph @@ -20,7 +22,7 @@ public function __construct($img, $aScale, $color = [0, 0, 0]) { parent::__construct($img, $aScale, $color); $this->len = $img->plotheight; - $this->title = new Text(); + $this->title = new Text\Text(); $this->title->SetFont(FF_FONT1, FS_BOLD); $this->color = [0, 0, 0]; } diff --git a/src/graph/RadarGraph.php b/src/graph/RadarGraph.php index 8680e79d..06f3cc82 100644 --- a/src/graph/RadarGraph.php +++ b/src/graph/RadarGraph.php @@ -6,8 +6,9 @@ namespace Amenadiel\JpGraph\Graph; -use Amenadiel\JpGraph\ImgTrans; +use Amenadiel\JpGraph\Image; use Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Text; use Amenadiel\JpGraph\Util; /** @@ -144,7 +145,7 @@ public function Add($aPlot) $cl = $aPlot; } - if ($cl instanceof Text) { + if ($cl instanceof Text\Text) { $this->AddText($aPlot); } elseif (($cl instanceof Plot\IconPlot)) { $this->AddIcon($aPlot); @@ -313,7 +314,7 @@ public function Stroke($aStrokeFileName = '') // Should we do any final image transformation if ($this->iImgTrans && !$_csim) { - $tform = new ImgTrans($this->img->img); + $tform = new Image\ImgTrans($this->img->img); $this->img->img = $tform->Skew3D( $this->iImgTransHorizon, $this->iImgTransSkewDist, diff --git a/src/graph/RadarGrid.php b/src/graph/RadarGrid.php index f632a5b0..70dba062 100644 --- a/src/graph/RadarGrid.php +++ b/src/graph/RadarGrid.php @@ -14,7 +14,7 @@ * // * // Copyright (c) Asial Corporation. All rights reserved. */ -require_once 'jpgraph_plotmark.inc.php'; +use Amenadiel\JpGraph\Plot; /** * @class RadarGrid @@ -114,7 +114,7 @@ class RadarPlot public function __construct($data) { $this->data = $data; - $this->mark = new PlotMark(); + $this->mark = new Plot\PlotMark(); } public function Min() diff --git a/src/image/DigitalLED74.php b/src/image/DigitalLED74.php index 4339f497..7d5462d8 100644 --- a/src/image/DigitalLED74.php +++ b/src/image/DigitalLED74.php @@ -246,7 +246,7 @@ public function _GetLED($aLedIdx, $aColor = 0) } } - $img = new Image\Image($width, $height, DEFAULT_GFORMAT, false); + $img = new Image($width, $height, DEFAULT_GFORMAT, false); $img->Copy($simg->img, 0, 0, 0, 0, $width, $height, $swidth, $sheight); $simg->Destroy(); unset($simg); diff --git a/src/plot/AccBarPlot.php b/src/plot/AccBarPlot.php index e41c0b9b..491c6ff6 100644 --- a/src/plot/AccBarPlot.php +++ b/src/plot/AccBarPlot.php @@ -256,15 +256,15 @@ public function Stroke($img, $xscale, $yscale) } if (is_array($this->plots[$j]->grad_fromcolor)) { // The first argument (grad_fromcolor) can be either an array or a single color. If it is an array - // then we have two choices. It can either a) be a single color specified as an RGB triple or it can be + // then we have two choices. It can either a) be a single color specified as an Image\RGB triple or it can be // an array to specify both (from, to style) for each individual bar. The way to know the difference is - // to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB + // to investgate the first element. If this element is an integer [0,255] then we assume it is an Image\RGB // triple. $ng = count($this->plots[$j]->grad_fromcolor); if ($ng === 3) { if (is_numeric($this->plots[$j]->grad_fromcolor[0]) && $this->plots[$j]->grad_fromcolor[0] > 0 && $this->plots[$j]->grad_fromcolor[0] < 256) { - // RGB Triple + // Image\RGB Triple $fromcolor = $this->plots[$j]->grad_fromcolor; $tocolor = $this->plots[$j]->grad_tocolor; $style = $this->plots[$j]->grad_style; diff --git a/src/plot/AccLinePlot.php b/src/plot/AccLinePlot.php index 87b0f7a6..170d36e0 100644 --- a/src/plot/AccLinePlot.php +++ b/src/plot/AccLinePlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * @class AccLinePlot * // Description: diff --git a/src/plot/BarPlot.php b/src/plot/BarPlot.php index 4a9efc75..dd52a534 100644 --- a/src/plot/BarPlot.php +++ b/src/plot/BarPlot.php @@ -123,7 +123,7 @@ public function Legend($graph) { if ($this->grad && $this->legend != '' && !$this->fill) { $color = [$this->grad_fromcolor, $this->grad_tocolor]; - // In order to differentiate between gradients and cooors specified as an RGB triple + // In order to differentiate between gradients and cooors specified as an Image\RGB triple $graph->legend->Add( $this->legend, $color, @@ -275,7 +275,7 @@ public function SetNoFill() public function SetFillColor($aColor) { - // Do an extra error check if the color is specified as an RGB array triple + // Do an extra error check if the color is specified as an Image\RGB array triple // In that case convert it to a hex string since it will otherwise be // interpretated as an array of colors for each individual bar. @@ -388,7 +388,7 @@ public function Stroke($img, $xscale, $yscale) if (isset($this->coords[1])) { if (count($this->coords[1]) != $numpoints) { Util\JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints); - //"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints"); + //"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints"); } else { $exist_x = true; } @@ -455,14 +455,14 @@ public function Stroke($img, $xscale, $yscale) } if (is_array($this->grad_fromcolor)) { // The first argument (grad_fromcolor) can be either an array or a single color. If it is an array - // then we have two choices. It can either a) be a single color specified as an RGB triple or it can be + // then we have two choices. It can either a) be a single color specified as an Image\RGB triple or it can be // an array to specify both (from, to style) for each individual bar. The way to know the difference is - // to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB + // to investgate the first element. If this element is an integer [0,255] then we assume it is an Image\RGB // triple. $ng = count($this->grad_fromcolor); if ($ng === 3) { if (is_numeric($this->grad_fromcolor[0]) && $this->grad_fromcolor[0] > 0 && $this->grad_fromcolor[0] < 256) { - // RGB Triple + // Image\RGB Triple $fromcolor = $this->grad_fromcolor; $tocolor = $this->grad_tocolor; $style = $this->grad_style; diff --git a/src/plot/Contour.php b/src/plot/Contour.php index aa8e1f27..fcf6c55d 100644 --- a/src/plot/Contour.php +++ b/src/plot/Contour.php @@ -7,6 +7,7 @@ namespace Amenadiel\JpGraph\Plot; use Amenadiel\JpGraph\Image; +use Amenadiel\JpGraph\Util; /** * File: JPGRAPH_CONTOUR.PHP diff --git a/src/plot/ErrorPlot.php b/src/plot/ErrorPlot.php index 383c511e..81fd69b8 100644 --- a/src/plot/ErrorPlot.php +++ b/src/plot/ErrorPlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * File: JPGRAPH_ERROR.PHP * // Description: Error plot extension for JpGraph diff --git a/src/plot/FieldPlot.php b/src/plot/FieldPlot.php index e97c6d66..eb2a1f8c 100644 --- a/src/plot/FieldPlot.php +++ b/src/plot/FieldPlot.php @@ -7,6 +7,7 @@ namespace Amenadiel\JpGraph\Plot; use Amenadiel\JpGraph\Image; +use Amenadiel\JpGraph\Util; /** * @class FieldPlot diff --git a/src/plot/GanttVLine.php b/src/plot/GanttVLine.php index 81e7b232..46883cfa 100644 --- a/src/plot/GanttVLine.php +++ b/src/plot/GanttVLine.php @@ -8,6 +8,7 @@ use Amenadiel\JpGraph\Graph; use Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; class GanttVLine extends GanttPlotObject { @@ -22,7 +23,7 @@ class GanttVLine extends GanttPlotObject */ public function __construct($aDate, $aTitle = '', $aColor = 'darkred', $aWeight = 2, $aStyle = 'solid') { - GanttPlotObject::__construct(); + parent::__construct(); $this->iLine = new Graph\LineProperty(); $this->iLine->SetColor($aColor); $this->iLine->SetWeight($aWeight); diff --git a/src/plot/GroupBarPlot.php b/src/plot/GroupBarPlot.php index 2de97d55..08209cd7 100644 --- a/src/plot/GroupBarPlot.php +++ b/src/plot/GroupBarPlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * @class GroupBarPlot * // Description: Produce grouped bar plots diff --git a/src/plot/IconPlot.php b/src/plot/IconPlot.php index 2db762c1..ef309ab8 100644 --- a/src/plot/IconPlot.php +++ b/src/plot/IconPlot.php @@ -8,6 +8,7 @@ use Amenadiel\JpGraph\Graph; use Amenadiel\JpGraph\Image; +use Amenadiel\JpGraph\Util; /** * File: JPGRAPH_ICONPLOT.PHP diff --git a/src/plot/LineErrorPlot.php b/src/plot/LineErrorPlot.php index 0cbaf48a..b395ccd6 100644 --- a/src/plot/LineErrorPlot.php +++ b/src/plot/LineErrorPlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * @class LineErrorPlot * // Description: Combine a line and error plot diff --git a/src/plot/LinePlot.php b/src/plot/LinePlot.php index d8c1df6b..27926bc4 100644 --- a/src/plot/LinePlot.php +++ b/src/plot/LinePlot.php @@ -124,7 +124,7 @@ public function Legend($graph) ); } elseif ($this->fillgrad) { $color = [$this->fillgrad_fromcolor, $this->fillgrad_tocolor]; - // In order to differentiate between gradients and cooors specified as an RGB triple + // In order to differentiate between gradients and cooors specified as an Image\RGB triple $graph->legend->Add( $this->legend, $color, @@ -231,7 +231,7 @@ public function Stroke($img, $xscale, $yscale) if (isset($this->coords[1])) { if (count($this->coords[1]) != $numpoints) { Util\JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints); - //("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints"); + //("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints"); } else { $exist_x = true; } diff --git a/src/plot/MileStone.php b/src/plot/MileStone.php index 7ab37834..039806eb 100644 --- a/src/plot/MileStone.php +++ b/src/plot/MileStone.php @@ -19,7 +19,7 @@ class MileStone extends GanttPlotObject */ public function __construct($aVPos, $aLabel, $aDate, $aCaption = '') { - GanttPlotObject::__construct(); + parent::__construct(); $this->caption->Set($aCaption); $this->caption->Align('left', 'center'); $this->caption->SetFont(FF_FONT1, FS_BOLD); diff --git a/src/plot/PiePlot3D.php b/src/plot/PiePlot3D.php index 37349fd2..f2fa57c1 100644 --- a/src/plot/PiePlot3D.php +++ b/src/plot/PiePlot3D.php @@ -7,6 +7,7 @@ namespace Amenadiel\JpGraph\Plot; use Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; /** * File: JPGRAPH_PIE3D.PHP @@ -86,7 +87,7 @@ public function SetAngle($a) { if ($a < 5 || $a > 90) { Util\JpGraphError::RaiseL(14002); - //("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees."); + //("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees."); } else { $this->angle = $a; } diff --git a/src/plot/PlotLine.php b/src/plot/PlotLine.php index 57ca8ec3..76a80e5d 100644 --- a/src/plot/PlotLine.php +++ b/src/plot/PlotLine.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * File: JPGRAPH_PLOTLINE.PHP * // Description: PlotLine extension for JpGraph diff --git a/src/plot/PolarPlot.php b/src/plot/PolarPlot.php index e920ceb5..824ca805 100644 --- a/src/plot/PolarPlot.php +++ b/src/plot/PolarPlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * File: JPGRAPH_POLAR.PHP * // Description: Polar plot extension for JpGraph @@ -14,11 +16,9 @@ * // * // Copyright (c) Asial Corporation. All rights reserved. */ -require_once 'jpgraph_plotmark.inc.php'; -require_once 'jpgraph_log.php'; -define('POLAR_360', 1); -define('POLAR_180', 2); +defined('POLAR_360') || define('POLAR_360', 1); +defined('POLAR_180') || define('POLAR_180', 2); // // Note. Don't attempt to make sense of this code. diff --git a/src/plot/ScatterPlot.php b/src/plot/ScatterPlot.php index 05933e43..1b71b148 100644 --- a/src/plot/ScatterPlot.php +++ b/src/plot/ScatterPlot.php @@ -7,6 +7,7 @@ namespace Amenadiel\JpGraph\Plot; use Amenadiel\JpGraph\Graph; +use Amenadiel\JpGraph\Util; /** * @class ScatterPlot diff --git a/src/plot/StockPlot.php b/src/plot/StockPlot.php index 91a74579..8c5b2d93 100644 --- a/src/plot/StockPlot.php +++ b/src/plot/StockPlot.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * File: JPGRAPH_STOCK.PHP * // Description: Stock plot extension for JpGraph @@ -88,7 +90,7 @@ public function Stroke($img, $xscale, $yscale) if (isset($this->coords[1])) { if (count($this->coords[1]) != $n) { Util\JpGraphError::RaiseL(2003, count($this->coords[1]), $n); - // ("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints"); + // ("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints"); } else { $exist_x = true; } @@ -183,7 +185,5 @@ public function Stroke($img, $xscale, $yscale) } // A hook for subclasses to modify the plot - public function ModBox($img, $xscale, $yscale, $i, $xl, $xr, $neg) - { - } + public function ModBox($img, $xscale, $yscale, $i, $xl, $xr, $neg) {} } // @class diff --git a/src/text/GTextTable.php b/src/text/GTextTable.php index 8e329685..f2e7ead6 100644 --- a/src/text/GTextTable.php +++ b/src/text/GTextTable.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; + /** * @class GTextTable * // Description: @@ -215,11 +217,11 @@ public function Set($aArg1, $aArg2 = null, $aArg3 = null) $this->iSize[1] = $n; $this->iInit = true; } else { - JpGraphError::RaiseL(27001); + Util\JpGraphError::RaiseL(27001); //('Illegal argument to GTextTable::Set(). Array must be 2 dimensional'); } } else { - JpGraphError::RaiseL(27002); + Util\JpGraphError::RaiseL(27002); //('Illegal argument to GTextTable::Set()'); } } else { @@ -453,7 +455,7 @@ public function SetFont() $aFSize = 10; } } else { - JpGraphError::RaiseL(27003); + Util\JpGraphError::RaiseL(27003); //('Wrong number of arguments to GTextTable::SetColor()'); } $this->_chkR($aR1); @@ -504,7 +506,7 @@ public function SetAlign($aR1HAlign = null, $aC1VAlign = null, $aR2 = null, $aC2 $this->_chkC($aC2); } else { if ($aR1HAlign === null) { - JpGraphError::RaiseL(27010); + Util\JpGraphError::RaiseL(27010); } if ($aC1VAlign === null) { $aC1VAlign = 'center'; @@ -566,7 +568,7 @@ public function SetNumberFormat($aArgR1, $aC1 = null, $aR2 = null, $aC2 = null, $aC1 = 0; } if (!is_string($aArg)) { - JpGraphError::RaiseL(27013); // argument must be a string + Util\JpGraphError::RaiseL(27013); // argument must be a string } for ($i = $aArgR1; $i <= $aR2; ++$i) { for ($j = $aC1; $j <= $aC2; ++$j) { @@ -579,7 +581,7 @@ public function SetRowNumberFormat($aRow, $aF) { $this->_chkR($aRow); if (!is_string($aF)) { - JpGraphError::RaiseL(27013); // argument must be a string + Util\JpGraphError::RaiseL(27013); // argument must be a string } for ($j = 0; $j < $this->iSize[1]; ++$j) { $this->iCells[$aRow][$j]->SetNumberFormat($aF); @@ -590,7 +592,7 @@ public function SetColNumberFormat($aCol, $aF) { $this->_chkC($aCol); if (!is_string($aF)) { - JpGraphError::RaiseL(27013); // argument must be a string + Util\JpGraphError::RaiseL(27013); // argument must be a string } for ($i = 0; $i < $this->iSize[0]; ++$i) { $this->iCells[$i][$aCol]->SetNumberFormat($aF); @@ -602,7 +604,7 @@ public function SetCellNumberFormat($aRow, $aCol, $aF) $this->_chkR($aRow); $this->_chkC($aCol); if (!is_string($aF)) { - JpGraphError::RaiseL(27013); // argument must be a string + Util\JpGraphError::RaiseL(27013); // argument must be a string } $this->iCells[$aRow][$aCol]->SetNumberFormat($aF); } @@ -698,7 +700,7 @@ public function MergeCol($aCol, $aHAlign = 'center', $aVAlign = 'center') public function MergeCells($aR1, $aC1, $aR2, $aC2, $aHAlign = 'center', $aVAlign = 'center') { if ($aR1 > $aR2 || $aC1 > $aC2) { - JpGraphError::RaiseL(27004); + Util\JpGraphError::RaiseL(27004); //('GTextTable::MergeCells(). Specified cell range to be merged is not valid.'); } $this->_chkR($aR1); @@ -709,7 +711,7 @@ public function MergeCells($aR1, $aC1, $aR2, $aC2, $aHAlign = 'center', $aVAlign $cspan = $aC2 - $aC1 + 1; // Setup the parent cell for this merged group if ($this->iCells[$aR1][$aC1]->IsMerged()) { - JpGraphError::RaiseL(27005, $aR1, $aC1, $aR2, $aC2); + Util\JpGraphError::RaiseL(27005, $aR1, $aC1, $aR2, $aC2); //("Cannot merge already merged cells in the range ($aR1,$aC1), ($aR2,$aC2)"); } $this->iCells[$aR1][$aC1]->SetRowColSpan($rspan, $cspan); @@ -718,7 +720,7 @@ public function MergeCells($aR1, $aC1, $aR2, $aC2, $aHAlign = 'center', $aVAlign for ($j = $aC1; $j <= $aC2; ++$j) { if (!($i == $aR1 && $j == $aC1)) { if ($this->iCells[$i][$j]->IsMerged()) { - JpGraphError::RaiseL(27005, $aR1, $aC1, $aR2, $aC2); + Util\JpGraphError::RaiseL(27005, $aR1, $aC1, $aR2, $aC2); //("Cannot merge already merged cells in the range ($aR1,$aC1), ($aR2,$aC2)"); } $this->iCells[$i][$j]->SetMerged($aR1, $aC1, true); @@ -779,10 +781,10 @@ public function GetCSIMAreas() public function _chkC($aCol) { if (!$this->iInit) { - JpGraphError::Raise(27014); // Table not initialized + Util\JpGraphError::Raise(27014); // Table not initialized } if ($aCol < 0 || $aCol >= $this->iSize[1]) { - JpGraphError::RaiseL(27006, $aCol); + Util\JpGraphError::RaiseL(27006, $aCol); } //("GTextTable:\nColumn argument ($aCol) is outside specified table size."); @@ -791,10 +793,10 @@ public function _chkC($aCol) public function _chkR($aRow) { if (!$this->iInit) { - JpGraphError::Raise(27014); // Table not initialized + Util\JpGraphError::Raise(27014); // Table not initialized } if ($aRow < 0 || $aRow >= $this->iSize[0]) { - JpGraphError::RaiseL(27007, $aRow); + Util\JpGraphError::RaiseL(27007, $aRow); } //("GTextTable:\nRow argument ($aRow) is outside specified table size."); @@ -876,7 +878,7 @@ public function Stroke($aImg, $aX = null, $aY = null) $cc = $this->iSize[1]; // column count if ($rc == 0 || $cc == 0) { - JpGraphError::RaiseL(27009); + Util\JpGraphError::RaiseL(27009); } // Adjust margins of each cell based on the weight of the grid. Each table grid line @@ -897,7 +899,7 @@ public function Stroke($aImg, $aX = null, $aY = null) $this->_autoSizeTable($aImg); if ($this->iSize[1] != count($this->iColWidth) || $this->iSize[0] != count($this->iRowHeight)) { - JpGraphError::RaiseL(27008); + Util\JpGraphError::RaiseL(27008); //('Column and row size arrays must match the dimesnions of the table'); } diff --git a/src/text/GTextTableCell.php b/src/text/GTextTableCell.php index 719a39be..90a398d0 100644 --- a/src/text/GTextTableCell.php +++ b/src/text/GTextTableCell.php @@ -6,6 +6,9 @@ namespace Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Plot; +use Amenadiel\JpGraph\Util; + /** * File: JPGRAPH_TABLE.PHP * // Description: Classes to create basic tables of data @@ -95,25 +98,25 @@ public function GetCSIMArea() public function SetImageConstrain($aType, $aVal) { if (!in_array($aType, [TIMG_WIDTH, TIMG_HEIGHT], true)) { - JpGraphError::RaiseL(27015); + Util\JpGraphError::RaiseL(27015); } $this->iIconConstrain = [$aType, $aVal]; } public function SetCountryFlag($aFlag, $aScale = 1.0, $aMix = 100, $aStdSize = 3) { - $this->iIcon = new IconPlot(); + $this->iIcon = new Plot\IconPlot(); $this->iIcon->SetCountryFlag($aFlag, 0, 0, $aScale, $aMix, $aStdSize); } public function SetImage($aFile, $aScale = 1.0, $aMix = 100) { - $this->iIcon = new IconPlot($aFile, 0, 0, $aScale, $aMix); + $this->iIcon = new Plot\IconPlot($aFile, 0, 0, $aScale, $aMix); } public function SetImageFromString($aStr, $aScale = 1.0, $aMix = 100) { - $this->iIcon = new IconPlot('', 0, 0, $aScale, $aMix); + $this->iIcon = new Plot\IconPlot('', 0, 0, $aScale, $aMix); $this->iIcon->CreateFromString($aStr); } @@ -292,7 +295,7 @@ public function SetAlign($aHorAlign = 'left', $aVertAlign = 'bottom') $aVertAlign = strtolower($aVertAlign); $chk = ['left', 'right', 'center', 'bottom', 'top', 'middle']; if (!in_array($aHorAlign, $chk, true) || !in_array($aVertAlign, $chk, true)) { - JpGraphError::RaiseL(27011, $aHorAlign, $aVertAlign); + Util\JpGraphError::RaiseL(27011, $aHorAlign, $aVertAlign); } $this->iVertAlign = $aVertAlign; $this->iHorAlign = $aHorAlign; @@ -501,7 +504,7 @@ public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight) break; default: - JpGraphError::RaiseL(27012, $this->iHorAlign); + Util\JpGraphError::RaiseL(27012, $this->iHorAlign); } switch ($this->iVertAlign) { @@ -522,7 +525,7 @@ public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight) break; default: - JpGraphError::RaiseL(27012, $this->iVertAlign); + Util\JpGraphError::RaiseL(27012, $this->iVertAlign); } $this->iIcon->SetAnchor($hanchor, $vanchor); $this->iIcon->_Stroke($aImg, $x, $y); @@ -544,7 +547,7 @@ public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight) break; default: - JpGraphError::RaiseL(27012, $this->iHorAlign); + Util\JpGraphError::RaiseL(27012, $this->iHorAlign); } // A workaround for the shortcomings in the TTF font handling in GD // The anchor position for rotated text (=90) is to "short" so we add @@ -570,7 +573,7 @@ public function Stroke($aImg, $aX, $aY, $aWidth, $aHeight) break; default: - JpGraphError::RaiseL(27012, $this->iVertAlign); + Util\JpGraphError::RaiseL(27012, $this->iVertAlign); } $this->iVal->SetAlign($this->iHorAlign, 'top'); if ($this->iNumberFormat !== null && is_numeric($this->iVal->t)) { diff --git a/src/text/LanguageConv.php b/src/text/LanguageConv.php index ca24c7ba..f9023dab 100644 --- a/src/text/LanguageConv.php +++ b/src/text/LanguageConv.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; + /** * @class LanguageConv * // Description: @@ -52,7 +54,7 @@ public function Convert($aTxt, $aFF) } if ($aFF === FF_BIG5) { if (!function_exists('iconv')) { - JpGraphError::RaiseL(25006); + Util\JpGraphError::RaiseL(25006); //('Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).'); } @@ -61,7 +63,7 @@ public function Convert($aTxt, $aFF) if (ASSUME_EUCJP_ENCODING && ($aFF == FF_MINCHO || $aFF == FF_GOTHIC || $aFF == FF_PMINCHO || $aFF == FF_PGOTHIC)) { if (!function_exists('mb_convert_encoding')) { - JpGraphError::RaiseL(25127); + Util\JpGraphError::RaiseL(25127); } return mb_convert_encoding($aTxt, 'UTF-8', 'EUC-JP'); diff --git a/src/text/SuperScriptText.php b/src/text/SuperScriptText.php index 833fcea7..256a7e20 100644 --- a/src/text/SuperScriptText.php +++ b/src/text/SuperScriptText.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; + /** * @class SuperScriptText * // Description: Format a superscript text @@ -125,7 +127,7 @@ public function Stroke($aImg, $ax = -1, $ay = -1) break; default: - JpGraphError::RaiseL(25052); //('PANIC: Internal error in SuperScript::Stroke(). Unknown vertical alignment for text'); + Util\JpGraphError::RaiseL(25052); //('PANIC: Internal error in SuperScript::Stroke(). Unknown vertical alignment for text'); break; } @@ -143,7 +145,7 @@ public function Stroke($aImg, $ax = -1, $ay = -1) break; default: - JpGraphError::RaiseL(25053); //('PANIC: Internal error in SuperScript::Stroke(). Unknown horizontal alignment for text'); + Util\JpGraphError::RaiseL(25053); //('PANIC: Internal error in SuperScript::Stroke(). Unknown horizontal alignment for text'); break; } diff --git a/src/text/TextProperty.php b/src/text/TextProperty.php index 1f0ab03d..b5f1aea0 100644 --- a/src/text/TextProperty.php +++ b/src/text/TextProperty.php @@ -6,6 +6,8 @@ namespace Amenadiel\JpGraph\Text; +use Amenadiel\JpGraph\Util; + /** * @class TextProperty * // Description: Holds properties for a text @@ -122,7 +124,7 @@ public function SetFont($aFFamily, $aFStyle = FS_NORMAL, $aFSize = 10) public function SetColumnFonts($aFontArray) { if (!is_array($aFontArray) || count($aFontArray[0]) != 3) { - JpGraphError::RaiseL(6033); + Util\JpGraphError::RaiseL(6033); // 'Array of fonts must contain arrays with 3 elements, i.e. (Family, Style, Size)' } $this->iFontArray = $aFontArray; @@ -180,7 +182,7 @@ public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1) $w += $aImg->GetTextWidth($tmp) + $extra_margin; } else { if (is_object($tmp) === false) { - JpGraphError::RaiseL(6012); + Util\JpGraphError::RaiseL(6012); } $w += $tmp->GetWidth() + $extra_margin; } @@ -188,7 +190,7 @@ public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1) return $w; } - JpGraphError::RaiseL(6012); + Util\JpGraphError::RaiseL(6012); } // for the case where we have multiple columns this function returns the width of each @@ -211,7 +213,7 @@ public function GetColWidth($aImg, $aMargin = 0) $w[$i] = $aImg->GetTextWidth($tmp) + $aMargin; } else { if (is_object($tmp) === false) { - JpGraphError::RaiseL(6012); + Util\JpGraphError::RaiseL(6012); } $w[$i] = $tmp->GetWidth() + $aMargin; } diff --git a/src/themes/Theme.php b/src/themes/Theme.php index 6961036f..2cae02fb 100644 --- a/src/themes/Theme.php +++ b/src/themes/Theme.php @@ -15,6 +15,7 @@ namespace Amenadiel\JpGraph\Themes; use Amenadiel\JpGraph\Graph; +use Amenadiel\JpGraph\Image; use Amenadiel\JpGraph\Util; /** @@ -65,9 +66,7 @@ public function ApplyGraph($graph) } } - public function PreStrokeApply($graph) - { - } + public function PreStrokeApply($graph) {} public function GetThemeColors($num = 30) { @@ -105,7 +104,7 @@ public function GetNextColor() if ($color_count <= $this->color_index) { $color_tmp = $color_list[$this->color_index % $color_count]; $brightness = 1.0 - (int) ($this->color_index / $color_count) * 0.2; - $rgb = new RGB(); + $rgb = new Image\RGB(); $color = $color_tmp . ':' . $brightness; $color = $rgb->Color($color); $alpha = array_pop($color); diff --git a/src/util/Helper.php b/src/util/Helper.php index eba63982..5be89028 100644 --- a/src/util/Helper.php +++ b/src/util/Helper.php @@ -22,7 +22,7 @@ public static function phpErrorHandler($errno, $errmsg, $filename, $linenum, $va { // Respect current error level if ($errno & error_reporting()) { - Amenadiel\JpGraph\Util\JpGraphError::RaiseL(25003, basename($filename), $linenum, $errmsg); + JpGraphError::RaiseL(25003, basename($filename), $linenum, $errmsg); } }