Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility improvements #143

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/graph/GanttScale.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -774,76 +774,76 @@ public function StrokeDays($aYCoord, $getHeight = false)
}
}

$mn = strftime('%m', $datestamp);
$mn = date('%m', $datestamp);
if ($mn[0] == '0') {
$mn = $mn[1];
}

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;
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/graph/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ public function GetCSIMareas()
// Get a complete <MAP>..</MAP> tag for the final image map
public function GetHTMLImageMap($aMapName)
{
$im = "<map name=\"${aMapName}\" id=\"${aMapName}\" >\n";
$im = "<map name=\"{$aMapName}\" id=\"{$aMapName}\" >\n";
$im .= $this->GetCSIMareas();
$im .= '</map>';

Expand Down
6 changes: 3 additions & 3 deletions src/graph/Legend.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,17 @@ 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 .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . htmlentities($p[4]) . '"';
$this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . htmlentities($p[4]) . '"';

if (!empty($p[6])) {
$this->csimareas .= ' target="' . $p[6] . '"';
}

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";
}
Expand Down
1 change: 1 addition & 0 deletions src/graph/Ticks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/plot/AccBarPlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plot/BarPlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
12 changes: 6 additions & 6 deletions src/plot/GanttBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ 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 .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . $this->title->csimtarget[$i] . '"';
$this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->title->csimtarget[$i] . '"';

if (!empty($this->title->csimwintarget[$i])) {
$this->csimarea .= 'target="' . $this->title->csimwintarget[$i] . '" ';
}

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";
}
Expand Down Expand Up @@ -233,16 +233,16 @@ public function Stroke($aImg, $aScale)
}
// CSIM for bar
if (!empty($this->csimtarget)) {
$coords = "${xt},${yt},${xb},${yt},${xb},${yb},${xt},${yb}";
$this->csimarea .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . $this->csimtarget . '"';
$coords = "{$xt},{$yt},{$xb},{$yt},{$xb},{$yb},{$xt},{$yb}";
$this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->csimtarget . '"';

if (!empty($this->csimwintarget)) {
$this->csimarea .= ' target="' . $this->csimwintarget . '" ';
}

if ($this->csimalt != '') {
$tmp = $this->csimalt;
$this->csimarea .= " title=\"${tmp}\" alt=\"${tmp}\" ";
$this->csimarea .= " title=\"{$tmp}\" alt=\"{$tmp}\" ";
}
$this->csimarea .= " />\n";
}
Expand Down
6 changes: 3 additions & 3 deletions src/plot/MileStone.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ 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 .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . $this->title->csimtarget[$i] . '"';
$this->csimarea .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->title->csimtarget[$i] . '"';

if (!empty($this->title->csimwintarget[$i])) {
$this->csimarea .= 'target="' . $this->title->csimwintarget[$i] . '"';
}

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";
}
Expand Down
14 changes: 7 additions & 7 deletions src/plot/PiePlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . $this->csimtargets[$i] . '"';
$this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->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";
}
Expand Down
16 changes: 8 additions & 8 deletions src/plot/PiePlot3D.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand All @@ -136,21 +136,21 @@ 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 .= "<area shape=\"poly\" coords=\"${coords}\" href=\"" . $this->csimtargets[$i] . '"';
$this->csimareas .= "<area shape=\"poly\" coords=\"{$coords}\" href=\"" . $this->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 .= "alt=\"${tmp}\" title=\"${tmp}\" ";
$this->csimareas .= "alt=\"{$tmp}\" title=\"{$tmp}\" ";
}
$this->csimareas .= " />\n";
}
Expand Down
Loading