From 88f800c50bf810a88e63b7824b9f8b4b21cb10c6 Mon Sep 17 00:00:00 2001 From: smiley Date: Fri, 24 Nov 2017 03:02:00 +0100 Subject: [PATCH] :sparkles: --- examples/authenticator.php | 27 ---------- examples/custom.php | 37 ------------- examples/example.php | 88 ------------------------------- examples/example_image.png | Bin 1827 -> 0 bytes examples/html.php | 54 ------------------- examples/image.php | 15 ------ public/index.html | 37 +++++++------ public/qrcode.php | 39 ++++++++------ src/Data/AlphaNum.php | 4 +- src/Data/Byte.php | 4 +- src/Data/Kanji.php | 4 +- src/Data/MaskPatternTester.php | 67 ++++++++++++----------- src/Data/Number.php | 4 +- src/Data/QRDataAbstract.php | 52 +++++++++++++----- src/Data/QRMatrix.php | 2 - src/Output/QRImage.php | 39 +++++++------- src/Output/QRMarkup.php | 15 +++--- src/Output/QROutputAbstract.php | 18 ++++--- src/Output/QROutputInterface.php | 2 +- src/Output/QRString.php | 13 ++--- src/QRCode.php | 43 ++++++++++----- src/QROptions.php | 57 ++++++-------------- 22 files changed, 215 insertions(+), 406 deletions(-) delete mode 100644 examples/authenticator.php delete mode 100644 examples/custom.php delete mode 100644 examples/example.php delete mode 100644 examples/example_image.png delete mode 100644 examples/html.php delete mode 100644 examples/image.php diff --git a/examples/authenticator.php b/examples/authenticator.php deleted file mode 100644 index fe5fc9a8b..000000000 --- a/examples/authenticator.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @copyright 2017 Smiley - * @license MIT - */ - -require_once '../vendor/autoload.php'; - -use chillerlan\{ - GoogleAuth\Authenticator, - QRCode\QRCode, - QRCode\Output\QRMarkup -}; - -$authenticator = new Authenticator; - -$secret = $authenticator->createSecret(); // -> userdata -$data = $authenticator->getUri($secret, 'label', 'example.com'); - -// markup - svg -echo '
'.(new QRCode($data, new QRMarkup))->output().'
'; - - diff --git a/examples/custom.php b/examples/custom.php deleted file mode 100644 index 2c1c7e0fd..000000000 --- a/examples/custom.php +++ /dev/null @@ -1,37 +0,0 @@ -pixelCount; $row++){ - for($col = 0; $col < $this->pixelCount; $col++){ - $output .= (string)(int)$this->matrix[$row][$col]; - } - } - - return $output; - } - -} - -$starttime = microtime(true); - -echo (new QRCode('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net', new MyCustomOutput))->output(); - -echo PHP_EOL.'QRCode: '.round((microtime(true)-$starttime), 5); diff --git a/examples/example.php b/examples/example.php deleted file mode 100644 index 9f57525b8..000000000 --- a/examples/example.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @copyright 2015 Smiley - * @license MIT - */ - -require_once '../vendor/autoload.php'; - -use chillerlan\QRCode\Output\{ - QRMarkup, QRMarkupOptions, QRImage, QRString, QRStringOptions -}; -use chillerlan\QRCode\QRCode; - -$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; - -?> - - - - - - QRCode test - - - -output().'" />'; - -// markup - svg -echo '
'.(new QRCode($data, new QRMarkup))->output().'
'; - -// markup - html -$outputOptions = new QRMarkupOptions; -$outputOptions->type = QRCode::OUTPUT_MARKUP_HTML; - -echo '
'.(new QRCode($data, new QRMarkup($outputOptions)))->output().'
'; - -// string - json -echo '
'.(new QRCode($data, new QRString))->output().'
';
-
-// string - text
-$outputOptions = new QRStringOptions;
-$outputOptions->type = QRCode::OUTPUT_STRING_TEXT;
-$outputOptions->textDark = '🔴';
-$outputOptions->textLight = 'â­•';
-
-echo '
'.(new QRCode($data, new QRString($outputOptions)))->output().'
'; - -?> - - diff --git a/examples/example_image.png b/examples/example_image.png deleted file mode 100644 index b98aa1a00f193e05153edee3fb81f52607087e3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1827 zcmaJ?e@t3e6sBElXFIJOe=Jj(=^q(#xXo#iJ)Tj;m1{49Y83vPVqa|xW##xy=N zgH$PUnll;`QsZD5Us;2^88(FLktfGCJgA>bES3L)k9+^YpGI*ykGtn|@Lw*h@X!+O z+S-v%192;Uw+CFAbti(RV1r}b&v6$US#H`Lu!ChJcKhD|duaW`htAme?`}rC&8>eu zJyVd>sXKJW7_DWaf$2BC*05oi$ zQ3@17S$XcwM^on5(yI`U9yZ`15*Z+fGcjS5ILR_TC-(!7xO;A&ok%oeDN>$QR| zg}$$Z={Rmz3&lfloQqizUJ=GX&xd@kPWty_K%jahw{K|`INW?Kd?jgL@-5!WMD_*8 z^0dG*rWVp$sEbh@FWtJ`PF1u4T03KcWKonr0-=Y8^2Uyet_J35s^;h3-hTQ82=_b} zkl%m=aIp{2Gmm@x7Z)>kZ$f4@I;X**~tKNzC4yCPTHEJW=DN0OvT?2oAm|y5w;EE-U~;W#ygp$dpW5 zj24H*ho?Y|wxWwZShVR%?lF2)BLdma@?uTE5MD?nFs>R6wJzCf#j?!g=3*4Bsoh8N zY6>wwg%{_hX&j`^Xwe>od2R*Ke)k5{f#Ci@+@Z+Jr>jkf4q&Z_b+vFViB}pw9)YKV zs$$ovkg>>06s^p>(nx9ZHDcFD;Y+B3S^yzEA0>I@a?WO>>9zE~y5&jbIv^uFPh{rW z=`tN@V*h!j@s3F3L92Yb_{ep!+|yn;{b zEK>X}GRCQ)<+}iBo>GW8m?GNURvQyyI9f|)E=pz8W0#GwS_Z*Xi7vVh9E(spZ2-F8 z+pyjWm)xJq*)L_Ag%H#6nz*2 - -.qrcode, -.qrcode > p, -.qrcode > p > b, -.qrcode > p > i { - margin:0; - padding:0; -} - -/* row element */ -.qrcode > p { - height: 1.25mm; - display: block; -} - -/* column element(s) */ -.qrcode > p > b, .qrcode > p > i{ - display: inline-block; - width: 1.25mm; - height: 1.25mm; -} - -.qrcode > p > b{ - background-color: #000; -} - -.qrcode > p > i{ - background-color: #fff; -} - -'; - -$qrStringOptions = new QRMarkupOptions; -$qrStringOptions->type = QRCode::OUTPUT_MARKUP_HTML; - -$qrOptions = new QROptions; -$qrOptions->typeNumber = QRCode::TYPE_05; -$qrOptions->errorCorrectLevel = QRCode::ERROR_CORRECT_LEVEL_L; - -$qr = new QRCode('skype://callto:echo123', new QRMarkup($qrStringOptions), $qrOptions); - -echo '
'.$qr->output().'
'; diff --git a/examples/image.php b/examples/image.php deleted file mode 100644 index 672df2012..000000000 --- a/examples/image.php +++ /dev/null @@ -1,15 +0,0 @@ -pixelSize = 10; -$qrImageOptions->cachefile = 'example_image.png'; - -(new QRCode('https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s', new QRImage($qrImageOptions)))->output(); - -echo ''; diff --git a/public/index.html b/public/index.html index f7cf8dc96..2594a2dee 100644 --- a/public/index.html +++ b/public/index.html @@ -10,10 +10,9 @@ input:focus, textarea:focus, select:focus{ border: 1px solid #ccc; } label{ cursor: pointer; } #qrcode-settings, div#qrcode-output{ text-align: center; } - div#qrcode-output > p {margin: 0;padding: 0;height: 3px;} - div#qrcode-output > p > b, div#qrcode-output > p > i {display: inline-block;width: 3px;height: 3px;} - div#qrcode-output > p > b {background-color: lightseagreen;} - div#qrcode-output > p > i {background-color: #fff;} + div#qrcode-output > div {margin: 0;padding: 0;height: 3px;} + div#qrcode-output > div > span {display: inline-block;width: 3px;height: 3px;} + div#qrcode-output > div > span {background-color: lightgrey;} @@ -63,50 +62,50 @@
Finder
Alignment
Timing
Format
Version
Data
Dark Module
@@ -114,12 +113,12 @@
Separator