Upgrade jpgrah to 4.3.4
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Nigel Sheldon 2021-01-03 17:10:26 +01:00
commit b5868f05f6
72 changed files with 19157 additions and 10327 deletions

View file

@ -1,11 +1,11 @@
<?php
//=======================================================================
// File: JPGRAPH_FLAGS.PHP
// Description: Class Jpfile. Handles plotmarks
// Created: 2003-06-28
// Ver: $Id: jpgraph_flags.php 957 2007-12-01 14:00:29Z ljp $
// File: JPGRAPH_FLAGS.PHP
// Description: Class Jpfile. Handles plotmarks
// Created: 2003-06-28
// Ver: $Id: jpgraph_flags.php 1106 2009-02-22 20:16:35Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
//------------------------------------------------------------
@ -267,22 +267,22 @@ class FlagImages
private $iFlagData ;
private $iOrdIdx=array();
public function FlagImages($aSize=FLAGSIZE1)
public function __construct($aSize=FLAGSIZE1)
{
switch ($aSize) {
case FLAGSIZE1:
case FLAGSIZE2:
case FLAGSIZE3:
case FLAGSIZE4:
$file = dirname(__FILE__).'/'.$this->iFlagSetMap[$aSize].'.dat';
$fp = fopen($file, 'rb');
$rawdata = fread($fp, filesize($file));
$this->iFlagData = unserialize($rawdata);
break;
default:
JpGraphError::RaiseL(5001, $aSize);
//('Unknown flag size. ('.$aSize.')');
}
case FLAGSIZE1:
case FLAGSIZE2:
case FLAGSIZE3:
case FLAGSIZE4:
$file = dirname(__FILE__).'/'.$this->iFlagSetMap[$aSize].'.dat';
$fp = fopen($file, 'rb');
$rawdata = fread($fp, filesize($file));
$this->iFlagData = unserialize($rawdata);
break;
default:
JpGraphError::RaiseL(5001, $aSize);
//('Unknown flag size. ('.$aSize.')');
}
$this->iFlagCount = count($this->iCountryNameMap);
}
@ -304,7 +304,7 @@ class FlagImages
return Image::CreateFromString($d);
} else {
JpGraphError::RaiseL(5002, $aIdx);
//("Flag index \" $aIdx\" does not exist.");
//("Flag index \"<EFBFBD>$aIdx\" does not exist.");
}
}
@ -313,10 +313,9 @@ class FlagImages
$aOrd--;
$n = count($this->iOrdIdx);
if ($n == 0) {
reset($this->iCountryNameMap);
$this->iOrdIdx=array();
$i=0;
while (list($key, $val) = each($this->iCountryNameMap)) {
foreach ($this->iCountryNameMap as $key => $val) {
$this->iOrdIdx[$i++] = array($val,$key);
}
$tmp=$this->iOrdIdx[$aOrd];
@ -342,18 +341,16 @@ class FlagImages
$found=false;
$aName = strtolower($aName);
$nlen = strlen($aName);
reset($this->iCountryNameMap);
// Start by trying to match exact index name
while (list($key, $val) = each($this->iCountryNameMap)) {
foreach ($this->iCountryNameMap as $key => $val) {
if ($nlen == strlen($val) && $val == $aName) {
$found=true;
break;
}
}
if (!$found) {
reset($this->iCountryNameMap);
// If the exact index doesn't work try a (partial) full name
while (list($key, $val) = each($this->iCountryNameMap)) {
foreach ($this->iCountryNameMap as $key => $val) {
if (strpos(strtolower($key), $aName) !== false) {
$found=true;
break;