Skip to content

Commit

Permalink
Dev: Remove {} array/string access
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt authored and eddylackmann committed Jan 27, 2020
1 parent a6ea9a3 commit 6ce757d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions application/helpers/Zend/Validate/Isbn.php
Expand Up @@ -167,7 +167,7 @@ public function isValid($value)
$isbn10 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 9; $i++) {
$sum += (10 - $i) * $isbn10{$i};
$sum += (10 - $i) * $isbn10[$i];
}

// checksum
Expand All @@ -185,9 +185,9 @@ public function isValid($value)
$sum = 0;
for ($i = 0; $i < 12; $i++) {
if ($i % 2 == 0) {
$sum += $isbn13{$i};
$sum += $isbn13[$i];
} else {
$sum += 3 * $isbn13{$i};
$sum += 3 * $isbn13[$i];
}
}
// checksum
Expand Down
2 changes: 1 addition & 1 deletion application/third_party/tcpdf/tcpdf.php
Expand Up @@ -16900,7 +16900,7 @@ protected function getHtmlDomArray($html) {
if (!empty($dom[$key]['value']) AND ($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) {
// headings h1, h2, h3, h4, h5, h6
if (!isset($dom[$key]['attribute']['size']) AND !isset($dom[$key]['style']['font-size'])) {
$headsize = (4 - intval($dom[$key]['value']{1})) * 2;
$headsize = (4 - intval($dom[$key]['value'][1])) * 2;
$dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize;
}
if (!isset($dom[$key]['style']['font-weight'])) {
Expand Down
40 changes: 20 additions & 20 deletions application/third_party/tcpdf/tcpdf_barcodes_1d.php
Expand Up @@ -543,7 +543,7 @@ protected function checksum_code39($code) {
$sum = 0;
$clen = strlen($code);
for ($i = 0 ; $i < $clen; ++$i) {
$k = array_keys($chars, $code{$i});
$k = array_keys($chars, $code[$i]);
$sum += $k[0];
}
$j = ($sum % 43);
Expand Down Expand Up @@ -667,7 +667,7 @@ protected function barcode_code93($code) {
} else {
$t = false; // space
}
$w = $chr[$char]{$j};
$w = $chr[$char][$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
Expand Down Expand Up @@ -742,7 +742,7 @@ protected function checksum_s25($code) {
}
$sum *= 3;
for ($i = 1; $i < $len; $i+=2) {
$sum += ($code{$i});
$sum += ($code[$i]);
}
$r = $sum % 10;
if($r > 0) {
Expand Down Expand Up @@ -867,8 +867,8 @@ protected function binseq_to_array($seq, $bararray) {
$k = 0;
for ($i = 0; $i < $len; ++$i) {
$w += 1;
if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
if ($seq{$i} == '1') {
if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // space
Expand Down Expand Up @@ -929,7 +929,7 @@ protected function barcode_i25($code, $checksum=false) {
$seq = '';
$chrlen = strlen($chr[$char_bar]);
for ($s = 0; $s < $chrlen; $s++){
$seq .= $chr[$char_bar]{$s} . $chr[$char_space]{$s};
$seq .= $chr[$char_bar][$s] . $chr[$char_space][$s];
}
$seqlen = strlen($seq);
for ($j = 0; $j < $seqlen; ++$j) {
Expand All @@ -938,7 +938,7 @@ protected function barcode_i25($code, $checksum=false) {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
Expand Down Expand Up @@ -1180,7 +1180,7 @@ protected function barcode_c128($code, $type='') {
}
}
for ($i = 0; $i < $seq[2]; ++$i) {
$char = $seq[1]{$i};
$char = $seq[1][$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_a[$char_id];
Expand Down Expand Up @@ -1223,7 +1223,7 @@ protected function barcode_c128($code, $type='') {
}
}
for ($i = 0; $i < $seq[2]; ++$i) {
$char = $seq[1]{$i};
$char = $seq[1][$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_b[$char_id];
Expand All @@ -1240,7 +1240,7 @@ protected function barcode_c128($code, $type='') {
$code_data[] = 99;
}
for ($i = 0; $i < $seq[2]; $i+=2) {
$chrnum = $seq[1]{$i}.$seq[1]{$i+1};
$chrnum = $seq[1][$i].$seq[1][$i+1];
$code_data[] = intval($chrnum);
}
break;
Expand Down Expand Up @@ -1271,7 +1271,7 @@ protected function barcode_c128($code, $type='') {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
}
Expand Down Expand Up @@ -1356,7 +1356,7 @@ protected function barcode_eanupc($code, $len=13) {
if ($code_len == $data_len) {
// add check digit
$code .= $r;
} elseif ($r !== intval($code{$data_len})) {
} elseif ($r !== intval($code[$data_len])) {
// wrong checkdigit
return false;
}
Expand Down Expand Up @@ -1467,7 +1467,7 @@ protected function barcode_eanupc($code, $len=13) {
$bararray = array('code' => $upce_code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
$p = $upce_parities[$code[1]][$r];
for ($i = 0; $i < 6; ++$i) {
$seq .= $codes[$p[$i]][$upce_code{$i}];
$seq .= $codes[$p[$i]][$upce_code[$i]];
}
$seq .= '010101'; // right guard bar
} else {
Expand All @@ -1493,8 +1493,8 @@ protected function barcode_eanupc($code, $len=13) {
$w = 0;
for ($i = 0; $i < $clen; ++$i) {
$w += 1;
if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
if ($seq{$i} == '1') {
if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // space
Expand Down Expand Up @@ -1578,7 +1578,7 @@ protected function barcode_eanext($code, $len=5) {
$seq .= $codes[$p[0]][$code[0]];
for ($i = 1; $i < $len; ++$i) {
$seq .= '01'; // separator
$seq .= $codes[$p[$i]][$code{$i}];
$seq .= $codes[$p[$i]][$code[$i]];
}
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
return $this->binseq_to_array($seq, $bararray);
Expand Down Expand Up @@ -1856,7 +1856,7 @@ protected function barcode_codabar($code) {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
Expand Down Expand Up @@ -1947,7 +1947,7 @@ protected function barcode_code11($code) {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
Expand Down Expand Up @@ -2016,7 +2016,7 @@ protected function barcode_pharmacode2t($code) {
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 2, 'bcode' => array());
$len = strlen($seq);
for ($i = 0; $i < $len; ++$i) {
switch ($seq{$i}) {
switch ($seq[$i]) {
case '1': {
$p = 1;
$h = 1;
Expand Down Expand Up @@ -2255,7 +2255,7 @@ public function hex_to_dec($hex) {
$bitval = 1;
$len = strlen($hex);
for($pos = ($len - 1); $pos >= 0; --$pos) {
$dec = bcadd($dec, bcmul(hexdec($hex{$pos}), $bitval));
$dec = bcadd($dec, bcmul(hexdec($hex[$pos]), $bitval));
$bitval = bcmul($bitval, 16);
}
return $dec;
Expand Down

0 comments on commit 6ce757d

Please sign in to comment.