Changeset View
Changeset View
Standalone View
Standalone View
externals/phpqrcode/phpqrcode.php
Context not available. | |||||
class qrstr { | class qrstr { | ||||
public static function set(&$srctab, $x, $y, $repl, $replLen = false) { | public static function set(&$srctab, $x, $y, $repl, $replLen = false) { | ||||
$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); | $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?@substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:@strlen($repl)); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
$barcode_array = array(); | $barcode_array = array(); | ||||
if (!is_array($mode)) | if (!is_array($mode)) | ||||
$mode = explode(',', $mode); | $mode = @explode(',', $mode); | ||||
$eccLevel = 'L'; | $eccLevel = 'L'; | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public static function markTime($markerId) | public static function markTime($markerId) | ||||
{ | { | ||||
list($usec, $sec) = explode(" ", microtime()); | list($usec, $sec) = @explode(" ", microtime()); | ||||
$time = ((float)$usec + (float)$sec); | $time = ((float)$usec + (float)$sec); | ||||
if (!isset($GLOBALS['qr_time_bench'])) | if (!isset($GLOBALS['qr_time_bench'])) | ||||
Context not available. | |||||
if ($binary_mode) { | if ($binary_mode) { | ||||
foreach ($frame as &$frameLine) { | foreach ($frame as &$frameLine) { | ||||
$frameLine = join('<span class="m"> </span>', explode('0', $frameLine)); | $frameLine = join('<span class="m"> </span>', @explode('0', $frameLine)); | ||||
$frameLine = join('██', explode('1', $frameLine)); | $frameLine = join('██', @explode('1', $frameLine)); | ||||
} | } | ||||
?> | ?> | ||||
Context not available. | |||||
} else { | } else { | ||||
foreach ($frame as &$frameLine) { | foreach ($frame as &$frameLine) { | ||||
$frameLine = join('<span class="m"> </span>', explode("\xc0", $frameLine)); | $frameLine = join('<span class="m"> </span>', @explode("\xc0", $frameLine)); | ||||
$frameLine = join('<span class="m">▒</span>', explode("\xc1", $frameLine)); | $frameLine = join('<span class="m">▒</span>', @explode("\xc1", $frameLine)); | ||||
$frameLine = join('<span class="p"> </span>', explode("\xa0", $frameLine)); | $frameLine = join('<span class="p"> </span>', @explode("\xa0", $frameLine)); | ||||
$frameLine = join('<span class="p">▒</span>', explode("\xa1", $frameLine)); | $frameLine = join('<span class="p">▒</span>', @explode("\xa1", $frameLine)); | ||||
$frameLine = join('<span class="s">◇</span>', explode("\x84", $frameLine)); //format 0 | $frameLine = join('<span class="s">◇</span>', @explode("\x84", $frameLine)); //format 0 | ||||
$frameLine = join('<span class="s">◆</span>', explode("\x85", $frameLine)); //format 1 | $frameLine = join('<span class="s">◆</span>', @explode("\x85", $frameLine)); //format 1 | ||||
$frameLine = join('<span class="x">☢</span>', explode("\x81", $frameLine)); //special bit | $frameLine = join('<span class="x">☢</span>', @explode("\x81", $frameLine)); //special bit | ||||
$frameLine = join('<span class="c"> </span>', explode("\x90", $frameLine)); //clock 0 | $frameLine = join('<span class="c"> </span>', @explode("\x90", $frameLine)); //clock 0 | ||||
$frameLine = join('<span class="c">◷</span>', explode("\x91", $frameLine)); //clock 1 | $frameLine = join('<span class="c">◷</span>', @explode("\x91", $frameLine)); //clock 1 | ||||
$frameLine = join('<span class="f"> </span>', explode("\x88", $frameLine)); //version | $frameLine = join('<span class="f"> </span>', @explode("\x88", $frameLine)); //version | ||||
$frameLine = join('<span class="f">▒</span>', explode("\x89", $frameLine)); //version | $frameLine = join('<span class="f">▒</span>', @explode("\x89", $frameLine)); //version | ||||
$frameLine = join('♦', explode("\x01", $frameLine)); | $frameLine = join('♦', @explode("\x01", $frameLine)); | ||||
$frameLine = join('⋅', explode("\0", $frameLine)); | $frameLine = join('⋅', @explode("\0", $frameLine)); | ||||
} | } | ||||
?> | ?> | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public static function unserial($code) | public static function unserial($code) | ||||
{ | { | ||||
return explode("\n", gzuncompress($code)); | return @explode("\n", gzuncompress($code)); | ||||
} | } | ||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
Context not available. | |||||
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4) | private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4) | ||||
{ | { | ||||
$h = count($frame); | $h = count($frame); | ||||
$w = strlen($frame[0]); | $w = @strlen($frame[0]); | ||||
$imgW = $w + 2*$outerFrame; | $imgW = $w + 2*$outerFrame; | ||||
$imgH = $h + 2*$outerFrame; | $imgH = $h + 2*$outerFrame; | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public static function isdigitat($str, $pos) | public static function isdigitat($str, $pos) | ||||
{ | { | ||||
if ($pos >= strlen($str)) | if ($pos >= @strlen($str)) | ||||
return false; | return false; | ||||
return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9'))); | return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9'))); | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public static function isalnumat($str, $pos) | public static function isalnumat($str, $pos) | ||||
{ | { | ||||
if ($pos >= strlen($str)) | if ($pos >= @strlen($str)) | ||||
return false; | return false; | ||||
return (QRinput::lookAnTable(ord($str[$pos])) >= 0); | return (QRinput::lookAnTable(ord($str[$pos])) >= 0); | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public function identifyMode($pos) | public function identifyMode($pos) | ||||
{ | { | ||||
if ($pos >= strlen($this->dataStr)) | if ($pos >= @strlen($this->dataStr)) | ||||
return QR_MODE_NUL; | return QR_MODE_NUL; | ||||
$c = $this->dataStr[$pos]; | $c = $this->dataStr[$pos]; | ||||
Context not available. | |||||
return QR_MODE_AN; | return QR_MODE_AN; | ||||
} else if($this->modeHint == QR_MODE_KANJI) { | } else if($this->modeHint == QR_MODE_KANJI) { | ||||
if ($pos+1 < strlen($this->dataStr)) | if ($pos+1 < @strlen($this->dataStr)) | ||||
{ | { | ||||
$d = $this->dataStr[$pos+1]; | $d = $this->dataStr[$pos+1]; | ||||
$word = (ord($c) << 8) | ord($d); | $word = (ord($c) << 8) | ord($d); | ||||
Context not available. | |||||
$ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion()); | $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion()); | ||||
$p = 1; | $p = 1; | ||||
$dataStrLen = strlen($this->dataStr); | $dataStrLen = @strlen($this->dataStr); | ||||
while($p < $dataStrLen) { | while($p < $dataStrLen) { | ||||
Context not available. | |||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public function splitString() | public function splitString() | ||||
{ | { | ||||
while (strlen($this->dataStr) > 0) | while (@strlen($this->dataStr) > 0) | ||||
{ | { | ||||
if($this->dataStr == '') | if($this->dataStr == '') | ||||
return 0; | return 0; | ||||
Context not available. | |||||
if($length == 0) return 0; | if($length == 0) return 0; | ||||
if($length < 0) return -1; | if($length < 0) return -1; | ||||
$this->dataStr = substr($this->dataStr, $length); | $this->dataStr = @substr($this->dataStr, $length); | ||||
} | } | ||||
} | } | ||||
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- | ||||
public function toUpper() | public function toUpper() | ||||
{ | { | ||||
$stringLen = strlen($this->dataStr); | $stringLen = @strlen($this->dataStr); | ||||
$p = 0; | $p = 0; | ||||
while ($p<$stringLen) { | while ($p<$stringLen) { | ||||
$mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint); | $mode = self::identifyMode(@substr($this->dataStr, $p), $this->modeHint); | ||||
if($mode == QR_MODE_KANJI) { | if($mode == QR_MODE_KANJI) { | ||||
$p += 2; | $p += 2; | ||||
} else { | } else { | ||||
Context not available. | |||||
{ | { | ||||
$codeArr = array(); | $codeArr = array(); | ||||
$codeLines = explode("\n", gzuncompress($code)); | $codeLines = @explode("\n", gzuncompress($code)); | ||||
foreach ($codeLines as $line) | foreach ($codeLines as $line) | ||||
$codeArr[] = str_split($line); | $codeArr[] = str_split($line); | ||||
Context not available. | |||||
$input = new QRinput($version, $level); | $input = new QRinput($version, $level); | ||||
if($input == NULL) return NULL; | if($input == NULL) return NULL; | ||||
$ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); | $ret = $input->append($input, QR_MODE_8, @strlen($string), str_split($string)); | ||||
if($ret < 0) { | if($ret < 0) { | ||||
unset($input); | unset($input); | ||||
return NULL; | return NULL; | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0