@@ 503-520 (lines=18) @@ | ||
500 | $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array()); |
|
501 | $k = 0; |
|
502 | $clen = strlen($code); |
|
503 | for ($i = 0; $i < $clen; ++$i) { |
|
504 | $char = $code{$i}; |
|
505 | if ( ! isset($chr[$char])) { |
|
506 | // invalid character |
|
507 | return false; |
|
508 | } |
|
509 | for ($j = 0; $j < 6; ++$j) { |
|
510 | if (($j % 2) == 0) { |
|
511 | $t = true; // bar |
|
512 | } else { |
|
513 | $t = false; // space |
|
514 | } |
|
515 | $w = $chr[$char]{$j}; |
|
516 | $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); |
|
517 | $bararray['maxw'] += $w; |
|
518 | ++$k; |
|
519 | } |
|
520 | } |
|
521 | $bararray['bcode'][$k] = array('t' => true, 'w' => 1, 'h' => 1, 'p' => 0); |
|
522 | $bararray['maxw'] += 1; |
|
523 | ++$k; |
|
@@ 1515-1531 (lines=17) @@ | ||
1512 | $seq = ''; |
|
1513 | $code = 'A'.strtoupper($code).'A'; |
|
1514 | $len = strlen($code); |
|
1515 | for ($i = 0; $i < $len; ++$i) { |
|
1516 | if ( ! isset($chr[$code{$i}])) { |
|
1517 | return false; |
|
1518 | } |
|
1519 | $seq = $chr[$code{$i}]; |
|
1520 | for ($j = 0; $j < 8; ++$j) { |
|
1521 | if (($j % 2) == 0) { |
|
1522 | $t = true; // bar |
|
1523 | } else { |
|
1524 | $t = false; // space |
|
1525 | } |
|
1526 | $w = $seq{$j}; |
|
1527 | $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); |
|
1528 | $bararray['maxw'] += $w; |
|
1529 | ++$k; |
|
1530 | } |
|
1531 | } |
|
1532 | return $bararray; |
|
1533 | } |
|
1534 | ||
@@ 1607-1623 (lines=17) @@ | ||
1604 | } |
|
1605 | $code = 'S'.$code.'S'; |
|
1606 | $len += 3; |
|
1607 | for ($i = 0; $i < $len; ++$i) { |
|
1608 | if ( ! isset($chr[$code{$i}])) { |
|
1609 | return false; |
|
1610 | } |
|
1611 | $seq = $chr[$code{$i}]; |
|
1612 | for ($j = 0; $j < 6; ++$j) { |
|
1613 | if (($j % 2) == 0) { |
|
1614 | $t = true; // bar |
|
1615 | } else { |
|
1616 | $t = false; // space |
|
1617 | } |
|
1618 | $w = $seq{$j}; |
|
1619 | $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); |
|
1620 | $bararray['maxw'] += $w; |
|
1621 | ++$k; |
|
1622 | } |
|
1623 | } |
|
1624 | return $bararray; |
|
1625 | } |
|
1626 |