Changeset 111495 in spip-zone for _plugins_/gis


Ignore:
Timestamp:
Sep 5, 2018, 3:18:00 PM (3 weeks ago)
Author:
bruno@…
Message:

compat PHP 7.2 each => foreach (thx marcimat)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/gis/trunk/inc/iptc.php

    r97663 r111495  
    7676
    7777
    78 function class_IPTC($cheminImg)
     78function __construct($cheminImg)
    7979{
    8080
     
    158158        $tblIPTC = iptcparse($this -> h_iptcData);
    159159
    160         while( (is_array($tblIPTC)) && (list($codeIPTC, $valeurIPTC) = each($tblIPTC)) )
    161         {
     160        if (!is_array($tblIPTC)) {
     161                return false;
     162        }
     163        foreach ($tblIPTC as $codeIPTC => $valeurIPTC) {
    162164                $codeIPTC = str_replace("2#", "", $codeIPTC);
    163165
    164166                if( ($codeIPTC != "000") && ($codeIPTC != "140")  && $this->h_codesIptc["$codeIPTC"])
    165167                {
    166                         while(list($index, ) = each($valeurIPTC))
    167                         {
     168                        foreach ($valeurIPTC as $index => $v) {
    168169                                if ($this->h_codesIptc["$codeIPTC"]) $codeIPTC = $this->h_codesIptc["$codeIPTC"];
    169170                                $lesIptc[$codeIPTC] .= $valeurIPTC[$index].$retourLigne;
     
    223224
    224225// On prélève le tableau contenant les codes et les valeurs des IPTC de la photo
    225 while(list($codeIPTC, $codeLibIPTC) = each($this -> h_codesIptc))
     226foreach ($this -> h_codesIptc as $codeIPTC => $codeLibIPTC) {
    226227{
    227228
Note: See TracChangeset for help on using the changeset viewer.