1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
From 487465117861fa9711a0281b8b9eabfed53ce9b0 Mon Sep 17 00:00:00 2001
From: Emiel Molenaar <emiel.molenaar@gmail.com>
Date: Thu, 21 Sep 2017 12:10:50 +0200
Subject: [PATCH] Refactor deprecated each() calls to foreach()
---
tcpdf.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tcpdf.php b/tcpdf.php
index 65196e74..f3dc2314 100644
--- a/tcpdf.php
+++ b/tcpdf.php
@@ -12582,7 +12582,7 @@ protected function _addfield($type, $name, $x, $y, $w, $h, $prop) {
$k = $this->k;
$this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n";
$this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
- while (list($key, $val) = each($prop)) {
+ foreach($prop as $key => $val) {
if (strcmp(substr($key, -5), 'Color') == 0) {
$val = TCPDF_COLORS::_JScolor($val);
} else {
@@ -16545,9 +16545,9 @@ protected function getHtmlDomArray($html) {
// get attributes
preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
$dom[$key]['attribute'] = array(); // reset attribute array
- while (list($id, $name) = each($attr_array[1])) {
- $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
- }
+ foreach($attr_array[1] as $id => $name) {
+ $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
+ }
if (!empty($css)) {
// merge CSS style to current style
list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css);
@@ -16558,10 +16558,10 @@ protected function getHtmlDomArray($html) {
// get style attributes
preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
$dom[$key]['style'] = array(); // reset style attribute array
- while (list($id, $name) = each($style_array[1])) {
- // in case of duplicate attribute the last replace the previous
- $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
- }
+ foreach($style_array[1] as $id => $name) {
+ // in case of duplicate attribute the last replace the previous
+ $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
+ }
// --- get some style attributes ---
// text direction
if (isset($dom[$key]['style']['direction'])) {
|