| 3202 | //########################################################################## |
| 3203 | |
| 3204 | class QRencode { |
| 3205 | |
| 3206 | public $casesensitive = true; |
| 3207 | public $eightbit = false; |
| 3208 | |
| 3209 | public $version = 0; |
| 3210 | public $size = 3; |
| 3211 | public $margin = 4; |
| 3212 | |
| 3213 | public $structured = 0; // not supported yet |
| 3214 | |
| 3215 | public $level = QR_ECLEVEL_L; |
| 3216 | public $hint = QR_MODE_8; |
| 3217 | |
| 3218 | //---------------------------------------------------------------------- |
| 3219 | public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4) |
| 3220 | { |
| 3221 | $enc = new QRencode(); |
| 3222 | $enc->size = $size; |
| 3223 | $enc->margin = $margin; |
| 3224 | |
| 3225 | switch ($level.'') { |
| 3226 | case '0': |
| 3227 | case '1': |
| 3228 | case '2': |
| 3229 | case '3': |
| 3230 | $enc->level = $level; |
| 3231 | break; |
| 3232 | case 'l': |
| 3233 | case 'L': |
| 3234 | $enc->level = QR_ECLEVEL_L; |
| 3235 | break; |
| 3236 | case 'm': |
| 3237 | case 'M': |
| 3238 | $enc->level = QR_ECLEVEL_M; |
| 3239 | break; |
| 3240 | case 'q': |
| 3241 | case 'Q': |
| 3242 | $enc->level = QR_ECLEVEL_Q; |
| 3243 | break; |
| 3244 | case 'h': |
| 3245 | case 'H': |
| 3246 | $enc->level = QR_ECLEVEL_H; |
| 3247 | break; |
| 3248 | } |
| 3249 | |
| 3250 | return $enc; |
| 3251 | } |
| 3252 | |
| 3253 | //---------------------------------------------------------------------- |
| 3254 | public function encodeRAW($intext, $outfile = false) |
| 3255 | { |
| 3256 | $code = new QRcode(); |
| 3257 | |
| 3258 | if($this->eightbit) { |
| 3259 | $code->encodeString8bit($intext, $this->version, $this->level); |
| 3260 | } else { |
| 3261 | $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive); |
nothing calls this directly
no outgoing calls
no test coverage detected