X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fecrire%2Fiterateur%2Fdata.php;h=616bfc8a7a83d866d7c092b6f5bde0e94d49b01c;hb=fd181064435bb60f1664ba4d8836fefce6ab0e0a;hp=55367888006e4c01fcdfcb31bd8931ce081cdc1a;hpb=ca80d6d980f19d00653a96f5c25f524b3d7334ed;p=lhc%2Fweb%2Fwww.git diff --git a/www/ecrire/iterateur/data.php b/www/ecrire/iterateur/data.php index 55367888..616bfc8a 100644 --- a/www/ecrire/iterateur/data.php +++ b/www/ecrire/iterateur/data.php @@ -127,7 +127,9 @@ class IterateurDATA implements Iterator { */ public function rewind() { reset($this->tableau); - list($this->cle, $this->valeur) = each($this->tableau); + $this->cle = key($this->tableau); + $this->valeur = current($this->tableau); + next($this->tableau); } /** @@ -433,7 +435,7 @@ class IterateurDATA implements Iterator { * **/ protected function select_datapath() { - list(, $base) = each($this->command['datapath']); + $base = reset($this->command['datapath']); if (strlen($base = ltrim(trim($base), "/"))) { $this->tableau = table_valeur($this->tableau, $base); if (!is_array($this->tableau)) { @@ -486,17 +488,17 @@ class IterateurDATA implements Iterator { $a = ' . sprintf($tv, '$aa') . '; $b = ' . sprintf($tv, '$bb') . '; if ($a <> $b) - return ($a ' . ((isset($r[2]) and $r[2]) ? '>' : '<') . ' $b) ? -1 : 1;'; + return ($a ' . (!empty($r[2]) ? '>' : '<') . ' $b) ? -1 : 1;'; } } } } if ($sortfunc) { - uasort($this->tableau, create_function('$aa,$bb', - $sortfunc . ' - return 0;' - )); + $sortfunc .= "\n return 0;"; + uasort($this->tableau, function($aa, $bb) use ($sortfunc) { + return eval($sortfunc); + }); } } @@ -556,7 +558,9 @@ class IterateurDATA implements Iterator { */ public function next() { if ($this->valid()) { - list($this->cle, $this->valeur) = each($this->tableau); + $this->cle = key($this->tableau); + $this->valeur = current($this->tableau); + next($this->tableau); } }