From 3fd785654372d493c031d9b541ab33a881023a32 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Feb 2021 19:16:17 +0300 Subject: * switch to composer for qrcode and otp dependencies * move most OTP-related stuff into userhelper * remove old phpqrcode and otphp libraries --- vendor/chillerlan/php-qrcode/.github/FUNDING.yml | 1 + .../php-qrcode/.github/workflows/tests.yml | 55 ++ vendor/chillerlan/php-qrcode/.gitignore | 5 + vendor/chillerlan/php-qrcode/.scrutinizer.yml | 5 + vendor/chillerlan/php-qrcode/.travis.yml | 19 + vendor/chillerlan/php-qrcode/LICENSE | 21 + vendor/chillerlan/php-qrcode/README.md | 392 +++++++++++ vendor/chillerlan/php-qrcode/composer.json | 51 ++ .../php-qrcode/examples/MyCustomOutput.php | 36 + .../php-qrcode/examples/QRImageWithLogo.php | 81 +++ .../php-qrcode/examples/QRImageWithText.php | 104 +++ .../php-qrcode/examples/custom_output.php | 38 ++ .../php-qrcode/examples/example_image.png | Bin 0 -> 2279 bytes .../chillerlan/php-qrcode/examples/example_svg.png | Bin 0 -> 15925 bytes vendor/chillerlan/php-qrcode/examples/fpdf.php | 47 ++ vendor/chillerlan/php-qrcode/examples/html.php | 102 +++ vendor/chillerlan/php-qrcode/examples/image.php | 60 ++ .../php-qrcode/examples/imageWithLogo.php | 44 ++ .../php-qrcode/examples/imageWithText.php | 33 + vendor/chillerlan/php-qrcode/examples/imagick.php | 59 ++ vendor/chillerlan/php-qrcode/examples/octocat.png | Bin 0 -> 2468 bytes vendor/chillerlan/php-qrcode/examples/svg.php | 77 +++ vendor/chillerlan/php-qrcode/examples/text.php | 68 ++ vendor/chillerlan/php-qrcode/phpdoc.xml | 15 + vendor/chillerlan/php-qrcode/phpmd.xml | 34 + vendor/chillerlan/php-qrcode/phpunit.xml | 23 + vendor/chillerlan/php-qrcode/public/index.html | 163 +++++ vendor/chillerlan/php-qrcode/public/qrcode.php | 97 +++ vendor/chillerlan/php-qrcode/src/Data/AlphaNum.php | 65 ++ vendor/chillerlan/php-qrcode/src/Data/Byte.php | 47 ++ vendor/chillerlan/php-qrcode/src/Data/Kanji.php | 70 ++ .../php-qrcode/src/Data/MaskPatternTester.php | 203 ++++++ vendor/chillerlan/php-qrcode/src/Data/Number.php | 82 +++ .../php-qrcode/src/Data/QRCodeDataException.php | 17 + .../php-qrcode/src/Data/QRDataAbstract.php | 351 ++++++++++ .../php-qrcode/src/Data/QRDataInterface.php | 187 ++++++ vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php | 733 +++++++++++++++++++++ .../php-qrcode/src/Helpers/BitBuffer.php | 75 +++ .../php-qrcode/src/Helpers/Polynomial.php | 184 ++++++ .../src/Output/QRCodeOutputException.php | 17 + vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php | 112 ++++ .../chillerlan/php-qrcode/src/Output/QRImage.php | 208 ++++++ .../chillerlan/php-qrcode/src/Output/QRImagick.php | 123 ++++ .../chillerlan/php-qrcode/src/Output/QRMarkup.php | 151 +++++ .../php-qrcode/src/Output/QROutputAbstract.php | 130 ++++ .../php-qrcode/src/Output/QROutputInterface.php | 55 ++ .../chillerlan/php-qrcode/src/Output/QRString.php | 76 +++ vendor/chillerlan/php-qrcode/src/QRCode.php | 310 +++++++++ .../chillerlan/php-qrcode/src/QRCodeException.php | 15 + vendor/chillerlan/php-qrcode/src/QROptions.php | 61 ++ .../chillerlan/php-qrcode/src/QROptionsTrait.php | 408 ++++++++++++ .../php-qrcode/tests/Data/AlphaNumTest.php | 44 ++ .../chillerlan/php-qrcode/tests/Data/ByteTest.php | 38 ++ .../tests/Data/DatainterfaceTestAbstract.php | 65 ++ .../chillerlan/php-qrcode/tests/Data/KanjiTest.php | 50 ++ .../tests/Data/MaskPatternTesterTest.php | 29 + .../php-qrcode/tests/Data/NumberTest.php | 44 ++ .../php-qrcode/tests/Data/QRMatrixTest.php | 260 ++++++++ .../php-qrcode/tests/Helpers/BitBufferTest.php | 53 ++ .../php-qrcode/tests/Helpers/PolynomialTest.php | 42 ++ .../php-qrcode/tests/Output/QRFpdfTest.php | 83 +++ .../php-qrcode/tests/Output/QRImageTest.php | 69 ++ .../php-qrcode/tests/Output/QRImagickTest.php | 66 ++ .../php-qrcode/tests/Output/QRMarkupTest.php | 79 +++ .../tests/Output/QROutputTestAbstract.php | 71 ++ .../php-qrcode/tests/Output/QRStringTest.php | 56 ++ vendor/chillerlan/php-qrcode/tests/QRCodeTest.php | 140 ++++ .../chillerlan/php-qrcode/tests/QROptionsTest.php | 80 +++ .../chillerlan/php-qrcode/tests/QRTestAbstract.php | 72 ++ .../chillerlan/php-settings-container/.gitignore | 4 + .../php-settings-container/.scrutinizer.yml | 5 + .../chillerlan/php-settings-container/.travis.yml | 18 + vendor/chillerlan/php-settings-container/LICENSE | 21 + vendor/chillerlan/php-settings-container/README.md | 153 +++++ .../php-settings-container/composer.json | 40 ++ .../php-settings-container/examples/advanced.php | 46 ++ .../php-settings-container/examples/simple.php | 30 + vendor/chillerlan/php-settings-container/phpmd.xml | 35 + .../chillerlan/php-settings-container/phpunit.xml | 22 + .../src/SettingsContainerAbstract.php | 172 +++++ .../src/SettingsContainerInterface.php | 104 +++ .../php-settings-container/tests/ContainerTest.php | 105 +++ .../php-settings-container/tests/TestContainer.php | 29 + .../tests/TestOptionsTrait.php | 42 ++ 84 files changed, 7477 insertions(+) create mode 100644 vendor/chillerlan/php-qrcode/.github/FUNDING.yml create mode 100644 vendor/chillerlan/php-qrcode/.github/workflows/tests.yml create mode 100644 vendor/chillerlan/php-qrcode/.gitignore create mode 100644 vendor/chillerlan/php-qrcode/.scrutinizer.yml create mode 100644 vendor/chillerlan/php-qrcode/.travis.yml create mode 100644 vendor/chillerlan/php-qrcode/LICENSE create mode 100644 vendor/chillerlan/php-qrcode/README.md create mode 100644 vendor/chillerlan/php-qrcode/composer.json create mode 100644 vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php create mode 100644 vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php create mode 100644 vendor/chillerlan/php-qrcode/examples/QRImageWithText.php create mode 100644 vendor/chillerlan/php-qrcode/examples/custom_output.php create mode 100644 vendor/chillerlan/php-qrcode/examples/example_image.png create mode 100644 vendor/chillerlan/php-qrcode/examples/example_svg.png create mode 100644 vendor/chillerlan/php-qrcode/examples/fpdf.php create mode 100644 vendor/chillerlan/php-qrcode/examples/html.php create mode 100644 vendor/chillerlan/php-qrcode/examples/image.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imageWithLogo.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imageWithText.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imagick.php create mode 100644 vendor/chillerlan/php-qrcode/examples/octocat.png create mode 100644 vendor/chillerlan/php-qrcode/examples/svg.php create mode 100644 vendor/chillerlan/php-qrcode/examples/text.php create mode 100644 vendor/chillerlan/php-qrcode/phpdoc.xml create mode 100644 vendor/chillerlan/php-qrcode/phpmd.xml create mode 100644 vendor/chillerlan/php-qrcode/phpunit.xml create mode 100644 vendor/chillerlan/php-qrcode/public/index.html create mode 100644 vendor/chillerlan/php-qrcode/public/qrcode.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/AlphaNum.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Byte.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Kanji.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Number.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRCodeDataException.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php create mode 100644 vendor/chillerlan/php-qrcode/src/Helpers/BitBuffer.php create mode 100644 vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRCodeOutputException.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRImage.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRImagick.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRString.php create mode 100644 vendor/chillerlan/php-qrcode/src/QRCode.php create mode 100644 vendor/chillerlan/php-qrcode/src/QRCodeException.php create mode 100644 vendor/chillerlan/php-qrcode/src/QROptions.php create mode 100644 vendor/chillerlan/php-qrcode/src/QROptionsTrait.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/AlphaNumTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/ByteTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/KanjiTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/MaskPatternTesterTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/NumberTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/QRMatrixTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Helpers/BitBufferTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Helpers/PolynomialTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRFpdfTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRImagickTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRStringTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QRCodeTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QROptionsTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QRTestAbstract.php create mode 100644 vendor/chillerlan/php-settings-container/.gitignore create mode 100644 vendor/chillerlan/php-settings-container/.scrutinizer.yml create mode 100644 vendor/chillerlan/php-settings-container/.travis.yml create mode 100644 vendor/chillerlan/php-settings-container/LICENSE create mode 100644 vendor/chillerlan/php-settings-container/README.md create mode 100644 vendor/chillerlan/php-settings-container/composer.json create mode 100644 vendor/chillerlan/php-settings-container/examples/advanced.php create mode 100644 vendor/chillerlan/php-settings-container/examples/simple.php create mode 100644 vendor/chillerlan/php-settings-container/phpmd.xml create mode 100644 vendor/chillerlan/php-settings-container/phpunit.xml create mode 100644 vendor/chillerlan/php-settings-container/src/SettingsContainerAbstract.php create mode 100644 vendor/chillerlan/php-settings-container/src/SettingsContainerInterface.php create mode 100644 vendor/chillerlan/php-settings-container/tests/ContainerTest.php create mode 100644 vendor/chillerlan/php-settings-container/tests/TestContainer.php create mode 100644 vendor/chillerlan/php-settings-container/tests/TestOptionsTrait.php (limited to 'vendor/chillerlan') diff --git a/vendor/chillerlan/php-qrcode/.github/FUNDING.yml b/vendor/chillerlan/php-qrcode/.github/FUNDING.yml new file mode 100644 index 000000000..fc89a6739 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: codemasher diff --git a/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml new file mode 100644 index 000000000..5dd343abd --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml @@ -0,0 +1,55 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://github.com/localheinz/php-library-template/blob/master/.github/workflows/continuous-integration.yml +# https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml + +on: + - pull_request + - push + +name: "Continuous Integration" + +jobs: + + tests: + name: "Unit Tests" + runs-on: ubuntu-latest + + strategy: + matrix: + php-binary: + - php7.2 + - php7.3 + - php7.4 + + steps: + - name: "Checkout" + uses: actions/checkout@v1.1.0 + + - name: "Install dependencies with composer" + run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest + + - name: "Run unit tests with phpunit" + run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage + + + code-coverage: + name: "Code Coverage" + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v1.1.0 + + - name: "Install locked dependencies with composer" + run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Dump Xdebug filter with phpunit/phpunit" + run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php + + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php + + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/chillerlan/php-qrcode/.gitignore b/vendor/chillerlan/php-qrcode/.gitignore new file mode 100644 index 000000000..ecebb9964 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.gitignore @@ -0,0 +1,5 @@ +.build/* +.idea/* +vendor/* +composer.lock +*.phpunit.result.cache diff --git a/vendor/chillerlan/php-qrcode/.scrutinizer.yml b/vendor/chillerlan/php-qrcode/.scrutinizer.yml new file mode 100644 index 000000000..7fdd2a4dc --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.scrutinizer.yml @@ -0,0 +1,5 @@ +filter: + excluded_paths: + - examples/* + - tests/* + - vendor/* diff --git a/vendor/chillerlan/php-qrcode/.travis.yml b/vendor/chillerlan/php-qrcode/.travis.yml new file mode 100644 index 000000000..78b8d79e9 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.travis.yml @@ -0,0 +1,19 @@ +addons: + apt: + packages: + - imagemagick + +language: php + +matrix: + include: + - php: 7.2 + - php: 7.3 + - php: 7.4 + +before_install: + - pecl channel-update pecl.php.net + - printf "\n" | pecl install imagick +install: travis_retry composer install --no-interaction --prefer-source +script: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover clover.xml +after_script: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/chillerlan/php-qrcode/LICENSE b/vendor/chillerlan/php-qrcode/LICENSE new file mode 100644 index 000000000..dac852818 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Smiley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/chillerlan/php-qrcode/README.md b/vendor/chillerlan/php-qrcode/README.md new file mode 100644 index 000000000..075b2a376 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/README.md @@ -0,0 +1,392 @@ +# chillerlan/php-qrcode + +A PHP7.2+ QR Code library based on the [implementation](https://github.com/kazuhikoarase/qrcode-generator) by [Kazuhiko Arase](https://github.com/kazuhikoarase), +namespaced, cleaned up, improved and other stuff. + +[![Packagist version][packagist-badge]][packagist] +[![License][license-badge]][license] +[![Travis CI][travis-badge]][travis] +[![CodeCov][coverage-badge]][coverage] +[![Scrunitizer CI][scrutinizer-badge]][scrutinizer] +[![Packagist downloads][downloads-badge]][downloads] +[![PayPal donate][donate-badge]][donate] + +[![Continuous Integration][gh-action-badge]][gh-action] + +[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-qrcode.svg?style=flat-square +[packagist]: https://packagist.org/packages/chillerlan/php-qrcode +[license-badge]: https://img.shields.io/github/license/chillerlan/php-qrcode.svg?style=flat-square +[license]: https://github.com/chillerlan/php-qrcode/blob/main/LICENSE +[travis-badge]: https://img.shields.io/travis/chillerlan/php-qrcode.svg?style=flat-square +[travis]: https://travis-ci.org/chillerlan/php-qrcode +[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-qrcode.svg?style=flat-square +[coverage]: https://codecov.io/github/chillerlan/php-qrcode +[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-qrcode.svg?style=flat-square +[scrutinizer]: https://scrutinizer-ci.com/g/chillerlan/php-qrcode +[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-qrcode.svg?style=flat-square +[downloads]: https://packagist.org/packages/chillerlan/php-qrcode/stats +[donate-badge]: https://img.shields.io/badge/donate-paypal-ff33aa.svg?style=flat-square +[donate]: https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4 +[gh-action-badge]: https://github.com/chillerlan/php-qrcode/workflows/Continuous%20Integration/badge.svg +[gh-action]: https://github.com/chillerlan/php-qrcode/actions + +## Documentation + +### Requirements +- PHP 7.2+ + - `ext-mbstring` + - optional: + - `ext-json`, `ext-gd` + - `ext-imagick` with [ImageMagick](https://imagemagick.org) installed + - [`setasign/fpdf`](https://github.com/setasign/fpdf) for the PDF output module + +### Installation +**requires [composer](https://getcomposer.org)** + +via terminal: `composer require chillerlan/php-qrcode` + +*composer.json* (note: replace `dev-master` with a [version boundary](https://getcomposer.org/doc/articles/versions.md), e.g. `^3.2`) +```json +{ + "require": { + "php": "^7.2", + "chillerlan/php-qrcode": "^3.4" + } +} +``` + +### Usage +We want to encode this URI for a mobile authenticator into a QRcode image: +```php +$data = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net'; + +//quick and simple: +echo 'QR Code'; +``` + +

+ QR codes are awesome! + QR codes are awesome! +

+ +Wait, what was that? Please again, slower! + +### Advanced usage + +Ok, step by step. First you'll need a `QRCode` instance, which can be optionally invoked with a `QROptions` (or a [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), respectively) object as the only parameter. + +```php +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, +]); + +// invoke a fresh QRCode instance +$qrcode = new QRCode($options); + +// and dump the output +$qrcode->render($data); + +// ...with additional cache file +$qrcode->render($data, '/path/to/file.svg'); +``` + +In case you just want the raw QR code matrix, call `QRCode::getMatrix()` - this method is also called internally from `QRCode::render()`. See also [Custom output modules](#custom-qroutputinterface). + +```php +$matrix = $qrcode->getMatrix($data); + +foreach($matrix->matrix() as $y => $row){ + foreach($row as $x => $module){ + + // get a module's value + $value = $module; + $value = $matrix->get($x, $y); + + // boolean check a module + if($matrix->check($x, $y)){ // if($module >> 8 > 0) + // do stuff, the module is dark + } + else{ + // do other stuff, the module is light + } + + } +} +``` + +Have a look [in this folder](https://github.com/chillerlan/php-qrcode/tree/master/examples) for some more usage examples. + +#### Custom module values +Previous versions of `QRCode` held only boolean matrix values that only allowed to determine whether a module was dark or not. Now you can distinguish between different parts of the matrix, namely the several required patterns from the QR Code specification, and use them in different ways. + +The dark value is the module (light) value shifted by 8 bits to the left: `$value = $M_TYPE << ($bool ? 8 : 0);`, where `$M_TYPE` is one of the `QRMatrix::M_*` constants. +You can check the value for a type explicitly like... +```php +// for true (dark) +$value >> 8 === $M_TYPE; + +//for false (light) +$value === $M_TYPE; +``` +...or you can perform a loose check, ignoring the module value +```php +// for true +$value >> 8 > 0; + +// for false +$value >> 8 === 0 +``` + +See also `QRMatrix::set()`, `QRMatrix::check()` and [`QRMatrix` constants](#qrmatrix-constants). + +To map the values and properly render the modules for the given `QROutputInterface`, it's necessary to overwrite the default values: +```php +$options = new QROptions; + +// for HTML, SVG and ImageMagick +$options->moduleValues = [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', +]; + +// for the image output types +$options->moduleValues = [ + 512 => [0, 0, 0], + // ... +]; + +// for string/text output +$options->moduleValues = [ + 512 => '#', + // ... +]; +``` + +#### Custom `QROutputInterface` +Instead of bloating your code you can simply create your own output interface by extending `QROutputAbstract`. Have a look at the [built-in output modules](https://github.com/chillerlan/php-qrcode/tree/master/src/Output). + +```php +class MyCustomOutput extends QROutputAbstract{ + + // inherited from QROutputAbstract + protected $matrix; // QRMatrix + protected $moduleCount; // modules QRMatrix::size() + protected $options; // MyCustomOptions or QROptions + protected $scale; // scale factor from options + protected $length; // length of the matrix ($moduleCount * $scale) + + // ...check/set default module values (abstract method, called by the constructor) + protected function setModuleValues():void{ + // $this->moduleValues = ... + } + + // QROutputInterface::dump() + public function dump(string $file = null):string{ + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} +``` + +In case you need additional settings for your output module, just extend `QROptions`... +``` +class MyCustomOptions extends QROptions{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +...or use the [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), which is the more flexible approach. + +```php +trait MyCustomOptionsTrait{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +set the options: +```php +$myOptions = [ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, + // your custom settings + 'myParam' => 'whatever value', + ]; + +// extends QROptions +$myCustomOptions = new MyCustomOptions($myOptions); + +// using the SettingsContainerInterface +$myCustomOptions = new class($myOptions) extends SettingsContainerAbstract{ + use QROptionsTrait, MyCustomOptionsTrait; +}; + +``` + +You can then call `QRCode` with the custom modules... +```php +(new QRCode($myCustomOptions))->render($data); +``` +...or invoke the `QROutputInterface` manually. +```php +$qrOutputInterface = new MyCustomOutput($myCustomOptions, (new QRCode($myCustomOptions))->getMatrix($data)); + +//dump the output, which is equivalent to QRCode::render() +$qrOutputInterface->dump(); +``` + +### API + +#### `QRCode` methods +method | return | description +------ | ------ | ----------- +`__construct(QROptions $options = null)` | - | see [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php) +`render(string $data, string $file = null)` | mixed, `QROutputInterface::dump()` | renders a QR Code for the given `$data` and `QROptions`, saves `$file` optional +`getMatrix(string $data)` | `QRMatrix` | returns a `QRMatrix` object for the given `$data` and current `QROptions` +`initDataInterface(string $data)` | `QRDataInterface` | returns a fresh `QRDataInterface` for the given `$data` +`isNumber(string $string)` | bool | checks if a string qualifies for `Number` +`isAlphaNum(string $string)` | bool | checks if a string qualifies for `AlphaNum` +`isKanji(string $string)` | bool | checks if a string qualifies for `Kanji` + +#### `QRCode` constants +name | description +---- | ----------- +`VERSION_AUTO` | `QROptions::$version` +`MASK_PATTERN_AUTO` | `QROptions::$maskPattern` +`OUTPUT_MARKUP_SVG`, `OUTPUT_MARKUP_HTML` | `QROptions::$outputType` markup +`OUTPUT_IMAGE_PNG`, `OUTPUT_IMAGE_JPG`, `OUTPUT_IMAGE_GIF` | `QROptions::$outputType` image +`OUTPUT_STRING_JSON`, `OUTPUT_STRING_TEXT` | `QROptions::$outputType` string +`OUTPUT_IMAGICK` | `QROptions::$outputType` ImageMagick +`OUTPUT_FPDF` | `QROptions::$outputType` PDF, using [FPDF](https://github.com/setasign/fpdf) +`OUTPUT_CUSTOM` | `QROptions::$outputType`, requires `QROptions::$outputInterface` +`ECC_L`, `ECC_M`, `ECC_Q`, `ECC_H`, | ECC-Level: 7%, 15%, 25%, 30% in `QROptions::$eccLevel` +`DATA_NUMBER`, `DATA_ALPHANUM`, `DATA_BYTE`, `DATA_KANJI` | `QRDataInterface::$datamode` + +#### `QROptions` properties +property | type | default | allowed | description +-------- | ---- | ------- | ------- | ----------- +`$version` | int | `QRCode::VERSION_AUTO` | 1...40 | the [QR Code version number](http://www.qrcode.com/en/about/version.html) +`$versionMin` | int | 1 | 1...40 | Minimum QR version (if `$version = QRCode::VERSION_AUTO`) +`$versionMax` | int | 40 | 1...40 | Maximum QR version (if `$version = QRCode::VERSION_AUTO`) +`$eccLevel` | int | `QRCode::ECC_L` | `QRCode::ECC_X` | Error correct level, where X = L (7%), M (15%), Q (25%), H (30%) +`$maskPattern` | int | `QRCode::MASK_PATTERN_AUTO` | 0...7 | Mask Pattern to use +`$addQuietzone` | bool | `true` | - | Add a "quiet zone" (margin) according to the QR code spec +`$quietzoneSize` | int | 4 | clamped to 0 ... `$matrixSize / 2` | Size of the quiet zone +`$dataMode` | string | `null` | `Number`, `AlphaNum`, `Kanji`, `Byte` | allows overriding the data type detection +`$outputType` | string | `QRCode::OUTPUT_IMAGE_PNG` | `QRCode::OUTPUT_*` | built-in output type +`$outputInterface` | string | `null` | * | FQCN of the custom `QROutputInterface` if `QROptions::$outputType` is set to `QRCode::OUTPUT_CUSTOM` +`$cachefile` | string | `null` | * | optional cache file path +`$eol` | string | `PHP_EOL` | * | newline string (HTML, SVG, TEXT) +`$scale` | int | 5 | * | size of a QR code pixel (SVG, IMAGE_*), HTML -> via CSS +`$cssClass` | string | `null` | * | a common css class +`$svgOpacity` | float | 1.0 | 0...1 | +`$svgDefs` | string | * | * | anything between [``](https://developer.mozilla.org/docs/Web/SVG/Element/defs) +`$svgViewBoxSize` | int | `null` | * | a positive integer which defines width/height of the [viewBox attribute](https://css-tricks.com/scale-svg/#article-header-id-3) +`$textDark` | string | '🔴' | * | string substitute for dark +`$textLight` | string | '⭕' | * | string substitute for light +`$markupDark` | string | '#000' | * | markup substitute for dark (CSS value) +`$markupLight` | string | '#fff' | * | markup substitute for light (CSS value) +`$imageBase64` | bool | `true` | - | whether to return the image data as base64 or raw like from `file_get_contents()` +`$imageTransparent` | bool | `true` | - | toggle transparency (no jpeg support) +`$imageTransparencyBG` | array | `[255, 255, 255]` | `[R, G, B]` | the RGB values for the transparent color, see [`imagecolortransparent()`](http://php.net/manual/function.imagecolortransparent.php) +`$pngCompression` | int | -1 | -1 ... 9 | `imagepng()` compression level, -1 = auto +`$jpegQuality` | int | 85 | 0 - 100 | `imagejpeg()` quality +`$imagickFormat` | string | 'png' | * | ImageMagick output type, see `Imagick::setType()` +`$imagickBG` | string | `null` | * | ImageMagick background color, see `ImagickPixel::__construct()` +`$moduleValues` | array | `null` | * | Module values map, see [Custom output modules](#custom-qroutputinterface) and `QROutputInterface::DEFAULT_MODULE_VALUES` + +#### `QRMatrix` methods +method | return | description +------ | ------ | ----------- +`__construct(int $version, int $eclevel)` | - | - +`matrix()` | array | the internal matrix representation as a 2 dimensional array +`version()` | int | the current QR Code version +`eccLevel()` | int | current ECC level +`maskPattern()` | int | the used mask pattern +`size()` | int | the absoulute size of the matrix, including quiet zone (if set). `$version * 4 + 17 + 2 * $quietzone` +`get(int $x, int $y)` | int | returns the value of the module +`set(int $x, int $y, bool $value, int $M_TYPE)` | `QRMatrix` | sets the `$M_TYPE` value for the module +`check(int $x, int $y)` | bool | checks whether a module is true (dark) or false (light) +`setLogoSpace(int $width, int $height, int $startX = null, int $startY = null)` | `QRMatrix` | creates a logo space in the matrix + +#### `QRMatrix` constants +name | light (false) | dark (true) | description +---- | ------------- | ----------- | ----------- +`M_NULL` | 0 | - | module not set (should never appear. if so, there's an error) +`M_DARKMODULE` | - | 512 | once per matrix at `$xy = [8, 4 * $version + 9]` +`M_DATA` | 4 | 1024 | the actual encoded data +`M_FINDER` | 6 | 1536 | the 7x7 finder patterns +`M_SEPARATOR` | 8 | - | separator lines around the finder patterns +`M_ALIGNMENT` | 10 | 2560 | the 5x5 alignment patterns +`M_TIMING` | 12 | 3072 | the timing pattern lines +`M_FORMAT` | 14 | 3584 | format information pattern +`M_VERSION` | 16 | 4096 | version information pattern +`M_QUIETZONE` | 18 | - | margin around the QR Code +`M_LOGO` | 20 | - | space for a logo image (not used yet) +`M_TEST` | 255 | 65280 | test value + + +### Notes +The QR encoder, especially the subroutines for mask pattern testing, can cause high CPU load on increased matrix size. +You can avoid a part of this load by choosing a fast output module, like `OUTPUT_IMAGE_*` and setting the mask pattern manually (which may result in unreadable QR Codes). +Oh hey and don't forget to sanitize any user input! + +### Disclaimer! +I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk! + +#### Trademark Notice + +The word "QR Code" is registered trademark of *DENSO WAVE INCORPORATED*
+http://www.denso-wave.com/qrcode/faqpatent-e.html + +### Framework Integration +- Drupal [Google Authenticator Login `ga_login`](https://www.drupal.org/project/ga_login) +- WordPress [`wp-two-factor-auth`](https://github.com/sjinks/wp-two-factor-auth) +- WordPress [Simple 2FA `simple-2fa`](https://wordpress.org/plugins/simple-2fa/) +- WoltLab Suite [two-step-verification](http://pluginstore.woltlab.com/file/3007-two-step-verification/) +- [Cachet](https://github.com/CachetHQ/Cachet) +- [Appwrite](https://github.com/appwrite/appwrite) +- other uses: [dependents](https://github.com/chillerlan/php-qrcode/network/dependents) / [packages](https://github.com/chillerlan/php-qrcode/network/dependents?dependent_type=PACKAGE) + + +Hi, please check out my other projects that are way cooler than qrcodes! + +- [php-oauth-core](https://github.com/chillerlan/php-oauth-core) - an OAuth 1/2 client library along with a bunch of [providers](https://github.com/chillerlan/php-oauth-providers) +- [php-httpinterface](https://github.com/chillerlan/php-httpinterface) - a PSR-7/15/17/18 implemetation +- [php-database](https://github.com/chillerlan/php-database) - a database client & querybuilder for MySQL, Postgres, SQLite, MSSQL, Firebird + diff --git a/vendor/chillerlan/php-qrcode/composer.json b/vendor/chillerlan/php-qrcode/composer.json new file mode 100644 index 000000000..c2299a350 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/composer.json @@ -0,0 +1,51 @@ +{ + "name": "chillerlan/php-qrcode", + "description": "A QR code generator. PHP 7.2+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "license": "MIT", + "minimum-stability": "stable", + "type": "library", + "keywords": [ + "QR code", "qrcode", "qr", "qrcode-generator", "phpqrcode" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage":"https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "require": { + "php": "^7.2", + "ext-mbstring": "*", + "chillerlan/php-settings-container": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "chillerlan\\QRCodePublic\\": "public/", + "chillerlan\\QRCodeTest\\": "tests/", + "chillerlan\\QRCodeExamples\\": "examples/" + } + } +} diff --git a/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php b/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php new file mode 100644 index 000000000..3c01f8646 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php @@ -0,0 +1,36 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QROutputAbstract; + +class MyCustomOutput extends QROutputAbstract{ + + protected function setModuleValues():void{ + // TODO: Implement setModuleValues() method. + } + + public function dump(string $file = null){ + + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php new file mode 100644 index 000000000..f9d94ae34 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php @@ -0,0 +1,81 @@ + + * @copyright 2020 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage}; + +use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable; + +/** + * @property \chillerlan\QRCodeExamples\LogoOptions $options + */ +class QRImageWithLogo extends QRImage{ + + /** + * @param string|null $file + * @param string|null $logo + * + * @return string + * @throws \chillerlan\QRCode\Output\QRCodeOutputException + */ + public function dump(string $file = null, string $logo = null):string{ + // set returnResource to true to skip further processing for now + $this->options->returnResource = true; + + // of course you could accept other formats too (such as resource or Imagick) + // i'm not checking for the file type either for simplicity reasons (assuming PNG) + if(!is_file($logo) || !is_readable($logo)){ + throw new QRCodeOutputException('invalid logo'); + } + + $this->matrix->setLogoSpace( + $this->options->logoWidth, + $this->options->logoHeight + // not utilizing the position here + ); + + // there's no need to save the result of dump() into $this->image here + parent::dump($file); + + $im = imagecreatefrompng($logo); + + // get logo image size + $w = imagesx($im); + $h = imagesy($im); + + // set new logo size, leave a border of 1 module + $lw = ($this->options->logoWidth - 2) * $this->options->scale; + $lh = ($this->options->logoHeight - 2) * $this->options->scale; + + // get the qrcode size + $ql = $this->matrix->size() * $this->options->scale; + + // scale the logo and copy it over. done! + imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h); + + $imageData = $this->dumpImage(); + + if($file !== null){ + $this->saveToFile($imageData, $file); + } + + if($this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php b/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php new file mode 100644 index 000000000..5ca572f30 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php @@ -0,0 +1,104 @@ + + * @copyright 2019 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QRImage; +use function base64_encode, imagechar, imagecolorallocate, imagecolortransparent, imagecopymerge, imagecreatetruecolor, + imagedestroy, imagefilledrectangle, imagefontwidth, in_array, round, str_split, strlen; + +class QRImageWithText extends QRImage{ + + /** + * @param string|null $file + * @param string|null $text + * + * @return string + */ + public function dump(string $file = null, string $text = null):string{ + $this->image = imagecreatetruecolor($this->length, $this->length); + $background = imagecolorallocate($this->image, ...$this->options->imageTransparencyBG); + + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + imagefilledrectangle($this->image, 0, 0, $this->length, $this->length, $background); + + foreach($this->matrix->matrix() as $y => $row){ + foreach($row as $x => $M_TYPE){ + $this->setPixel($x, $y, $this->moduleValues[$M_TYPE]); + } + } + + // render text output if a string is given + if($text !== null){ + $this->addText($text); + } + + $imageData = $this->dumpImage($file); + + if((bool)$this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + + /** + * @param string $text + */ + protected function addText(string $text):void{ + // save the qrcode image + $qrcode = $this->image; + + // options things + $textSize = 3; // see imagefontheight() and imagefontwidth() + $textBG = [200, 200, 200]; + $textColor = [50, 50, 50]; + + $bgWidth = $this->length; + $bgHeight = $bgWidth + 20; // 20px extra space + + // create a new image with additional space + $this->image = imagecreatetruecolor($bgWidth, $bgHeight); + $background = imagecolorallocate($this->image, ...$textBG); + + // allow transparency + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + // fill the background + imagefilledrectangle($this->image, 0, 0, $bgWidth, $bgHeight, $background); + + // copy over the qrcode + imagecopymerge($this->image, $qrcode, 0, 0, 0, 0, $this->length, $this->length, 100); + imagedestroy($qrcode); + + $fontColor = imagecolorallocate($this->image, ...$textColor); + $w = imagefontwidth($textSize); + $x = round(($bgWidth - strlen($text) * $w) / 2); + + // loop through the string and draw the letters + foreach(str_split($text) as $i => $chr){ + imagechar($this->image, $textSize, $i * $w + $x, $this->length, $chr, $fontColor); + } + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/custom_output.php b/vendor/chillerlan/php-qrcode/examples/custom_output.php new file mode 100644 index 000000000..71ea62682 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/custom_output.php @@ -0,0 +1,38 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +// invoke the QROutputInterface manually +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, +]); + +$qrOutputInterface = new MyCustomOutput($options, (new QRCode($options))->getMatrix($data)); + +var_dump($qrOutputInterface->dump()); + + +// or just +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, +]); + +var_dump((new QRCode($options))->render($data)); diff --git a/vendor/chillerlan/php-qrcode/examples/example_image.png b/vendor/chillerlan/php-qrcode/examples/example_image.png new file mode 100644 index 000000000..b4a80f2ab Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/example_image.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/example_svg.png b/vendor/chillerlan/php-qrcode/examples/example_svg.png new file mode 100644 index 000000000..f1e7b32f7 Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/example_svg.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/fpdf.php b/vendor/chillerlan/php-qrcode/examples/fpdf.php new file mode 100644 index 000000000..9c690a7f7 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/fpdf.php @@ -0,0 +1,47 @@ + 7, + 'outputType' => QRCode::OUTPUT_FPDF, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +\header('Content-type: application/pdf'); + +echo (new QRCode($options))->render($data); diff --git a/vendor/chillerlan/php-qrcode/examples/html.php b/vendor/chillerlan/php-qrcode/examples/html.php new file mode 100644 index 000000000..aa5305d24 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/html.php @@ -0,0 +1,102 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once '../vendor/autoload.php'; + +header('Content-Type: text/html; charset=utf-8'); + +?> + + + + + + QRCode test + + + +
+ 5, + 'outputType' => QRCode::OUTPUT_MARKUP_HTML, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', + ], + ]); + + echo (new QRCode($options))->render($data); + +?> +
+ + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/image.php b/vendor/chillerlan/php-qrcode/examples/image.php new file mode 100644 index 000000000..89ba2a9a8 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/image.php @@ -0,0 +1,60 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php new file mode 100644 index 000000000..987e10c11 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php @@ -0,0 +1,44 @@ + + * @copyright 2020 smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +/** + * @property int $logoWidth + * @property int $logoHeight + * + * @noinspection PhpIllegalPsrClassPathInspection + */ +class LogoOptions extends QROptions{ + protected $logoWidth; + protected $logoHeight; +} + +$options = new LogoOptions; + +$options->version = 7; +$options->eccLevel = QRCode::ECC_H; +$options->imageBase64 = false; +$options->logoWidth = 13; +$options->logoHeight = 13; +$options->scale = 5; +$options->imageTransparent = false; + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithLogo($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with an additional logo +echo $qrOutputInterface->dump(null, __DIR__.'/octocat.png'); diff --git a/vendor/chillerlan/php-qrcode/examples/imageWithText.php b/vendor/chillerlan/php-qrcode/examples/imageWithText.php new file mode 100644 index 000000000..050781cba --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imageWithText.php @@ -0,0 +1,33 @@ + + * @copyright 2019 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'scale' => 3, + 'imageBase64' => false, +]); + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithText($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with additional text +echo $qrOutputInterface->dump(null, 'example text'); diff --git a/vendor/chillerlan/php-qrcode/examples/imagick.php b/vendor/chillerlan/php-qrcode/examples/imagick.php new file mode 100644 index 000000000..6bec4d02e --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imagick.php @@ -0,0 +1,59 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGICK, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#DDDDDD', + // quietzone + 18 => '#DDDDDD', + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/octocat.png b/vendor/chillerlan/php-qrcode/examples/octocat.png new file mode 100644 index 000000000..f9050b935 Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/octocat.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/svg.php b/vendor/chillerlan/php-qrcode/examples/svg.php new file mode 100644 index 000000000..a7a159d70 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/svg.php @@ -0,0 +1,77 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +$gzip = true; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, + 'svgViewBoxSize' => 530, + 'addQuietzone' => true, + 'cssClass' => 'my-css-class', + 'svgOpacity' => 1.0, + 'svgDefs' => ' + + + + + + + + + ', + 'moduleValues' => [ + // finder + 1536 => 'url(#g1)', // dark (true) + 6 => '#fff', // light (false) + // alignment + 2560 => 'url(#g1)', + 10 => '#fff', + // timing + 3072 => 'url(#g1)', + 12 => '#fff', + // format + 3584 => 'url(#g1)', + 14 => '#fff', + // version + 4096 => 'url(#g1)', + 16 => '#fff', + // data + 1024 => 'url(#g2)', + 4 => '#fff', + // darkmodule + 512 => 'url(#g1)', + // separator + 8 => '#fff', + // quietzone + 18 => '#fff', + ], +]); + +$qrcode = (new QRCode($options))->render($data); + +header('Content-type: image/svg+xml'); + +if($gzip === true){ + header('Vary: Accept-Encoding'); + header('Content-Encoding: gzip'); + $qrcode = gzencode($qrcode ,9); +} +echo $qrcode; + + diff --git a/vendor/chillerlan/php-qrcode/examples/text.php b/vendor/chillerlan/php-qrcode/examples/text.php new file mode 100644 index 000000000..9bdf154f0 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/text.php @@ -0,0 +1,68 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + +// custom values +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => 'A', // dark (true) + 6 => 'a', // light (false) + // alignment + 2560 => 'B', + 10 => 'b', + // timing + 3072 => 'C', + 12 => 'c', + // format + 3584 => 'D', + 14 => 'd', + // version + 4096 => 'E', + 16 => 'e', + // data + 1024 => 'F', + 4 => 'f', + // darkmodule + 512 => 'G', + // separator + 8 => 'h', + // quietzone + 18 => 'i', + ], +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + + + + diff --git a/vendor/chillerlan/php-qrcode/phpdoc.xml b/vendor/chillerlan/php-qrcode/phpdoc.xml new file mode 100644 index 000000000..d191e98ee --- /dev/null +++ b/vendor/chillerlan/php-qrcode/phpdoc.xml @@ -0,0 +1,15 @@ + + + + public/docs + + + public/docs + + + src + + +