96 header(
'Content-Type: application/svg+xml');
97 header(
'Cache-Control: public, must-revalidate, max-age=0');
98 header(
'Pragma: public');
99 header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT');
100 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
101 header(
'Content-Disposition: inline; filename="'.md5($code).
'.svg";');
116 $repstr = array(
"\0" =>
'',
'&' =>
'&',
'<' =>
'<',
'>' =>
'>');
117 $svg =
'<'.
'?'.
'xml version="1.0" standalone="no"'.
'?'.
'>'.
"\n";
118 $svg .=
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'.
"\n";
119 $svg .=
'<svg width="'.round(($this->barcode_array[
'maxw'] * $w), 3).
'" height="'.$h.
'" version="1.1" xmlns="http://www.w3.org/2000/svg">'.
"\n";
120 $svg .=
"\t".
'<desc>'.strtr($this->barcode_array[
'code'], $repstr).
'</desc>'.
"\n";
121 $svg .=
"\t".
'<g id="bars" fill="'.$color.
'" stroke="none">'.
"\n";
124 foreach ($this->barcode_array[
'bcode'] as $k => $v) {
125 $bw = round(($v[
'w'] * $w), 3);
126 $bh = round(($v[
'h'] * $h / $this->barcode_array[
'maxh']), 3);
128 $y = round(($v[
'p'] * $h / $this->barcode_array[
'maxh']), 3);
130 $svg .=
"\t\t".
'<rect x="'.$x.
'" y="'.$y.
'" width="'.$bw.
'" height="'.$bh.
'" />'.
"\n";
134 $svg .=
"\t".
'</g>'.
"\n";
135 $svg .=
'</svg>'.
"\n";
148 $html =
'<div style="font-size:0;position:relative;width:'.($this->barcode_array[
'maxw'] * $w).
'px;height:'.($h).
'px;">'.
"\n";
151 foreach ($this->barcode_array[
'bcode'] as $k => $v) {
152 $bw = round(($v[
'w'] * $w), 3);
153 $bh = round(($v[
'h'] * $h / $this->barcode_array[
'maxh']), 3);
155 $y = round(($v[
'p'] * $h / $this->barcode_array[
'maxh']), 3);
157 $html .=
'<div style="background-color:'.$color.
';width:'.$bw.
'px;height:'.$bh.
'px;position:absolute;left:'.$x.
'px;top:'.$y.
'px;"> </div>'.
"\n";
161 $html .=
'</div>'.
"\n";
175 $width = ($this->barcode_array[
'maxw'] * $w);
177 if (function_exists(
'imagecreate')) {
180 $png = imagecreate($width, $height);
181 $bgcol = imagecolorallocate($png, 255, 255, 255);
182 imagecolortransparent($png, $bgcol);
183 $fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]);
184 }
elseif (extension_loaded(
'imagick')) {
186 $bgcol =
new imagickpixel(
'rgb(255,255,255');
187 $fgcol =
new imagickpixel(
'rgb('.$color[0].
','.$color[1].
','.$color[2].
')');
188 $png =
new Imagick();
189 $png->newImage($width, $height,
'none',
'png');
190 $bar =
new imagickdraw();
191 $bar->setfillcolor($fgcol);
197 foreach ($this->barcode_array[
'bcode'] as $k => $v) {
198 $bw = round(($v[
'w'] * $w), 3);
199 $bh = round(($v[
'h'] * $h / $this->barcode_array[
'maxh']), 3);
201 $y = round(($v[
'p'] * $h / $this->barcode_array[
'maxh']), 3);
204 $bar->rectangle($x, $y, ($x + $bw - 1), ($y + $bh - 1));
206 imagefilledrectangle($png, $x, $y, ($x + $bw - 1), ($y + $bh - 1), $fgcol);
212 header(
'Content-Type: image/png');
213 header(
'Cache-Control: public, must-revalidate, max-age=0');
214 header(
'Pragma: public');
215 header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT');
216 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
218 $png->drawimage($bar);
234 switch (strtoupper($type)) {
356 $this->barcode_array =
false;
361 $this->barcode_array = $arrcode;
374 $chr[
'0'] =
'111331311';
375 $chr[
'1'] =
'311311113';
376 $chr[
'2'] =
'113311113';
377 $chr[
'3'] =
'313311111';
378 $chr[
'4'] =
'111331113';
379 $chr[
'5'] =
'311331111';
380 $chr[
'6'] =
'113331111';
381 $chr[
'7'] =
'111311313';
382 $chr[
'8'] =
'311311311';
383 $chr[
'9'] =
'113311311';
384 $chr[
'A'] =
'311113113';
385 $chr[
'B'] =
'113113113';
386 $chr[
'C'] =
'313113111';
387 $chr[
'D'] =
'111133113';
388 $chr[
'E'] =
'311133111';
389 $chr[
'F'] =
'113133111';
390 $chr[
'G'] =
'111113313';
391 $chr[
'H'] =
'311113311';
392 $chr[
'I'] =
'113113311';
393 $chr[
'J'] =
'111133311';
394 $chr[
'K'] =
'311111133';
395 $chr[
'L'] =
'113111133';
396 $chr[
'M'] =
'313111131';
397 $chr[
'N'] =
'111131133';
398 $chr[
'O'] =
'311131131';
399 $chr[
'P'] =
'113131131';
400 $chr[
'Q'] =
'111111333';
401 $chr[
'R'] =
'311111331';
402 $chr[
'S'] =
'113111331';
403 $chr[
'T'] =
'111131331';
404 $chr[
'U'] =
'331111113';
405 $chr[
'V'] =
'133111113';
406 $chr[
'W'] =
'333111111';
407 $chr[
'X'] =
'131131113';
408 $chr[
'Y'] =
'331131111';
409 $chr[
'Z'] =
'133131111';
410 $chr[
'-'] =
'131111313';
411 $chr[
'.'] =
'331111311';
412 $chr[
' '] =
'133111311';
413 $chr[
'$'] =
'131313111';
414 $chr[
'/'] =
'131311131';
415 $chr[
'+'] =
'131113131';
416 $chr[
'%'] =
'111313131';
417 $chr[
'*'] =
'131131311';
418 $code = strtoupper($code);
423 if ($code ===
false) {
431 $code =
'*'.$code.
'*';
432 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
434 $clen = strlen($code);
435 for (
$i = 0;
$i < $clen; ++
$i) {
437 if(!isset($chr[$char])) {
441 for ($j = 0; $j < 9; ++$j) {
447 $w = $chr[$char]{$j};
448 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
449 $bararray[
'maxw'] += $w;
453 $bararray[
'bcode'][$k] = array(
't' =>
false,
'w' => 1,
'h' => 1,
'p' => 0);
454 $bararray[
'maxw'] += 1;
468 chr(0) =>
'%U', chr(1) =>
'$A', chr(2) =>
'$B', chr(3) =>
'$C',
469 chr(4) =>
'$D', chr(5) =>
'$E', chr(6) =>
'$F', chr(7) =>
'$G',
470 chr(8) =>
'$H', chr(9) =>
'$I', chr(10) =>
'$J', chr(11) =>
'£K',
471 chr(12) =>
'$L', chr(13) =>
'$M', chr(14) =>
'$N', chr(15) =>
'$O',
472 chr(16) =>
'$P', chr(17) =>
'$Q', chr(18) =>
'$R', chr(19) =>
'$S',
473 chr(20) =>
'$T', chr(21) =>
'$U', chr(22) =>
'$V', chr(23) =>
'$W',
474 chr(24) =>
'$X', chr(25) =>
'$Y', chr(26) =>
'$Z', chr(27) =>
'%A',
475 chr(28) =>
'%B', chr(29) =>
'%C', chr(30) =>
'%D', chr(31) =>
'%E',
476 chr(32) =>
' ', chr(33) =>
'/A', chr(34) =>
'/B', chr(35) =>
'/C',
477 chr(36) =>
'/D', chr(37) =>
'/E', chr(38) =>
'/F', chr(39) =>
'/G',
478 chr(40) =>
'/H', chr(41) =>
'/I', chr(42) =>
'/J', chr(43) =>
'/K',
479 chr(44) =>
'/L', chr(45) =>
'-', chr(46) =>
'.', chr(47) =>
'/O',
480 chr(48) =>
'0', chr(49) =>
'1', chr(50) =>
'2', chr(51) =>
'3',
481 chr(52) =>
'4', chr(53) =>
'5', chr(54) =>
'6', chr(55) =>
'7',
482 chr(56) =>
'8', chr(57) =>
'9', chr(58) =>
'/Z', chr(59) =>
'%F',
483 chr(60) =>
'%G', chr(61) =>
'%H', chr(62) =>
'%I', chr(63) =>
'%J',
484 chr(64) =>
'%V', chr(65) =>
'A', chr(66) =>
'B', chr(67) =>
'C',
485 chr(68) =>
'D', chr(69) =>
'E', chr(70) =>
'F', chr(71) =>
'G',
486 chr(72) =>
'H', chr(73) =>
'I', chr(74) =>
'J', chr(75) =>
'K',
487 chr(76) =>
'L', chr(77) =>
'M', chr(78) =>
'N', chr(79) =>
'O',
488 chr(80) =>
'P', chr(81) =>
'Q', chr(82) =>
'R', chr(83) =>
'S',
489 chr(84) =>
'T', chr(85) =>
'U', chr(86) =>
'V', chr(87) =>
'W',
490 chr(88) =>
'X', chr(89) =>
'Y', chr(90) =>
'Z', chr(91) =>
'%K',
491 chr(92) =>
'%L', chr(93) =>
'%M', chr(94) =>
'%N', chr(95) =>
'%O',
492 chr(96) =>
'%W', chr(97) =>
'+A', chr(98) =>
'+B', chr(99) =>
'+C',
493 chr(100) =>
'+D', chr(101) =>
'+E', chr(102) =>
'+F', chr(103) =>
'+G',
494 chr(104) =>
'+H', chr(105) =>
'+I', chr(106) =>
'+J', chr(107) =>
'+K',
495 chr(108) =>
'+L', chr(109) =>
'+M', chr(110) =>
'+N', chr(111) =>
'+O',
496 chr(112) =>
'+P', chr(113) =>
'+Q', chr(114) =>
'+R', chr(115) =>
'+S',
497 chr(116) =>
'+T', chr(117) =>
'+U', chr(118) =>
'+V', chr(119) =>
'+W',
498 chr(120) =>
'+X', chr(121) =>
'+Y', chr(122) =>
'+Z', chr(123) =>
'%P',
499 chr(124) =>
'%Q', chr(125) =>
'%R', chr(126) =>
'%S', chr(127) =>
'%T');
501 $clen = strlen($code);
502 for (
$i = 0 ;
$i < $clen; ++
$i) {
503 if (ord($code{
$i}) > 127) {
506 $code_ext .= $encode[$code{
$i}];
519 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
520 'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
521 'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
522 'W',
'X',
'Y',
'Z',
'-',
'.',
' ',
'$',
'/',
'+',
'%');
524 $clen = strlen($code);
525 for (
$i = 0 ;
$i < $clen; ++
$i) {
526 $k = array_keys($chars, $code{
$i});
584 $chr[128] =
'121221';
585 $chr[129] =
'311121';
586 $chr[130] =
'122211';
587 $chr[131] =
'312111';
589 $code = strtoupper($code);
591 chr(0) => chr(131).
'U', chr(1) => chr(128).
'A', chr(2) => chr(128).
'B', chr(3) => chr(128).
'C',
592 chr(4) => chr(128).
'D', chr(5) => chr(128).
'E', chr(6) => chr(128).
'F', chr(7) => chr(128).
'G',
593 chr(8) => chr(128).
'H', chr(9) => chr(128).
'I', chr(10) => chr(128).
'J', chr(11) =>
'£K',
594 chr(12) => chr(128).
'L', chr(13) => chr(128).
'M', chr(14) => chr(128).
'N', chr(15) => chr(128).
'O',
595 chr(16) => chr(128).
'P', chr(17) => chr(128).
'Q', chr(18) => chr(128).
'R', chr(19) => chr(128).
'S',
596 chr(20) => chr(128).
'T', chr(21) => chr(128).
'U', chr(22) => chr(128).
'V', chr(23) => chr(128).
'W',
597 chr(24) => chr(128).
'X', chr(25) => chr(128).
'Y', chr(26) => chr(128).
'Z', chr(27) => chr(131).
'A',
598 chr(28) => chr(131).
'B', chr(29) => chr(131).
'C', chr(30) => chr(131).
'D', chr(31) => chr(131).
'E',
599 chr(32) =>
' ', chr(33) => chr(129).
'A', chr(34) => chr(129).
'B', chr(35) => chr(129).
'C',
600 chr(36) => chr(129).
'D', chr(37) => chr(129).
'E', chr(38) => chr(129).
'F', chr(39) => chr(129).
'G',
601 chr(40) => chr(129).
'H', chr(41) => chr(129).
'I', chr(42) => chr(129).
'J', chr(43) => chr(129).
'K',
602 chr(44) => chr(129).
'L', chr(45) =>
'-', chr(46) =>
'.', chr(47) => chr(129).
'O',
603 chr(48) =>
'0', chr(49) =>
'1', chr(50) =>
'2', chr(51) =>
'3',
604 chr(52) =>
'4', chr(53) =>
'5', chr(54) =>
'6', chr(55) =>
'7',
605 chr(56) =>
'8', chr(57) =>
'9', chr(58) => chr(129).
'Z', chr(59) => chr(131).
'F',
606 chr(60) => chr(131).
'G', chr(61) => chr(131).
'H', chr(62) => chr(131).
'I', chr(63) => chr(131).
'J',
607 chr(64) => chr(131).
'V', chr(65) =>
'A', chr(66) =>
'B', chr(67) =>
'C',
608 chr(68) =>
'D', chr(69) =>
'E', chr(70) =>
'F', chr(71) =>
'G',
609 chr(72) =>
'H', chr(73) =>
'I', chr(74) =>
'J', chr(75) =>
'K',
610 chr(76) =>
'L', chr(77) =>
'M', chr(78) =>
'N', chr(79) =>
'O',
611 chr(80) =>
'P', chr(81) =>
'Q', chr(82) =>
'R', chr(83) =>
'S',
612 chr(84) =>
'T', chr(85) =>
'U', chr(86) =>
'V', chr(87) =>
'W',
613 chr(88) =>
'X', chr(89) =>
'Y', chr(90) =>
'Z', chr(91) => chr(131).
'K',
614 chr(92) => chr(131).
'L', chr(93) => chr(131).
'M', chr(94) => chr(131).
'N', chr(95) => chr(131).
'O',
615 chr(96) => chr(131).
'W', chr(97) => chr(130).
'A', chr(98) => chr(130).
'B', chr(99) => chr(130).
'C',
616 chr(100) => chr(130).
'D', chr(101) => chr(130).
'E', chr(102) => chr(130).
'F', chr(103) => chr(130).
'G',
617 chr(104) => chr(130).
'H', chr(105) => chr(130).
'I', chr(106) => chr(130).
'J', chr(107) => chr(130).
'K',
618 chr(108) => chr(130).
'L', chr(109) => chr(130).
'M', chr(110) => chr(130).
'N', chr(111) => chr(130).
'O',
619 chr(112) => chr(130).
'P', chr(113) => chr(130).
'Q', chr(114) => chr(130).
'R', chr(115) => chr(130).
'S',
620 chr(116) => chr(130).
'T', chr(117) => chr(130).
'U', chr(118) => chr(130).
'V', chr(119) => chr(130).
'W',
621 chr(120) => chr(130).
'X', chr(121) => chr(130).
'Y', chr(122) => chr(130).
'Z', chr(123) => chr(131).
'P',
622 chr(124) => chr(131).
'Q', chr(125) => chr(131).
'R', chr(126) => chr(131).
'S', chr(127) => chr(131).
'T');
624 $clen = strlen($code);
625 for (
$i = 0 ;
$i < $clen; ++
$i) {
626 if (ord($code{
$i}) > 127) {
629 $code_ext .= $encode[$code{
$i}];
634 $code =
'*'.$code_ext.
'*';
635 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
637 $clen = strlen($code);
638 for (
$i = 0;
$i < $clen; ++
$i) {
639 $char = ord($code{
$i});
640 if(!isset($chr[$char])) {
644 for ($j = 0; $j < 6; ++$j) {
650 $w = $chr[$char]{$j};
651 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
652 $bararray[
'maxw'] += $w;
656 $bararray[
'bcode'][$k] = array(
't' =>
true,
'w' => 1,
'h' => 1,
'p' => 0);
657 $bararray[
'maxw'] += 1;
670 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
671 'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
672 'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
673 'W',
'X',
'Y',
'Z',
'-',
'.',
' ',
'$',
'/',
'+',
'%',
676 $code = strtr($code, chr(128).chr(131).chr(129).chr(130),
'<=>?');
677 $len = strlen($code);
681 for (
$i = ($len - 1);
$i >= 0; --
$i) {
682 $k = array_keys($chars, $code{
$i});
683 $check += ($k[0] * $p);
695 for (
$i = $len;
$i >= 0; --
$i) {
696 $k = array_keys($chars, $code{
$i});
697 $check += ($k[0] * $p);
707 $checksum = strtr($checksum,
'<=>?', chr(128).chr(131).chr(129).chr(130));
718 $len = strlen($code);
720 for (
$i = 0;
$i < $len;
$i+=2) {
724 for (
$i = 1;
$i < $len;
$i+=2) {
744 $chr[
'0'] =
'100100100100';
745 $chr[
'1'] =
'100100100110';
746 $chr[
'2'] =
'100100110100';
747 $chr[
'3'] =
'100100110110';
748 $chr[
'4'] =
'100110100100';
749 $chr[
'5'] =
'100110100110';
750 $chr[
'6'] =
'100110110100';
751 $chr[
'7'] =
'100110110110';
752 $chr[
'8'] =
'110100100100';
753 $chr[
'9'] =
'110100100110';
754 $chr[
'A'] =
'110100110100';
755 $chr[
'B'] =
'110100110110';
756 $chr[
'C'] =
'110110100100';
757 $chr[
'D'] =
'110110100110';
758 $chr[
'E'] =
'110110110100';
759 $chr[
'F'] =
'110110110110';
762 $clen = strlen($code);
765 for (
$i = ($clen - 1);
$i >= 0; --
$i) {
766 $check += (hexdec($code{
$i}) * $p);
774 $check = 11 - $check;
779 $clen = strlen($code);
780 for (
$i = 0;
$i < $clen; ++
$i) {
782 if (!isset($chr[$digit])) {
786 $seq .= $chr[$digit];
789 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
803 $chr[
'0'] =
'10101110111010';
804 $chr[
'1'] =
'11101010101110';
805 $chr[
'2'] =
'10111010101110';
806 $chr[
'3'] =
'11101110101010';
807 $chr[
'4'] =
'10101110101110';
808 $chr[
'5'] =
'11101011101010';
809 $chr[
'6'] =
'10111011101010';
810 $chr[
'7'] =
'10101011101110';
811 $chr[
'8'] =
'10101110111010';
812 $chr[
'9'] =
'10111010111010';
817 if((strlen($code) % 2) != 0) {
822 $clen = strlen($code);
823 for (
$i = 0;
$i < $clen; ++
$i) {
825 if (!isset($chr[$digit])) {
829 $seq .= $chr[$digit];
832 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
848 for (
$i = 0;
$i < $len; ++
$i) {
850 if ((
$i == ($len - 1)) OR ((
$i < ($len - 1)) AND ($seq{
$i} != $seq{(
$i+1)}))) {
851 if ($seq{
$i} ==
'1') {
856 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
857 $bararray[
'maxw'] += $w;
891 if((strlen($code) % 2) != 0) {
896 $code =
'AA'.strtolower($code).
'ZA';
898 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
900 $clen = strlen($code);
901 for (
$i = 0;
$i < $clen;
$i = (
$i + 2)) {
902 $char_bar = $code{
$i};
903 $char_space = $code{
$i+1};
904 if((!isset($chr[$char_bar])) OR (!isset($chr[$char_space]))) {
910 $chrlen = strlen($chr[$char_bar]);
911 for ($s = 0; $s < $chrlen; $s++){
912 $seq .= $chr[$char_bar]{$s} . $chr[$char_space]{$s};
914 $seqlen = strlen($seq);
915 for ($j = 0; $j < $seqlen; ++$j) {
922 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
923 $bararray[
'maxw'] += $w;
1050 $keys_a =
' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';
1051 $keys_a .= chr(0).chr(1).chr(2).chr(3).chr(4).chr(5).chr(6).chr(7).chr(8).chr(9);
1052 $keys_a .= chr(10).chr(11).chr(12).chr(13).chr(14).chr(15).chr(16).chr(17).chr(18).chr(19);
1053 $keys_a .= chr(20).chr(21).chr(22).chr(23).chr(24).chr(25).chr(26).chr(27).chr(28).chr(29);
1054 $keys_a .= chr(30).chr(31);
1056 $keys_b =
' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'.chr(127);
1058 $fnc_a = array(241 => 102, 242 => 97, 243 => 96, 244 => 101);
1059 $fnc_b = array(241 => 102, 242 => 97, 243 => 96, 244 => 100);
1061 $code_data = array();
1063 $len = strlen($code);
1064 switch(strtoupper($type)) {
1067 for (
$i = 0;
$i < $len; ++
$i) {
1069 $char_id = ord($char);
1070 if (($char_id >= 241) AND ($char_id <= 244)) {
1071 $code_data[] = $fnc_a[$char_id];
1072 }
elseif (($char_id >= 0) AND ($char_id <= 95)) {
1073 $code_data[] = strpos($keys_a, $char);
1082 for (
$i = 0;
$i < $len; ++
$i) {
1084 $char_id = ord($char);
1085 if (($char_id >= 241) AND ($char_id <= 244)) {
1086 $code_data[] = $fnc_b[$char_id];
1087 }
elseif (($char_id >= 32) AND ($char_id <= 127)) {
1088 $code_data[] = strpos($keys_b, $char);
1097 if (ord($code{0}) == 241) {
1099 $code = substr($code, 1);
1102 if (($len % 2) != 0) {
1106 for (
$i = 0;
$i < $len;
$i+=2) {
1107 $chrnum = $code{
$i}.$code{
$i+1};
1108 if (preg_match(
'/([0-9]{2})/', $chrnum) > 0) {
1109 $code_data[] = intval($chrnum);
1118 $sequence = array();
1121 preg_match_all(
'/([0-9]{4,})/', $code, $numseq, PREG_OFFSET_CAPTURE);
1122 if (isset($numseq[1]) AND !empty($numseq[1])) {
1124 foreach ($numseq[1] as $val) {
1126 if ($offset > $end_offset) {
1128 $sequence = array_merge($sequence, $this->
get128ABsequence(substr($code, $end_offset, ($offset - $end_offset))));
1131 $slen = strlen($val[0]);
1132 if (($slen % 2) != 0) {
1136 $sequence[] = array(
'C', substr($code, $offset, $slen), $slen);
1137 $end_offset = $offset + $slen;
1139 if ($end_offset < $len) {
1140 $sequence = array_merge($sequence, $this->
get128ABsequence(substr($code, $end_offset)));
1147 foreach ($sequence as $key => $seq) {
1152 }
elseif ($sequence[($key - 1)][0] !=
'A') {
1153 if (($seq[2] == 1) AND ($key > 0) AND ($sequence[($key - 1)][0] ==
'B') AND (!isset($sequence[($key - 1)][3]))) {
1157 $sequence[$key][3] =
true;
1158 }
elseif (!isset($sequence[($key - 1)][3])) {
1162 for (
$i = 0;
$i < $seq[2]; ++
$i) {
1163 $char = $seq[1]{
$i};
1164 $char_id = ord($char);
1165 if (($char_id >= 241) AND ($char_id <= 244)) {
1166 $code_data[] = $fnc_a[$char_id];
1168 $code_data[] = strpos($keys_a, $char);
1175 $tmpchr = ord($seq[1]{0});
1176 if (($seq[2] == 1) AND ($tmpchr >= 241) AND ($tmpchr <= 244) AND isset($sequence[($key + 1)]) AND ($sequence[($key + 1)][0] !=
'B')) {
1177 switch ($sequence[($key + 1)][0]) {
1180 $sequence[$key][0] =
'A';
1181 $code_data[] = $fnc_a[$tmpchr];
1186 $sequence[$key][0] =
'C';
1187 $code_data[] = $fnc_a[$tmpchr];
1195 }
elseif ($sequence[($key - 1)][0] !=
'B') {
1196 if (($seq[2] == 1) AND ($key > 0) AND ($sequence[($key - 1)][0] ==
'A') AND (!isset($sequence[($key - 1)][3]))) {
1200 $sequence[$key][3] =
true;
1201 }
elseif (!isset($sequence[($key - 1)][3])) {
1205 for (
$i = 0;
$i < $seq[2]; ++
$i) {
1206 $char = $seq[1]{
$i};
1207 $char_id = ord($char);
1208 if (($char_id >= 241) AND ($char_id <= 244)) {
1209 $code_data[] = $fnc_b[$char_id];
1211 $code_data[] = strpos($keys_b, $char);
1219 }
elseif ($sequence[($key - 1)][0] !=
'C') {
1222 for (
$i = 0;
$i < $seq[2];
$i+=2) {
1223 $chrnum = $seq[1]{
$i}.$seq[1]{
$i+1};
1224 $code_data[] = intval($chrnum);
1234 foreach ($code_data as $key => $val) {
1235 $sum += ($val * ($key + 1));
1238 $code_data[] = ($sum % 103);
1243 array_unshift($code_data, $startid);
1245 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1246 foreach ($code_data as $val) {
1248 for ($j = 0; $j < 6; ++$j) {
1249 if (($j % 2) == 0) {
1255 $bararray[
'bcode'][] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
1256 $bararray[
'maxw'] += $w;
1269 $len = strlen($code);
1270 $sequence = array();
1273 preg_match_all(
'/([\0-\31])/', $code, $numseq, PREG_OFFSET_CAPTURE);
1274 if (isset($numseq[1]) AND !empty($numseq[1])) {
1276 foreach ($numseq[1] as $val) {
1278 if ($offset > $end_offset) {
1280 $sequence[] = array(
'B', substr($code, $end_offset, ($offset - $end_offset)), ($offset - $end_offset));
1283 $slen = strlen($val[0]);
1284 $sequence[] = array(
'A', substr($code, $offset, $slen), $slen);
1285 $end_offset = $offset + $slen;
1287 if ($end_offset < $len) {
1288 $sequence[] = array(
'B', substr($code, $end_offset), ($len - $end_offset));
1292 $sequence[] = array(
'B', $code, $len);
1313 $data_len = $len - 1;
1315 $code = str_pad($code, $data_len,
'0', STR_PAD_LEFT);
1316 $code_len = strlen($code);
1319 for (
$i = 1;
$i < $data_len;
$i+=2) {
1320 $sum_a += $code{
$i};
1326 for (
$i = 0;
$i < $data_len;
$i+=2) {
1327 $sum_b += ($code{
$i});
1332 $r = ($sum_a + $sum_b) % 10;
1336 if ($code_len == $data_len) {
1339 }
elseif ($r !== intval($code{$data_len})) {
1350 $tmp = substr($code, 4, 3);
1351 if (($tmp ==
'000') OR ($tmp ==
'100') OR ($tmp ==
'200')) {
1353 $upce_code = substr($code, 2, 2).substr($code, 9, 3).substr($code, 4, 1);
1355 $tmp = substr($code, 5, 2);
1358 $upce_code = substr($code, 2, 3).substr($code, 10, 2).
'3';
1360 $tmp = substr($code, 6, 1);
1363 $upce_code = substr($code, 2, 4).substr($code, 11, 1).
'4';
1366 $upce_code = substr($code, 2, 5).substr($code, 11, 1);
1408 '0'=>array(
'A',
'A',
'A',
'A',
'A',
'A'),
1409 '1'=>array(
'A',
'A',
'B',
'A',
'B',
'B'),
1410 '2'=>array(
'A',
'A',
'B',
'B',
'A',
'B'),
1411 '3'=>array(
'A',
'A',
'B',
'B',
'B',
'A'),
1412 '4'=>array(
'A',
'B',
'A',
'A',
'B',
'B'),
1413 '5'=>array(
'A',
'B',
'B',
'A',
'A',
'B'),
1414 '6'=>array(
'A',
'B',
'B',
'B',
'A',
'A'),
1415 '7'=>array(
'A',
'B',
'A',
'B',
'A',
'B'),
1416 '8'=>array(
'A',
'B',
'A',
'B',
'B',
'A'),
1417 '9'=>array(
'A',
'B',
'B',
'A',
'B',
'A')
1419 $upce_parities = array();
1420 $upce_parities[0] = array(
1421 '0'=>array(
'B',
'B',
'B',
'A',
'A',
'A'),
1422 '1'=>array(
'B',
'B',
'A',
'B',
'A',
'A'),
1423 '2'=>array(
'B',
'B',
'A',
'A',
'B',
'A'),
1424 '3'=>array(
'B',
'B',
'A',
'A',
'A',
'B'),
1425 '4'=>array(
'B',
'A',
'B',
'B',
'A',
'A'),
1426 '5'=>array(
'B',
'A',
'A',
'B',
'B',
'A'),
1427 '6'=>array(
'B',
'A',
'A',
'A',
'B',
'B'),
1428 '7'=>array(
'B',
'A',
'B',
'A',
'B',
'A'),
1429 '8'=>array(
'B',
'A',
'B',
'A',
'A',
'B'),
1430 '9'=>array(
'B',
'A',
'A',
'B',
'A',
'B')
1432 $upce_parities[1] = array(
1433 '0'=>array(
'A',
'A',
'A',
'B',
'B',
'B'),
1434 '1'=>array(
'A',
'A',
'B',
'A',
'B',
'B'),
1435 '2'=>array(
'A',
'A',
'B',
'B',
'A',
'B'),
1436 '3'=>array(
'A',
'A',
'B',
'B',
'B',
'A'),
1437 '4'=>array(
'A',
'B',
'A',
'A',
'B',
'B'),
1438 '5'=>array(
'A',
'B',
'B',
'A',
'A',
'B'),
1439 '6'=>array(
'A',
'B',
'B',
'B',
'A',
'A'),
1440 '7'=>array(
'A',
'B',
'A',
'B',
'A',
'B'),
1441 '8'=>array(
'A',
'B',
'A',
'B',
'B',
'A'),
1442 '9'=>array(
'A',
'B',
'B',
'A',
'B',
'A')
1447 $bararray = array(
'code' => $upce_code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1448 $p = $upce_parities[$code{1}][$r];
1449 for (
$i = 0;
$i < 6; ++
$i) {
1450 $seq .= $codes[$p[
$i]][$upce_code{
$i}];
1454 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1455 $half_len = intval(ceil($len / 2));
1457 for (
$i = 0;
$i < $half_len; ++
$i) {
1458 $seq .= $codes[
'A'][$code{
$i}];
1461 $p = $parities[$code{0}];
1462 for (
$i = 1;
$i < $half_len; ++
$i) {
1463 $seq .= $codes[$p[
$i-1]][$code{
$i}];
1467 for (
$i = $half_len;
$i < $len; ++
$i) {
1468 $seq .= $codes[
'C'][$code{
$i}];
1472 $clen = strlen($seq);
1474 for (
$i = 0;
$i < $clen; ++
$i) {
1476 if ((
$i == ($clen - 1)) OR ((
$i < ($clen - 1)) AND ($seq{
$i} != $seq{(
$i+1)}))) {
1477 if ($seq{
$i} ==
'1') {
1482 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
1483 $bararray[
'maxw'] += $w;
1502 $code = str_pad($code, $len,
'0', STR_PAD_LEFT);
1507 $r = (3 * ($code{0} + $code{2} + $code{4})) + (9 * ($code{1} + $code{3}));
1537 $parities = array();
1538 $parities[2] = array(
1539 '0'=>array(
'A',
'A'),
1540 '1'=>array(
'A',
'B'),
1541 '2'=>array(
'B',
'A'),
1544 $parities[5] = array(
1545 '0'=>array(
'B',
'B',
'A',
'A',
'A'),
1546 '1'=>array(
'B',
'A',
'B',
'A',
'A'),
1547 '2'=>array(
'B',
'A',
'A',
'B',
'A'),
1548 '3'=>array(
'B',
'A',
'A',
'A',
'B'),
1549 '4'=>array(
'A',
'B',
'B',
'A',
'A'),
1550 '5'=>array(
'A',
'A',
'B',
'B',
'A'),
1551 '6'=>array(
'A',
'A',
'A',
'B',
'B'),
1552 '7'=>array(
'A',
'B',
'A',
'B',
'A'),
1553 '8'=>array(
'A',
'B',
'A',
'A',
'B'),
1554 '9'=>array(
'A',
'A',
'B',
'A',
'B')
1556 $p = $parities[$len][$r];
1558 $seq .= $codes[$p[0]][$code{0}];
1559 for (
$i = 1;
$i < $len; ++
$i) {
1561 $seq .= $codes[$p[
$i]][$code{
$i}];
1563 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1579 0 => Array(1,1,2,2,2),
1580 1 => Array(2,2,2,1,1),
1581 2 => Array(2,2,1,2,1),
1582 3 => Array(2,2,1,1,2),
1583 4 => Array(2,1,2,2,1),
1584 5 => Array(2,1,2,1,2),
1585 6 => Array(2,1,1,2,2),
1586 7 => Array(1,2,2,2,1),
1587 8 => Array(1,2,2,1,2),
1588 9 => Array(1,2,1,2,2)
1592 0 => Array(2,2,1,1,1),
1593 1 => Array(1,1,1,2,2),
1594 2 => Array(1,1,2,1,2),
1595 3 => Array(1,1,2,2,1),
1596 4 => Array(1,2,1,1,2),
1597 5 => Array(1,2,1,2,1),
1598 6 => Array(1,2,2,1,1),
1599 7 => Array(2,1,1,1,2),
1600 8 => Array(2,1,1,2,1),
1601 9 => Array(2,1,2,1,1)
1604 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 2,
'bcode' => array());
1606 $code = str_replace(
'-',
'', $code);
1607 $code = str_replace(
' ',
'', $code);
1608 $len = strlen($code);
1611 for (
$i = 0;
$i < $len; ++
$i) {
1612 $sum += intval($code{
$i});
1614 $chkd = ($sum % 10);
1616 $chkd = (10 - $chkd);
1619 $len = strlen($code);
1621 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => 2,
'p' => 0);
1622 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
1623 $bararray[
'maxw'] += 2;
1624 for (
$i = 0;
$i < $len; ++
$i) {
1625 for ($j = 0; $j < 5; ++$j) {
1626 $h = $barlen[$code{
$i}][$j];
1628 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => $h,
'p' => $p);
1629 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
1630 $bararray[
'maxw'] += 2;
1634 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => 2,
'p' => 0);
1635 $bararray[
'maxw'] += 1;
1656 '0' => array(3,3,2,2),
1657 '1' => array(3,4,1,2),
1658 '2' => array(3,4,2,1),
1659 '3' => array(4,3,1,2),
1660 '4' => array(4,3,2,1),
1661 '5' => array(4,4,1,1),
1662 '6' => array(3,1,4,2),
1663 '7' => array(3,2,3,2),
1664 '8' => array(3,2,4,1),
1665 '9' => array(4,1,3,2),
1666 'A' => array(4,1,4,1),
1667 'B' => array(4,2,3,1),
1668 'C' => array(3,1,2,4),
1669 'D' => array(3,2,1,4),
1670 'E' => array(3,2,2,3),
1671 'F' => array(4,1,1,4),
1672 'G' => array(4,1,2,3),
1673 'H' => array(4,2,1,3),
1674 'I' => array(1,3,4,2),
1675 'J' => array(1,4,3,2),
1676 'K' => array(1,4,4,1),
1677 'L' => array(2,3,3,2),
1678 'M' => array(2,3,4,1),
1679 'N' => array(2,4,3,1),
1680 'O' => array(1,3,2,4),
1681 'P' => array(1,4,1,4),
1682 'Q' => array(1,4,2,3),
1683 'R' => array(2,3,1,4),
1684 'S' => array(2,3,2,3),
1685 'T' => array(2,4,1,3),
1686 'U' => array(1,1,4,4),
1687 'V' => array(1,2,3,4),
1688 'W' => array(1,2,4,3),
1689 'X' => array(2,1,3,4),
1690 'Y' => array(2,1,4,3),
1691 'Z' => array(2,2,3,3)
1693 $code = strtoupper($code);
1694 $len = strlen($code);
1695 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 3,
'bcode' => array());
1698 $checktable = array(
1738 for (
$i = 0;
$i < $len; ++
$i) {
1739 $row += $checktable[$code{
$i}][0];
1740 $col += $checktable[$code{
$i}][1];
1744 $chk = array_keys($checktable, array($row,$col));
1751 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => 2,
'p' => 0);
1752 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
1753 $bararray[
'maxw'] += 2;
1755 for (
$i = 0;
$i < $len; ++
$i) {
1756 for ($j = 0; $j < 4; ++$j) {
1757 switch ($barmode[$code{
$i}][$j]) {
1779 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => $h,
'p' => $p);
1780 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
1781 $bararray[
'maxw'] += 2;
1786 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => 3,
'p' => 0);
1787 $bararray[
'maxw'] += 1;
1822 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1826 $code =
'A'.strtoupper($code).
'A';
1827 $len = strlen($code);
1828 for (
$i = 0;
$i < $len; ++
$i) {
1829 if (!isset($chr[$code{
$i}])) {
1832 $seq = $chr[$code{
$i}];
1833 for ($j = 0; $j < 8; ++$j) {
1834 if (($j % 2) == 0) {
1840 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
1841 $bararray[
'maxw'] += $w;
1870 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1874 $len = strlen($code);
1878 for (
$i = ($len - 1);
$i >= 0; --
$i) {
1880 if ($digit ==
'-') {
1883 $dval = intval($digit);
1885 $check += ($dval * $p);
1900 for (
$i = $len;
$i >= 0; --
$i) {
1902 if ($digit ==
'-') {
1905 $dval = intval($digit);
1907 $check += ($dval * $p);
1917 $code =
'S'.$code.
'S';
1919 for (
$i = 0;
$i < $len; ++
$i) {
1920 if (!isset($chr[$code{
$i}])) {
1923 $seq = $chr[$code{
$i}];
1924 for ($j = 0; $j < 6; ++$j) {
1925 if (($j % 2) == 0) {
1931 $bararray[
'bcode'][$k] = array(
't' => $t,
'w' => $w,
'h' => 1,
'p' => 0);
1932 $bararray[
'maxw'] += $w;
1948 $code = intval($code);
1950 if (($code % 2) == 0) {
1959 $seq = substr($seq, 0, -2);
1960 $seq = strrev($seq);
1961 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 1,
'bcode' => array());
1974 $code = intval($code);
1976 switch ($code % 3) {
1979 $code = ($code - 3) / 3;
1984 $code = ($code - 1) / 3;
1989 $code = ($code - 2) / 3;
1993 }
while($code != 0);
1994 $seq = strrev($seq);
1996 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 2,
'bcode' => array());
1997 $len = strlen($seq);
1998 for (
$i = 0;
$i < $len; ++
$i) {
2016 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => $h,
'p' => $p);
2017 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
2018 $bararray[
'maxw'] += 2;
2020 unset($bararray[
'bcode'][($k - 1)]);
2021 --$bararray[
'maxw'];
2036 $asc_chr = array(4,0,2,6,3,5,1,9,8,7,1,2,0,6,4,8,2,9,5,3,0,1,3,7,4,6,8,9,2,0,5,1,9,4,3,8,6,7,1,2,4,3,9,5,7,8,3,0,2,1,4,0,9,1,7,0,2,4,6,3,7,1,9,5,8);
2037 $dsc_chr = array(7,1,9,5,8,0,2,4,6,3,5,8,9,7,3,0,6,1,7,4,6,8,9,2,5,1,7,5,4,3,8,7,6,0,2,5,4,9,3,0,1,6,8,2,0,4,5,9,6,7,5,2,6,3,8,5,1,9,8,7,4,0,2,6,3);
2038 $asc_pos = array(3,0,8,11,1,12,8,11,10,6,4,12,2,7,9,6,7,9,2,8,4,0,12,7,10,9,0,7,10,5,7,9,6,8,2,12,1,4,2,0,1,5,4,6,12,1,0,9,4,7,5,10,2,6,9,11,2,12,6,7,5,11,0,3,2);
2039 $dsc_pos = array(2,10,12,5,9,1,5,4,3,9,11,5,10,1,6,3,4,1,10,0,2,11,8,6,1,12,3,8,6,4,4,11,0,6,1,9,11,5,3,7,3,10,7,11,8,2,10,3,5,8,0,3,12,11,8,4,5,1,3,0,7,12,9,8,10);
2040 $code_arr = explode(
'-', $code);
2041 $tracking_number = $code_arr[0];
2042 if (isset($code_arr[1])) {
2043 $routing_code = $code_arr[1];
2048 switch (strlen($routing_code)) {
2054 $binary_code = bcadd($routing_code,
'1');
2058 $binary_code = bcadd($routing_code,
'100001');
2062 $binary_code = bcadd($routing_code,
'1000100001');
2070 $binary_code = bcmul($binary_code, 10);
2071 $binary_code = bcadd($binary_code, $tracking_number{0});
2072 $binary_code = bcmul($binary_code, 5);
2073 $binary_code = bcadd($binary_code, $tracking_number{1});
2074 $binary_code .= substr($tracking_number, 2, 18);
2076 $binary_code = $this->
dec_to_hex($binary_code);
2078 $binary_code = str_pad($binary_code, 26,
'0', STR_PAD_LEFT);
2080 $binary_code_arr = chunk_split($binary_code, 2,
"\r");
2081 $binary_code_arr = substr($binary_code_arr, 0, -1);
2082 $binary_code_arr = explode(
"\r", $binary_code_arr);
2086 $first_byte = sprintf(
'%2s', dechex((hexdec($binary_code_arr[0]) << 2) >> 2));
2087 $binary_code_102bit = $first_byte.substr($binary_code, 2);
2089 $codewords = array();
2091 $codewords[0] = bcmod(
$data, 636) * 2;
2093 for (
$i = 1;
$i < 9; ++
$i) {
2094 $codewords[
$i] = bcmod(
$data, 1365);
2097 $codewords[9] =
$data;
2098 if (($fcs >> 10) == 1) {
2099 $codewords[9] += 659;
2105 $characters = array();
2107 foreach($codewords as $k => $val) {
2109 $chrcode = $table5of13[$val];
2111 $chrcode = $table2of13[($val - 1287)];
2113 if (($fcs & $bitmask) > 0) {
2115 $chrcode = ((~$chrcode) & 8191);
2117 $characters[] = $chrcode;
2120 $characters = array_reverse($characters);
2123 $bararray = array(
'code' => $code,
'maxw' => 0,
'maxh' => 3,
'bcode' => array());
2124 for (
$i = 0;
$i < 65; ++
$i) {
2125 $asc = (($characters[$asc_chr[
$i]] & pow(2, $asc_pos[
$i])) > 0);
2126 $dsc = (($characters[$dsc_chr[
$i]] & pow(2, $dsc_pos[$i])) > 0);
2127 if ($asc AND $dsc) {
2144 $bararray[
'bcode'][$k++] = array(
't' => 1,
'w' => 1,
'h' => $h,
'p' => $p);
2145 $bararray[
'bcode'][$k++] = array(
't' => 0,
'w' => 1,
'h' => 2,
'p' => 0);
2146 $bararray[
'maxw'] += 2;
2148 unset($bararray[
'bcode'][($k - 1)]);
2149 --$bararray[
'maxw'];
2165 while($number > 0) {
2167 array_push($hex,
'0');
2169 array_push($hex, strtoupper(dechex(bcmod($number,
'16'))));
2170 $number = bcdiv($number,
'16', 0);
2173 $hex = array_reverse($hex);
2174 return implode($hex);
2186 $len = strlen($hex);
2187 for($pos = ($len - 1); $pos >= 0; --$pos) {
2188 $dec = bcadd($dec, bcmul(hexdec($hex{$pos}), $bitval));
2189 $bitval = bcmul($bitval, 16);
2204 $data = hexdec($code_arr[0]) << 5;
2205 for ($bit = 2; $bit < 8; ++$bit) {
2206 if (($fcs ^
$data) & 0x400) {
2207 $fcs = ($fcs << 1) ^ $genpoly;
2215 for ($byte = 1; $byte < 13; ++$byte) {
2216 $data = hexdec($code_arr[$byte]) << 3;
2217 for ($bit = 0; $bit < 8; ++$bit) {
2218 if (($fcs ^
$data) & 0x400) {
2219 $fcs = ($fcs << 1) ^ $genpoly;
2238 for (
$i = 0;
$i < 16; ++
$i) {
2257 for ($count = 0; $count < 8192; ++$count) {
2259 for ($bit_index = 0; $bit_index < 13; ++$bit_index) {
2260 $bit_count += intval(($count & (1 << $bit_index)) != 0);
2263 if ($bit_count == $n) {
2266 if ($reverse >= $count) {
2269 if ($reverse == $count) {
2270 $table[$lui] = $count;
2273 $table[$lli] = $count;
2275 $table[$lli] = $reverse;
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
checksum_code93($code)
Calculate CODE 93 checksum (modulo 47).
barcode_s25($code, $checksum=false)
Standard 2 of 5 barcodes.
getBarcodeSVG($w=2, $h=30, $color='black')
Send barcode as SVG image object to the standard output.
get128ABsequence($code)
Split text code in A/B sequence for 128 code.
binseq_to_array($seq, $bararray)
Convert binary barcode sequence to TCPDF barcode array.
hex_to_dec($hex)
Convert large hexadecimal number to decimal representation (string).
getBarcodeHTML($w=2, $h=30, $color='black')
Return an HTML representation of barcode.
barcode_i25($code, $checksum=false)
Interleaved 2 of 5 barcodes.
getBarcodePNG($w=2, $h=30, $color=array(0, 0, 0))
Return a PNG image representation of barcode (requires GD or Imagick library).
barcode_code39($code, $extended=false, $checksum=false)
CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
barcode_msi($code, $checksum=false)
MSI.
barcode_pharmacode2t($code)
Pharmacode two-track Contains digits (0 to 9)
$barcode_array
Array representation of barcode.
setBarcode($code, $type)
Set the barcode.
dec_to_hex($number)
Convert large integer number to hexadecimal representation.
checksum_s25($code)
Checksum for standard 2 of 5 barcodes.
barcode_rms4cc($code, $kix=false)
RMS4CC - CBC - KIX RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant i...
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www...
imb_reverse_us($num)
Reverse unsigned short value.
checksum_code39($code)
Calculate CODE 39 checksum (modulo 43).
imb_crc11fcs($code_arr)
Intelligent Mail Barcode calculation of Frame Check Sequence.
getBarcodeArray()
Return an array representations of barcode.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
barcode_code93($code)
CODE 93 - USS-93 Compact code similar to Code 39.
encode_code39_ext($code)
Encode a string to be used for CODE 39 Extended mode.
barcode_code11($code)
CODE11 barcodes.
imb_tables($n, $size)
generate Nof13 tables used for Intelligent Mail Barcode
barcode_imb($code)
IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 (requires PHP bcmath extension) Intelligent Ma...
barcode_pharmacode($code)
Pharmacode Contains digits (0 to 9)
barcode_eanext($code, $len=5)
UPC-Based Extentions 2-Digit Ext.
getBarcodeSVGcode($w=2, $h=30, $color='black')
Return a SVG string representation of barcode.
__construct($code, $type)
This is the class constructor.
barcode_c128($code, $type='')
C128 barcodes.
barcode_postnet($code, $planet=false)
POSTNET and PLANET barcodes.
barcode_codabar($code)
CODABAR barcodes.
barcode_eanupc($code, $len=13)
EAN13 and UPC-A barcodes.