You are here

function pBarcode39::encode39 in Visitors 7.2

Same name and namespace in other branches
  1. 7 pChart/class/pBarcode39.class.php \pBarcode39::encode39()
2 calls to pBarcode39::encode39()
pBarcode39::draw in pChart/class/pBarcode39.class.php
pBarcode39::getSize in pChart/class/pBarcode39.class.php

File

pChart/class/pBarcode39.class.php, line 79

Class

pBarcode39

Code

function encode39($Value) {
  $this->Result = "100101101101" . "0";
  $TextString = "";
  for ($i = 1; $i <= strlen($Value); $i++) {
    $CharCode = ord($this
      ->mid($Value, $i, 1));
    if ($CharCode >= 97 && $CharCode <= 122) {
      $CharCode = $CharCode - 32;
    }
    if (isset($this->Codes[chr($CharCode)])) {
      $this->Result = $this->Result . $this->Codes[chr($CharCode)] . "0";
      $TextString = $TextString . chr($CharCode);
    }
  }
  if ($this->MOD43) {
    $Checksum = $this
      ->checksum($TextString);
    $this->Result = $this->Result . $this->Codes[$Checksum] . "0";
  }
  $this->Result = $this->Result . "100101101101";
  $TextString = "*" . $TextString . "*";
  return $TextString;
}