Exemplo n.º 1
0
 public static function isalnumat($str, $pos)
 {
     if ($pos >= strlen($str)) {
         return false;
     }
     return weixin_qrcode_QRinput::lookAnTable(ord($str[$pos])) >= 0;
 }
Exemplo n.º 2
0
 public function encodeModeAn($version)
 {
     try {
         $words = (int) ($this->size / 2);
         $bs = new weixin_qrcode_QRbitstream();
         $bs->appendNum(4, 0x2);
         $bs->appendNum(weixin_qrcode_QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
         for ($i = 0; $i < $words; $i++) {
             $val = (int) weixin_qrcode_QRinput::lookAnTable(ord($this->data[$i * 2])) * 45;
             $val += (int) weixin_qrcode_QRinput::lookAnTable(ord($this->data[$i * 2 + 1]));
             $bs->appendNum(11, $val);
         }
         if ($this->size & 1) {
             $val = weixin_qrcode_QRinput::lookAnTable(ord($this->data[$words * 2]));
             $bs->appendNum(6, $val);
         }
         $this->bstream = $bs;
         return 0;
     } catch (Exception $e) {
         return -1;
     }
 }