From a5258a1e41440ae58ade4d1988e3fbd0c1fe1260 Mon Sep 17 00:00:00 2001 From: jeeinn Date: Thu, 16 Feb 2023 21:45:44 +0800 Subject: [PATCH 1/4] PHP 8.2: Using ${var} in strings is deprecated, use {$var} instead --- src/graph/GanttScale.php | 2 +- src/graph/Graph.php | 2 +- src/graph/Legend.php | 6 +++--- src/plot/AccBarPlot.php | 4 ++-- src/plot/BarPlot.php | 2 +- src/plot/GanttBar.php | 12 ++++++------ src/plot/MileStone.php | 6 +++--- src/plot/PiePlot.php | 14 +++++++------- src/plot/PiePlot3D.php | 16 ++++++++-------- src/plot/PiePlotC.php | 24 ++++++++++++------------ src/plot/PlotMark.php | 10 +++++----- src/plot/StockPlot.php | 2 +- src/text/GTextTable.php | 2 +- src/text/Text.php | 2 +- src/util/DateLocale.php | 4 ++-- 15 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/graph/GanttScale.php b/src/graph/GanttScale.php index 0f37c477..c370bd18 100644 --- a/src/graph/GanttScale.php +++ b/src/graph/GanttScale.php @@ -263,7 +263,7 @@ public function AdjustStartEndDay() if ($preferredEndDay != $de) { // Solve equivalence eq: $de + x ~ $preferredDay (mod 7) $adj = (7 + ($preferredEndDay - $de)) % 7; - $adjdate = strtotime("+${adj} day", $this->iEndDate); + $adjdate = strtotime("+{$adj} day", $this->iEndDate); $this->iEndDate = $adjdate; } } diff --git a/src/graph/Graph.php b/src/graph/Graph.php index 7f740b0b..375b364f 100644 --- a/src/graph/Graph.php +++ b/src/graph/Graph.php @@ -892,7 +892,7 @@ public function GetCSIMareas() // Get a complete .. tag for the final image map public function GetHTMLImageMap($aMapName) { - $im = "\n"; + $im = "\n"; $im .= $this->GetCSIMareas(); $im .= ''; diff --git a/src/graph/Legend.php b/src/graph/Legend.php index 097db7ad..ac70cf38 100644 --- a/src/graph/Legend.php +++ b/src/graph/Legend.php @@ -529,9 +529,9 @@ public function Stroke($aImg) $ys = $y1 + 1; $xe = $x1 + $aImg->GetTextWidth($p[0]) + $this->mark_abs_hsize + $this->xmargin; $ye = $y1 - $rowheight[$row] + 1; - $coords = "${xs},${ys},${xe},${y1},${xe},${ye},${xs},${ye}"; + $coords = "{$xs},{$ys},{$xe},{$y1},{$xe},{$ye},{$xs},{$ye}"; if (!empty($p[4])) { - $this->csimareas .= "csimareas .= "csimareas .= ' target="' . $p[6] . '"'; @@ -539,7 +539,7 @@ public function Stroke($aImg) if (!empty($p[5])) { $tmp = sprintf($p[5], $p[0]); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/AccBarPlot.php b/src/plot/AccBarPlot.php index 1ce72597..440a8a58 100644 --- a/src/plot/AccBarPlot.php +++ b/src/plot/AccBarPlot.php @@ -364,9 +364,9 @@ public function Stroke($img, $xscale, $yscale) $sval = ''; if (!empty($this->plots[$j]->csimalts[$i])) { $sval = sprintf($this->plots[$j]->csimalts[$i], $this->plots[$j]->coords[0][$i]); - $this->csimareas .= " title=\"${sval}\" "; + $this->csimareas .= " title=\"{$sval}\" "; } - $this->csimareas .= " alt=\"${sval}\" />\n"; + $this->csimareas .= " alt=\"{$sval}\" />\n"; } } diff --git a/src/plot/BarPlot.php b/src/plot/BarPlot.php index 2e5478e8..ffbad296 100644 --- a/src/plot/BarPlot.php +++ b/src/plot/BarPlot.php @@ -755,7 +755,7 @@ public function Stroke($img, $xscale, $yscale) $sval = ''; if (!empty($this->csimalts[$i])) { $sval = sprintf($this->csimalts[$i], $this->coords[0][$i]); - $this->csimareas .= " title=\"${sval}\" alt=\"${sval}\" "; + $this->csimareas .= " title=\"{$sval}\" alt=\"{$sval}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/GanttBar.php b/src/plot/GanttBar.php index d78fca4a..6eaf92b8 100644 --- a/src/plot/GanttBar.php +++ b/src/plot/GanttBar.php @@ -182,10 +182,10 @@ public function Stroke($aImg, $aScale) for ($i = 0; $i < $n; ++$i) { $title_xt = $colstarts[$i]; $title_xb = $title_xt + $colwidth[$i]; - $coords = "${title_xt},${yt},${title_xb},${yt},${title_xb},${yb},${title_xt},${yb}"; + $coords = "{$title_xt},{$yt},{$title_xb},{$yt},{$title_xb},{$yb},{$title_xt},{$yb}"; if (!empty($this->title->csimtarget[$i])) { - $this->csimarea .= "title->csimtarget[$i] . '"'; + $this->csimarea .= "title->csimtarget[$i] . '"'; if (!empty($this->title->csimwintarget[$i])) { $this->csimarea .= 'target="' . $this->title->csimwintarget[$i] . '" '; @@ -193,7 +193,7 @@ public function Stroke($aImg, $aScale) if (!empty($this->title->csimalt[$i])) { $tmp = $this->title->csimalt[$i]; - $this->csimarea .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimarea .= " />\n"; } @@ -233,8 +233,8 @@ public function Stroke($aImg, $aScale) } // CSIM for bar if (!empty($this->csimtarget)) { - $coords = "${xt},${yt},${xb},${yt},${xb},${yb},${xt},${yb}"; - $this->csimarea .= "csimtarget . '"'; + $coords = "{$xt},{$yt},{$xb},{$yt},{$xb},{$yb},{$xt},{$yb}"; + $this->csimarea .= "csimtarget . '"'; if (!empty($this->csimwintarget)) { $this->csimarea .= ' target="' . $this->csimwintarget . '" '; @@ -242,7 +242,7 @@ public function Stroke($aImg, $aScale) if ($this->csimalt != '') { $tmp = $this->csimalt; - $this->csimarea .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimarea .= " />\n"; } diff --git a/src/plot/MileStone.php b/src/plot/MileStone.php index ec860401..9c641c9d 100644 --- a/src/plot/MileStone.php +++ b/src/plot/MileStone.php @@ -70,10 +70,10 @@ public function Stroke($aImg, $aScale) for ($i = 0; $i < $n; ++$i) { $title_xt = $colstarts[$i]; $title_xb = $title_xt + $colwidth[$i]; - $coords = "${title_xt},${yt},${title_xb},${yt},${title_xb},${yb},${title_xt},${yb}"; + $coords = "{$title_xt},{$yt},{$title_xb},{$yt},{$title_xb},{$yb},{$title_xt},{$yb}"; if (!empty($this->title->csimtarget[$i])) { - $this->csimarea .= "title->csimtarget[$i] . '"'; + $this->csimarea .= "title->csimtarget[$i] . '"'; if (!empty($this->title->csimwintarget[$i])) { $this->csimarea .= 'target="' . $this->title->csimwintarget[$i] . '"'; @@ -81,7 +81,7 @@ public function Stroke($aImg, $aScale) if (!empty($this->title->csimalt[$i])) { $tmp = $this->title->csimalt[$i]; - $this->csimarea .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimarea .= " />\n"; } diff --git a/src/plot/PiePlot.php b/src/plot/PiePlot.php index a55ccbba..a8b1a9e8 100644 --- a/src/plot/PiePlot.php +++ b/src/plot/PiePlot.php @@ -178,12 +178,12 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) //add coordinates of the centre to the map $xc = floor($xc); $yc = floor($yc); - $coords = "${xc}, ${yc}"; + $coords = "{$xc}, {$yc}"; //add coordinates of the first point on the arc to the map $xp = floor(($radius * cos($ea)) + $xc); $yp = floor($yc - $radius * sin($ea)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; //add coordinates every 0.2 radians $a = $ea + 0.2; @@ -194,7 +194,7 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) while ($a <= 2 * M_PI) { $xp = floor($radius * cos($a) + $xc); $yp = floor($yc - $radius * sin($a)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a += 0.2; } $a -= 2 * M_PI; @@ -203,23 +203,23 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) while ($a < $sa) { $xp = floor($radius * cos($a) + $xc); $yp = floor($yc - $radius * sin($a)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a += 0.2; } //Add the last point on the arc $xp = floor($radius * cos($sa) + $xc); $yp = floor($yc - $radius * sin($sa)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; if (!empty($this->csimtargets[$i])) { - $this->csimareas .= "csimtargets[$i] . '"'; + $this->csimareas .= "csimtargets[$i] . '"'; $tmp = ''; if (!empty($this->csimwintargets[$i])) { $this->csimareas .= ' target="' . $this->csimwintargets[$i] . '" '; } if (!empty($this->csimalts[$i])) { $tmp = sprintf($this->csimalts[$i], $this->data[$i]); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/PiePlot3D.php b/src/plot/PiePlot3D.php index ee8f030b..52fe462c 100644 --- a/src/plot/PiePlot3D.php +++ b/src/plot/PiePlot3D.php @@ -105,17 +105,17 @@ public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea $ea *= M_PI / 180; //add coordinates of the centre to the map - $coords = "${xc}, ${yc}"; + $coords = "{$xc}, {$yc}"; //add coordinates of the first point on the arc to the map $xp = floor($width * cos($sa) / 2 + $xc); $yp = floor($yc - $height * sin($sa) / 2); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; //If on the front half, add the thickness offset if ($sa >= M_PI && $sa <= 2 * M_PI * 1.01) { $yp = floor($yp + $thick); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; } //add coordinates every 0.2 radians @@ -127,7 +127,7 @@ public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea } else { $yp = floor($yc - $height * sin($a) / 2); } - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a += 0.2; } @@ -136,13 +136,13 @@ public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea $yp = floor($yc - $height * sin($ea) / 2); if ($ea >= M_PI && $ea <= 2 * M_PI * 1.01) { - $coords .= ", ${xp}, " . floor($yp + $thick); + $coords .= ", {$xp}, " . floor($yp + $thick); } - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $alt = ''; if (!empty($this->csimtargets[$i])) { - $this->csimareas .= "csimtargets[$i] . '"'; + $this->csimareas .= "csimtargets[$i] . '"'; if (!empty($this->csimwintargets[$i])) { $this->csimareas .= ' target="' . $this->csimwintargets[$i] . '" '; @@ -150,7 +150,7 @@ public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea if (!empty($this->csimalts[$i])) { $tmp = sprintf($this->csimalts[$i], $this->data[$i]); - $this->csimareas .= "alt=\"${tmp}\" title=\"${tmp}\" "; + $this->csimareas .= "alt=\"{$tmp}\" title=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/PiePlotC.php b/src/plot/PiePlotC.php index 9f186fbf..1e35d0fd 100644 --- a/src/plot/PiePlotC.php +++ b/src/plot/PiePlotC.php @@ -83,7 +83,7 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) // Add inner circle first point $xp = floor(($this->imidsize * $radius * cos($ea)) + $xc); $yp = floor($yc - ($this->imidsize * $radius * sin($ea))); - $coords = "${xp}, ${yp}"; + $coords = "{$xp}, {$yp}"; //add coordinates every 0.25 radians $a = $ea + 0.25; @@ -94,7 +94,7 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) while ($a <= 2 * M_PI) { $xp = floor($radius * cos($a) + $xc); $yp = floor($yc - $radius * sin($a)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a += 0.25; } $a -= 2 * M_PI; @@ -103,48 +103,48 @@ public function AddSliceToCSIM($i, $xc, $yc, $radius, $sa, $ea) while ($a < $sa) { $xp = floor(($this->imidsize * $radius * cos($a) + $xc)); $yp = floor($yc - ($this->imidsize * $radius * sin($a))); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a += 0.25; } // Make sure we end at the last point $xp = floor(($this->imidsize * $radius * cos($sa) + $xc)); $yp = floor($yc - ($this->imidsize * $radius * sin($sa))); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; // Straight line to outer circle $xp = floor($radius * cos($sa) + $xc); $yp = floor($yc - $radius * sin($sa)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; //add coordinates every 0.25 radians $a = $sa - 0.25; while ($a > $ea) { $xp = floor($radius * cos($a) + $xc); $yp = floor($yc - $radius * sin($a)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; $a -= 0.25; } //Add the last point on the arc $xp = floor($radius * cos($ea) + $xc); $yp = floor($yc - $radius * sin($ea)); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; // Close the arc $xp = floor(($this->imidsize * $radius * cos($ea)) + $xc); $yp = floor($yc - ($this->imidsize * $radius * sin($ea))); - $coords .= ", ${xp}, ${yp}"; + $coords .= ", {$xp}, {$yp}"; if (!empty($this->csimtargets[$i])) { - $this->csimareas .= "csimareas .= "csimtargets[$i] . '"'; if (!empty($this->csimwintargets[$i])) { $this->csimareas .= ' target="' . $this->csimwintargets[$i] . '" '; } if (!empty($this->csimalts[$i])) { $tmp = sprintf($this->csimalts[$i], $this->data[$i]); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } @@ -198,14 +198,14 @@ public function AddMiddleCSIM($xc, $yc, $r) $xc = round($xc); $yc = round($yc); $r = round($r); - $this->csimareas .= "csimareas .= "middlecsimtarget . '"'; if (!empty($this->middlecsimwintarget)) { $this->csimareas .= ' target="' . $this->middlecsimwintarget . '"'; } if (!empty($this->middlecsimalt)) { $tmp = $this->middlecsimalt; - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/PlotMark.php b/src/plot/PlotMark.php index b068aeb1..ea1711de 100644 --- a/src/plot/PlotMark.php +++ b/src/plot/PlotMark.php @@ -180,7 +180,7 @@ public function AddCSIMPoly($aPts) } $this->csimareas = ''; if (!empty($this->csimtarget)) { - $this->csimareas .= "csimareas .= "csimareas .= 'href="' . htmlentities($this->csimtarget) . '"'; if (!empty($this->csimwintarget)) { @@ -189,7 +189,7 @@ public function AddCSIMPoly($aPts) if (!empty($this->csimalt)) { $tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\""; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\""; } $this->csimareas .= " />\n"; } @@ -202,7 +202,7 @@ public function AddCSIMCircle($x, $y, $r) $r = round($r); $this->csimareas = ''; if (!empty($this->csimtarget)) { - $this->csimareas .= "csimareas .= "csimareas .= 'href="' . htmlentities($this->csimtarget) . '"'; if (!empty($this->csimwintarget)) { @@ -211,7 +211,7 @@ public function AddCSIMCircle($x, $y, $r) if (!empty($this->csimalt)) { $tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } @@ -366,7 +366,7 @@ public function Stroke($img, $x, $y) if (!empty($this->csimalt)) { $tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); - $this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; + $this->csimareas .= " title=\"{$tmp}\" alt=\"{$tmp}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/plot/StockPlot.php b/src/plot/StockPlot.php index 29085816..42f8b199 100644 --- a/src/plot/StockPlot.php +++ b/src/plot/StockPlot.php @@ -183,7 +183,7 @@ public function Stroke($img, $xscale, $yscale) $this->csimareas .= ' href="' . $this->csimtargets[$i] . '"'; if (!empty($this->csimalts[$i])) { $sval = $this->csimalts[$i]; - $this->csimareas .= " title=\"${sval}\" alt=\"${sval}\" "; + $this->csimareas .= " title=\"{$sval}\" alt=\"{$sval}\" "; } $this->csimareas .= " />\n"; } diff --git a/src/text/GTextTable.php b/src/text/GTextTable.php index ae8ef022..3ef0f15e 100644 --- a/src/text/GTextTable.php +++ b/src/text/GTextTable.php @@ -809,7 +809,7 @@ public function SetCSIMTarget($aTarget, $aAlt = null, $aAutoTarget = false) for ($i = 0; $i < $m; ++$i) { for ($j = 0; $j < $n; ++$j) { if ($aAutoTarget) { - $t = $aTarget . "?row=${i}&col=${j}"; + $t = $aTarget . "?row={$i}&col={$j}"; } else { $t = $aTarget; } diff --git a/src/text/Text.php b/src/text/Text.php index dc959b8b..4875b67e 100644 --- a/src/text/Text.php +++ b/src/text/Text.php @@ -376,7 +376,7 @@ public function Stroke($aImg, $x = null, $y = null) $coords = implode(',', [ $bbox[0], $bbox[1], $bbox[2], $bbox[3], $bbox[4], $bbox[5], $bbox[6], $bbox[7], ]); - $this->iCSIMarea = "iCSIMarea = "iCSIMarea .= htmlentities($this->iCSIMtarget) . '" '; if (trim($this->iCSIMalt) != '') { $this->iCSIMarea .= ' alt="' . $this->iCSIMalt . '" '; diff --git a/src/util/DateLocale.php b/src/util/DateLocale.php index bf8c6801..aca920b7 100644 --- a/src/util/DateLocale.php +++ b/src/util/DateLocale.php @@ -58,14 +58,14 @@ public function Set($aLocale) $this->iLocale = $aLocale; for ($i = 0, $ofs = 0 - strftime('%w'); $i < 7; $i++, $ofs++) { - $day = strftime('%a', strtotime("${ofs} day")); + $day = strftime('%a', strtotime("{$ofs} day")); $day[0] = strtoupper($day[0]); $this->iDayAbb[$aLocale][] = $day[0]; $this->iShortDay[$aLocale][] = $day; } for ($i = 1; $i <= 12; ++$i) { - list($short, $full) = explode('|', strftime('%b|%B', strtotime("2001-${i}-01"))); + list($short, $full) = explode('|', strftime('%b|%B', strtotime("2001-{$i}-01"))); $this->iShortMonth[$aLocale][] = ucfirst($short); $this->iMonthName[$aLocale][] = ucfirst($full); } From f32f07e55c1209d2f4847f74842b51c6a52a77b9 Mon Sep 17 00:00:00 2001 From: jeeinn Date: Thu, 16 Feb 2023 21:46:48 +0800 Subject: [PATCH 2/4] PHP 8.1: the strftime() and gmstrftime() functions are deprecated,use date() instead --- src/graph/GanttScale.php | 40 ++++++++++++++++++++-------------------- src/util/DateLocale.php | 6 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/graph/GanttScale.php b/src/graph/GanttScale.php index c370bd18..701fec46 100644 --- a/src/graph/GanttScale.php +++ b/src/graph/GanttScale.php @@ -241,8 +241,8 @@ public function AdjustStartEndDay() } // Get day in week for start and ending date (Sun==0) - $ds = strftime('%w', $this->iStartDate); - $de = strftime('%w', $this->iEndDate); + $ds = date('%w', $this->iStartDate); + $de = date('%w', $this->iEndDate); // We want to start on iWeekStart day. But first we subtract a week // if the startdate is "behind" the day the week start at. @@ -410,19 +410,19 @@ public function GetNumDaysInMonth($aMonth, $aYear) // Get day in month public function GetMonthDayNbr($aDate) { - return 0 + strftime('%d', $aDate); + return 0 + date('%d', $aDate); } // Get day in year public function GetYearDayNbr($aDate) { - return 0 + strftime('%j', $aDate); + return 0 + date('%j', $aDate); } // Get month number public function GetMonthNbr($aDate) { - return 0 + strftime('%m', $aDate); + return 0 + date('%m', $aDate); } // Translate a date to screen coordinates (horizontal scale) @@ -774,7 +774,7 @@ public function StrokeDays($aYCoord, $getHeight = false) } } - $mn = strftime('%m', $datestamp); + $mn = date('%m', $datestamp); if ($mn[0] == '0') { $mn = $mn[1]; } @@ -782,68 +782,68 @@ public function StrokeDays($aYCoord, $getHeight = false) switch ($this->day->iStyle) { case DAYSTYLE_LONG: // "Monday" - $txt = strftime('%A', $datestamp); + $txt = date('%A', $datestamp); break; case DAYSTYLE_SHORT: // "Mon" - $txt = strftime('%a', $datestamp); + $txt = date('%a', $datestamp); break; case DAYSTYLE_SHORTDAYDATE1: // "Mon 23/6" - $txt = strftime('%a %d/' . $mn, $datestamp); + $txt = date('%a %d/' . $mn, $datestamp); break; case DAYSTYLE_SHORTDAYDATE2: // "Mon 23 Jun" - $txt = strftime('%a %d %b', $datestamp); + $txt = date('%a %d %b', $datestamp); break; case DAYSTYLE_SHORTDAYDATE3: // "Mon 23 Jun 2003" - $txt = strftime('%a %d %b %Y', $datestamp); + $txt = date('%a %d %b %Y', $datestamp); break; case DAYSTYLE_LONGDAYDATE1: // "Monday 23 Jun" - $txt = strftime('%A %d %b', $datestamp); + $txt = date('%A %d %b', $datestamp); break; case DAYSTYLE_LONGDAYDATE2: // "Monday 23 Jun 2003" - $txt = strftime('%A %d %b %Y', $datestamp); + $txt = date('%A %d %b %Y', $datestamp); break; case DAYSTYLE_SHORTDATE1: // "23/6" - $txt = strftime('%d/' . $mn, $datestamp); + $txt = date('%d/' . $mn, $datestamp); break; case DAYSTYLE_SHORTDATE2: // "23 Jun" - $txt = strftime('%d %b', $datestamp); + $txt = date('%d %b', $datestamp); break; case DAYSTYLE_SHORTDATE3: // "Mon 23" - $txt = strftime('%a %d', $datestamp); + $txt = date('%a %d', $datestamp); break; case DAYSTYLE_SHORTDATE4: // "23" - $txt = strftime('%d', $datestamp); + $txt = date('%d', $datestamp); break; case DAYSTYLE_CUSTOM: // Custom format - $txt = strftime($this->day->iLabelFormStr, $datestamp); + $txt = date($this->day->iLabelFormStr, $datestamp); break; case DAYSTYLE_ONELETTER: default: // "M" - $txt = strftime('%A', $datestamp); + $txt = date('%A', $datestamp); $txt = strtoupper($txt[0]); break; @@ -1017,7 +1017,7 @@ public function StrokeMonths($aYCoord, $getHeight = false) $img->SetLineWeight($this->month->grid->iWeight); $img->SetColor($this->month->iTextColor); - $year = 0 + strftime('%Y', $this->iStartDate); + $year = 0 + date('%Y', $this->iStartDate); $img->SetTextAlign('center'); if ($this->GetMonthNbr($this->iStartDate) == $this->GetMonthNbr($this->iEndDate) && $this->GetYear($this->iStartDate) == $this->GetYear($this->iEndDate)) { diff --git a/src/util/DateLocale.php b/src/util/DateLocale.php index aca920b7..35dc57c3 100644 --- a/src/util/DateLocale.php +++ b/src/util/DateLocale.php @@ -57,15 +57,15 @@ public function Set($aLocale) } $this->iLocale = $aLocale; - for ($i = 0, $ofs = 0 - strftime('%w'); $i < 7; $i++, $ofs++) { - $day = strftime('%a', strtotime("{$ofs} day")); + for ($i = 0, $ofs = 0 - date('%w'); $i < 7; $i++, $ofs++) { + $day = date('%a', strtotime("{$ofs} day")); $day[0] = strtoupper($day[0]); $this->iDayAbb[$aLocale][] = $day[0]; $this->iShortDay[$aLocale][] = $day; } for ($i = 1; $i <= 12; ++$i) { - list($short, $full) = explode('|', strftime('%b|%B', strtotime("2001-{$i}-01"))); + list($short, $full) = explode('|', date('%b|%B', strtotime("2001-{$i}-01"))); $this->iShortMonth[$aLocale][] = ucfirst($short); $this->iMonthName[$aLocale][] = ucfirst($full); } From 7489934c2bb0d57402907083c6221ac747c59c13 Mon Sep 17 00:00:00 2001 From: jeeinn Date: Thu, 16 Feb 2023 21:47:39 +0800 Subject: [PATCH 3/4] PHP 8.0: Unsupported operand types: int - string --- src/util/DateLocale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/DateLocale.php b/src/util/DateLocale.php index 35dc57c3..32358022 100644 --- a/src/util/DateLocale.php +++ b/src/util/DateLocale.php @@ -57,7 +57,7 @@ public function Set($aLocale) } $this->iLocale = $aLocale; - for ($i = 0, $ofs = 0 - date('%w'); $i < 7; $i++, $ofs++) { + for ($i = 0, $ofs = 0 - (int)date('%w'); $i < 7; $i++, $ofs++) { $day = date('%a', strtotime("{$ofs} day")); $day[0] = strtoupper($day[0]); $this->iDayAbb[$aLocale][] = $day[0]; From 544e95feb77ac4594ad5f965ce61bc582fa547a7 Mon Sep 17 00:00:00 2001 From: jeeinn Date: Thu, 16 Feb 2023 21:50:20 +0800 Subject: [PATCH 4/4] PHP 8.2: Creation of dynamic property --- src/graph/Ticks.php | 1 + src/themes/Theme.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/graph/Ticks.php b/src/graph/Ticks.php index 7e0a4122..4100588b 100644 --- a/src/graph/Ticks.php +++ b/src/graph/Ticks.php @@ -23,6 +23,7 @@ class Ticks public $maj_ticks_pos = []; public $maj_ticklabels_pos = []; public $ticks_pos = []; + public $ticks_label = []; public $maj_ticks_label = []; public $precision; diff --git a/src/themes/Theme.php b/src/themes/Theme.php index c1798aa4..12db7486 100644 --- a/src/themes/Theme.php +++ b/src/themes/Theme.php @@ -26,6 +26,7 @@ abstract class Theme { protected $color_index; + private $graph; public function __construct() {