Compare commits
11 Commits
d45ebbea70
...
ae1f94fd08
Author | SHA1 | Date | |
---|---|---|---|
|
ae1f94fd08 | ||
|
446158b32d | ||
|
38ccc935ee | ||
|
55fd19672d | ||
|
34ec98fa81 | ||
|
3c6fbcde2f | ||
|
e013ef7abe | ||
|
b4ef98673f | ||
|
dfe393384c | ||
|
020c3274e1 | ||
|
1503b0dfc8 |
|
@ -4,11 +4,16 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## Unreleased
|
||||
## 2.0.1 - 2023-07-08
|
||||
|
||||
### Added
|
||||
|
||||
* Indonesian localization
|
||||
* Basque localization
|
||||
|
||||
### Changed
|
||||
|
||||
* Update dependencies
|
||||
|
||||
## 2.0.0 - 2022-06-07
|
||||
|
||||
|
@ -23,7 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
* Output generated QR code with `data:` URI
|
||||
* Change the QR code generation library
|
||||
* Use less.php instead of lesserphp
|
||||
* Use the prefers-color-scheme CSS feature to let the client choose its prefered theme (dark/light)
|
||||
* Use the prefers-color-scheme CSS feature to let the client choose its preferred theme (dark/light)
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ A LibreQR instance is available at <https://qr.antopie.org>.
|
|||
|
||||
### Generic
|
||||
|
||||
Just place this source code in a Web server with PHP7.4+, extensions `gd`, `mbstring` and `iconv`, and writing rights on the `css/` directory.
|
||||
Just place this source code in a Web server with PHP8.0+, extensions `gd`, `mbstring` and `iconv`, and writing rights on the `css/` directory.
|
||||
|
||||
#### Security hardening
|
||||
|
||||
|
@ -33,7 +33,6 @@ There is [a package](https://code.antopie.org/miraty/qr_ynh/) for [YunoHost](htt
|
|||
For historical reasons, LibreQR is technically named `qr` in YunoHost.
|
||||
|
||||
You can install it from the WebAdmin or with this command:
|
||||
|
||||
```
|
||||
sudo yunohost app install qr
|
||||
```
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
// LIBREQR SETTINGS
|
||||
|
||||
// Theme's directory name
|
||||
define("THEME", "libreqr");
|
||||
define("THEME", "chapril");
|
||||
|
||||
// Language used if those requested by the user are not available
|
||||
define("DEFAULT_LOCALE", "en");
|
||||
define("DEFAULT_LOCALE", "fr");
|
||||
|
||||
// Will be printed at the bottom of the interface
|
||||
define("CUSTOM_TEXT_ENABLED", false);
|
||||
define("CUSTOM_TEXT", "This LibreQR instance is hosted by <a href='https://foo.example/'>foo</a>.");
|
||||
define("CUSTOM_TEXT_ENABLED", true);
|
||||
define("CUSTOM_TEXT", "Ce service est fourni par l'association Chapril. Le code source de ce service est disponible <a href='https://forge.april.org/Algov/qrcode.chapril.org'>ici</a>.");
|
||||
|
||||
// Default values
|
||||
define("DEFAULT_REDUNDANCY", "high");
|
||||
|
|
33
index.php
|
@ -10,7 +10,7 @@ use Endroid\QrCode\Color\Color;
|
|||
require "config.inc.php";
|
||||
require "vendor/autoload.php";
|
||||
|
||||
define("LIBREQR_VERSION", "2.0.0");
|
||||
define("LIBREQR_VERSION", "2.0.1");
|
||||
|
||||
// Defines the locale to be used
|
||||
$locale = DEFAULT_LOCALE;
|
||||
|
@ -166,14 +166,43 @@ $cssFileName = Less_Cache::Get(array("style.less" => ""), $options, $colorScheme
|
|||
foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
||||
echo ' <link rel="icon" type="image/png" href="themes/' . THEME . '/icons/' . $dimFav . '.png" sizes="' . $dimFav . 'x' . $dimFav . '">' . "\n";
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="/themes/chapril/chapril-banner.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="chapril-banniere-Nav">
|
||||
<div class="chapril-banniere-Logo" aria-hidden="true">
|
||||
<a href="https://www.chapril.org"><img alt="" src="/themes/chapril/chapril-banner-logo.png"/></a>
|
||||
</div>
|
||||
<div class="chapril-banniere-Menu" aria-hidden="true">
|
||||
<details>
|
||||
<summary>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</summary>
|
||||
<div><a href="https://www.chapril.org/">Accueil Chapril</a></div>
|
||||
<div><a href="https://www.chapril.org/services.html">Services libres</a></div>
|
||||
<div><a href="https://pouet.april.org/@aprilorg">Nous suivre</a></div>
|
||||
<div><a href="https://www.chapril.org/cgu.html">CGU</a></div>
|
||||
<div><a href="https://www.chapril.org/a-propos.html">Mentions légales</a></div>
|
||||
<div><a href="https://www.chapril.org/contact.html">Nous contacter</a></div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://www.chapril.org/" target="_blank">Accueil Chapril</a></div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://www.chapril.org/services.html" target="_blank">Services libres</a></div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://pouet.april.org/@aprilorg" target="_blank">Nous suivre</a></div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://www.chapril.org/cgu.html" target="_blank">CGU</a></div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://www.chapril.org/a-propos.html" target="_blank">Mentions légales</a></div>
|
||||
<div class="chapril-banniere-Entree"><a href="https://www.chapril.org/contact.html" target="_blank">Nous contacter</a></div>
|
||||
</nav>
|
||||
|
||||
|
||||
<header>
|
||||
<a id="linkTitles" href="./">
|
||||
<img alt="" id="logo" src="themes/chapril/logo-dark.png">
|
||||
<div id="titles">
|
||||
<h1>LibreQR</h1>
|
||||
<h1>QrCodeChaprilOrg</h1>
|
||||
<h2><?= $loc['subtitle'] ?></h2>
|
||||
</div>
|
||||
</a>
|
||||
|
|
|
@ -14,7 +14,7 @@ $loc = array(
|
|||
|
||||
'help_content' => "
|
||||
<p>You can encode whatever text you want.</p>
|
||||
<p>Software which decodes these QR codes could suggest to open them with dedicated software, depending on their <a href='https://en.wikipedia.org/wiki/List_of_URI_schemes' hreflang='en' rel='help external noreferrer'>URI scheme</a>.</p>
|
||||
<p>Software decoding these QR codes could suggest to open them with dedicated software, depending on their <a href='https://en.wikipedia.org/wiki/List_of_URI_schemes' hreflang='en' rel='help external noreferrer'>URI scheme</a>.</p>
|
||||
<p>For instance, to open a webpage: <code>https://www.example/</code></p>
|
||||
<p>To send an email: <code>mailto:contact@email.example</code></p>
|
||||
<p>To share geographic coordinates: <code>geo:48.867564,2.364057</code></p>
|
||||
|
@ -33,10 +33,10 @@ $loc = array(
|
|||
|
||||
'metaText_qr' => "
|
||||
<h3>What's a QR code?</h3>
|
||||
A QR code is a 2 dimensional barcode in which text is written in binary. It can be decoded with a device equipped with a photo sensor and an adequate software.
|
||||
A QR code is a 2 dimensional barcode in which text is written in binary. It can be decoded with a device equipped with a photo sensor and adequate software.
|
||||
<a href='https://en.wikipedia.org/wiki/QR_code' hreflang='en' rel='help external noreferrer'>QR code on Wikipedia</a>.
|
||||
",
|
||||
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " is a free software whose <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>source code</a> is available under the terms of the <abbr title='GNU Affero General Public License version 3 or any later version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
|
||||
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " is free software whose <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>source code</a> is available under the terms of the <abbr title='GNU Affero General Public License version 3 or any later version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
|
||||
|
||||
'error_generation' => "An error occurred while generating the QR code. Try with different parameters.",
|
||||
);
|
||||
|
|
42
locales/eu.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php // This file is part of LibreQR, which is distributed under the GNU AGPLv3+ license
|
||||
$loc = array(
|
||||
'subtitle' => "QR kode sortzailea",
|
||||
'description' => "Sortu QR kodeak nahieran. Aukeratu edukia, neurria, kolorea…",
|
||||
|
||||
'label_content' => "Kodetzeko testua",
|
||||
'label_redundancy' => "Erredundantzia-tasa",
|
||||
'label_margin' => "Marjinaren tamaina",
|
||||
'label_size' => "Irudiaren neurria",
|
||||
'label_bgColor' => "Hondoaren kolorea",
|
||||
'label_fgColor' => "Kolore nagusia",
|
||||
|
||||
'placeholder' => "Sartu QR kodean kodetzeko testua",
|
||||
|
||||
'help_content' => "
|
||||
<p>Nahi duzun testua kodetu dezakezu.</p>
|
||||
<p>QR kode horiek deskodetzen dituen softwareak software dedikatuarekin irekitzea iradoki lezake, <a href='https://en.wikipedia.org/wiki/List_of_URI_schemes' hreflang='en' rel='help external noreferrer'>URI eskema</a>ren arabera.</p>
|
||||
<p>Adibidez, webgune bat irekitzeko: <code>https://www.adibidea.eus/</code></p>
|
||||
<p>ePosta bidaltzeko: <code>mailto:lur_axpe@adibidea.eus</code></p>
|
||||
<p>Koordenatu geografikoak partekatzeko: <code>geo:42.895367,-2.167805</code></p>",
|
||||
'help_redundancy' => "Erredundantzia QR kodearen informazioa bikoiztean datza, deskodetzean akatsak zuzentzeko. Tasa altuagoak QR kode handiagoa sortuko du, baina behar bezala deskodetzeko aukera handiagoa izango du.
|
||||
",
|
||||
'help_margin' => "QR kodearen inguruko banda zuriaren pixel kopurua.",
|
||||
'help_size' => "Irudiaren zabalera eta altuera pixeletan, marjinarik gabe.",
|
||||
|
||||
'button_create' => "Sortu",
|
||||
'button_download' => "Gorde QR kodea",
|
||||
|
||||
'title_showOnlyQR' => "Erakutsi QR kode hau bakarrik",
|
||||
|
||||
'alt_QR_before' => 'QR kodearen esanahia "',
|
||||
'alt_QR_after' => '"',
|
||||
|
||||
'metaText_qr' => "
|
||||
<h3>Zer da QR kode bat?</h3>
|
||||
QR kodea bi dimentsioko barra-kodea da, testua bitarrean idatzita duena. Argazki-sentsore bat eta software egokia dituen gailu batekin deskodetzen da.
|
||||
<a href='https://eu.wikipedia.org/wiki/QR_kode' hreflang='eu' rel='help external noreferrer'>QR kodea Wikipedian</a>.
|
||||
",
|
||||
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " software librea da, eta <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>iturburu-kodea</a> <abbr title='GNU Affero Lizentzia Publiko Orokorraren 3. bertsioaren edo ondorengo edozein bertsio'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>ren arabera dago eskuragarri.",
|
||||
|
||||
'error_generation' => "Errorea gertatu da QR kodea sortzerakoan. Saiatu berriro parametro desberdinak erabiliz.",
|
||||
);
|
BIN
themes/chapril/chapril-banner-logo.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
162
themes/chapril/chapril-banner.css
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
____ _ _ _ _ ____ ____ ____
|
||||
/ ___| |__ __ _ _ __ _ __(_) | | |__ __ _ _ __ _ __ ___ _ __ / ___/ ___/ ___|
|
||||
| | | '_ \ / _` | '_ \| '__| | | | '_ \ / _` | '_ \| '_ \ / _ \ '__| | | \___ \___ \
|
||||
| |___| | | | (_| | |_) | | | | | | |_) | (_| | | | | | | | __/ | | |___ ___) |__) |
|
||||
\____|_| |_|\__,_| .__/|_| |_|_| |_.__/ \__,_|_| |_|_| |_|\___|_| \____|____/____/
|
||||
|_|
|
||||
*/
|
||||
|
||||
|
||||
/********************************
|
||||
* Ajustement global
|
||||
*******************************/
|
||||
|
||||
body {
|
||||
margin-top: 0;
|
||||
padding-top: 42px !important;
|
||||
}
|
||||
|
||||
|
||||
/********************************
|
||||
* Classes .chapril-banniere-
|
||||
*******************************/
|
||||
|
||||
.chapril-banniere-Entree {
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.chapril-banniere-Logo {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.chapril-banniere-Logo a {
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.chapril-banniere-Logo img {
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chapril-banniere-Nav {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
min-height: 42px;
|
||||
background-color: #005184;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
.chapril-banniere-Nav a, .chapril-banniere-Nav a:visited {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.chapril-banniere-Nav a:hover {
|
||||
color: #ff9759;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
|
||||
.chapril-banniere-Entree {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chapril-banniere-Logo {
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.chapril-banniere-Logo a {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary {
|
||||
height: 26px;
|
||||
width: 30px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 12px;
|
||||
border-radius: 2px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
box-sizing: border-box;
|
||||
border-color: #fff;
|
||||
padding-left: 4px;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary span {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
width: 20px;
|
||||
height: 2px;
|
||||
border-radius: 2px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary:hover {
|
||||
border-color: #ff9759;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu summary:hover span {
|
||||
background-color: #ff9759;
|
||||
}
|
||||
|
||||
.chapril-banniere-Menu div {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
text-align: center;
|
||||
background-color: #153a6a;
|
||||
border-top: 1px solid #005184;
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.chapril-banniere-Nav {
|
||||
display: block;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/************************************
|
||||
* Adaptation pour certains services
|
||||
************************************
|
||||
|
||||
/* Dokuwiki. */
|
||||
#dokuwiki__usertools {
|
||||
top: 43px !important;
|
||||
}
|
||||
|
||||
/* PAD. */
|
||||
#editorcontainerbox {
|
||||
top: 43px !important;
|
||||
}
|
BIN
themes/chapril/icons/128.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
themes/chapril/icons/16.png
Normal file
After Width: | Height: | Size: 1005 B |
BIN
themes/chapril/icons/192.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
themes/chapril/icons/256.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
themes/chapril/icons/32.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
themes/chapril/icons/384.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
themes/chapril/icons/48.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
themes/chapril/icons/512.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
themes/chapril/icons/64.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
themes/chapril/icons/96.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
themes/chapril/icons/source.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
themes/chapril/logo-dark.png
Normal file
After Width: | Height: | Size: 62 KiB |
1
themes/chapril/logo-light.png
Symbolic link
|
@ -0,0 +1 @@
|
|||
logo-dark.png
|
6
themes/chapril/logo.less
Normal file
|
@ -0,0 +1,6 @@
|
|||
:root{
|
||||
#logo{
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
}
|
36
themes/chapril/theme.php
Executable file
|
@ -0,0 +1,36 @@
|
|||
<?php // This file is part of LibreQR, which is distributed under the GNU AGPLv3+ license
|
||||
|
||||
// List icons dimensions
|
||||
$themeDimensionsIcons = array(16, 32, 48, 64, 96, 128, 192, 256, 384, 512);
|
||||
|
||||
$colorScheme = array(
|
||||
// Light theme
|
||||
"text-light" => "white",
|
||||
"bg-light" => "#67a3f2", // Must be a long hexadecimal color
|
||||
"bgField-light" => "#2e5281",
|
||||
"bgHelp-light" => "#2e5281",
|
||||
"bgTextarea-light" => "#FFFFFF",
|
||||
"textareaText-light" => "black",
|
||||
"textareaPlaceholder-light" => "grey",
|
||||
"border-light" => "#67a3f2",
|
||||
"borderHover-light" => "white",
|
||||
"borderFocus-light" => "white",
|
||||
"borderHelp-light" => "white",
|
||||
"borderQr-light" => "white",
|
||||
// Dark theme
|
||||
"text-dark" => "white",
|
||||
"bg-dark" => "#67a3f2", // Must be a long hexadecimal color
|
||||
"bgField-dark" => "#2e5281",
|
||||
"bgHelp-dark" => "#2e5281",
|
||||
"bgTextarea-dark" => "#FFFFFF",
|
||||
"textareaText-dark" => "black",
|
||||
"textareaPlaceholder-dark" => "grey",
|
||||
"border-dark" => "#67a3f2",
|
||||
"borderWidth-dark" => "2px",
|
||||
"borderHover-dark" => "white",
|
||||
"borderHoverWidth-dark" => "3px",
|
||||
"borderFocus-dark" => "white",
|
||||
"borderFocusWidth-dark" => "4px",
|
||||
"borderHelp-dark" => "white",
|
||||
"borderQr-dark" => "white",
|
||||
);
|
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 727 B |
|
@ -1,259 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg height="16" width="16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<rect fill="#000" height="1" width="1" x="0" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="1" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="5" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="0" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="1" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="1" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="1" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="11" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="1" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="1" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="1" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="2" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="2" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="2" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="2" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="2" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="2" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="3" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="3" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="4" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="4" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="6" y="5" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="5" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="11" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="5" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="5" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="5" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="1" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="5" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="6" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="6" />
|
||||
<rect fill="#fff" height="1" width="1" x="11" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="6" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="6" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="6" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="7" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="7" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="1" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="5" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="8" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="8" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="1" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="9" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="9" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="5" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="9" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="9" />
|
||||
<rect fill="#fff" height="1" width="1" x="11" y="9" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="9" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="6" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="10" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="10" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="6" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="11" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="11" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="6" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="10" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="12" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="12" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="7" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="8" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="9" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="12" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="13" y="13" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="13" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="1" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="2" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="3" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="4" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="5" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="11" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="14" />
|
||||
<rect fill="#fff" height="1" width="1" x="14" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="14" />
|
||||
<rect fill="#000" height="1" width="1" x="0" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="1" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="2" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="3" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="4" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="5" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="6" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="7" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="8" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="9" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="10" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="11" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="12" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="13" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="14" y="15" />
|
||||
<rect fill="#000" height="1" width="1" x="15" y="15" />
|
||||
</svg>
|
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 163 B |
|
@ -1,7 +0,0 @@
|
|||
|
||||
:root {
|
||||
// base64 -w 0 logo-light.png
|
||||
--logo-light: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAABlBMVEX///8AAABVwtN+AAAAWElEQVQoz43O0RHAMAgCUDZg/y3ZgKJtP8PF/LzkiApcFG3IVgVICB0cqCPH368jMvCffsLuPWMLmOQ+FMBxNqvgXCZ8xixGsSNppWsF33hFaLjD27Xioh5ZH8ftcymlGAAAAABJRU5ErkJggg==");
|
||||
// base64 -w 0 logo-dark.png
|
||||
--logo-dark: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAABlBMVEX///8AAABVwtN+AAAAXklEQVQoz43SsRHAIAxDUW3g/bfUBoqckDL/AgWvMFgcKGcIYCkjDSJ2JgwvhhFHZ9cn2vDt/oUNvkcS3MpNRuh0ew6iyyYjbDCPGa2+WxL8lCN6vZYy+nBxED/+xgWM9DYk64ncIgAAAABJRU5ErkJggg==");
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php // This file is part of LibreQR, which is distributed under the GNU AGPLv3+ license
|
||||
|
||||
// List icons dimensions
|
||||
$themeDimensionsIcons = array(16, 32, 48, 64, 96, 128, 192, 256, 384, 512);
|
||||
|
||||
$colorScheme = array(
|
||||
// Light theme
|
||||
"text-light" => "black",
|
||||
"bg-light" => "#ffffff", // Must be a long hexadecimal color
|
||||
"bgField-light" => "white",
|
||||
"bgHelp-light" => "white",
|
||||
"bgTextarea-light" => "white",
|
||||
"textareaText-light" => "black",
|
||||
"textareaPlaceholder-light" => "#868686",
|
||||
"border-light" => "black",
|
||||
"borderHover-light" => "black",
|
||||
"borderFocus-light" => "black",
|
||||
"borderHelp-light" => "black",
|
||||
"borderQr-light" => "black",
|
||||
// Dark theme
|
||||
"text-dark" => "white",
|
||||
"bg-dark" => "#000000", // Must be a long hexadecimal color
|
||||
"bgField-dark" => "#000000",
|
||||
"bgHelp-dark" => "#000000",
|
||||
"bgTextarea-dark" => "#000000",
|
||||
"textareaText-dark" => "white",
|
||||
"textareaPlaceholder-dark" => "#bababa",
|
||||
"border-dark" => "white",
|
||||
"borderWidth-dark" => "2px",
|
||||
"borderHover-dark" => "white",
|
||||
"borderHoverWidth-dark" => "3px",
|
||||
"borderFocus-dark" => "white",
|
||||
"borderFocusWidth-dark" => "4px",
|
||||
"borderHelp-dark" => "white",
|
||||
"borderQr-dark" => "white",
|
||||
);
|
19
vendor/autoload.php
vendored
|
@ -3,10 +3,23 @@
|
|||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
exit(1);
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit6bb82695b2f28e8ee61f74ae2d5c5202::getLoader();
|
||||
return ComposerAutoloaderInitd4957e04ba4dff37d0ecbf0a4b59e14a::getLoader();
|
||||
|
|
6
vendor/bacon/bacon-qr-code/composer.json
vendored
|
@ -34,5 +34,11 @@
|
|||
"allow-plugins": {
|
||||
"ocramius/package-versions": true
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
"exclude": [
|
||||
"/test",
|
||||
"/phpunit.xml.dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
13
vendor/bacon/bacon-qr-code/phpunit.xml.dist
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="BaconQrCode Tests">
|
||||
<directory>./test</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
|
@ -89,6 +89,9 @@ final class CharacterSetEci extends AbstractEnum
|
|||
*/
|
||||
private static $nameToEci;
|
||||
|
||||
/**
|
||||
* @param int[] $values
|
||||
*/
|
||||
public function __construct(array $values, string ...$otherEncodingNames)
|
||||
{
|
||||
$this->values = $values;
|
||||
|
|
|
@ -62,7 +62,7 @@ class FormatInformation
|
|||
/**
|
||||
* Offset i holds the number of 1 bits in the binary representation of i.
|
||||
*
|
||||
* @var array
|
||||
* @var int[]
|
||||
*/
|
||||
private const BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4];
|
||||
|
||||
|
|
|
@ -42,6 +42,9 @@ final class Mode extends AbstractEnum
|
|||
*/
|
||||
private $bits;
|
||||
|
||||
/**
|
||||
* @param int[] $characterCountBitsForVersions
|
||||
*/
|
||||
protected function __construct(array $characterCountBitsForVersions, int $bits)
|
||||
{
|
||||
$this->characterCountBitsForVersions = $characterCountBitsForVersions;
|
||||
|
|
|
@ -37,7 +37,7 @@ final class Encoder
|
|||
/**
|
||||
* Codec cache.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string,ReedSolomonCodec>
|
||||
*/
|
||||
private static $codecs = [];
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ final class SvgImageBackEnd implements ImageBackEndInterface
|
|||
$this->xmlWriter->writeAttribute('stop-color', $this->getColorString($startColor));
|
||||
|
||||
if ($startColor instanceof Alpha) {
|
||||
$this->xmlWriter->writeAttribute('stop-opacity', $startColor->getAlpha());
|
||||
$this->xmlWriter->writeAttribute('stop-opacity', (string) $startColor->getAlpha());
|
||||
}
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
|
@ -344,7 +344,7 @@ final class SvgImageBackEnd implements ImageBackEndInterface
|
|||
$this->xmlWriter->writeAttribute('stop-color', $this->getColorString($endColor));
|
||||
|
||||
if ($endColor instanceof Alpha) {
|
||||
$this->xmlWriter->writeAttribute('stop-opacity', $endColor->getAlpha());
|
||||
$this->xmlWriter->writeAttribute('stop-opacity', (string) $endColor->getAlpha());
|
||||
}
|
||||
|
||||
$this->xmlWriter->endElement();
|
||||
|
|
|
@ -41,7 +41,7 @@ final class EdgeIterator implements IteratorAggregate
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Edge[]
|
||||
* @return Traversable<Edge>
|
||||
*/
|
||||
public function getIterator() : Traversable
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ final class EllipticArc implements OperationInterface
|
|||
/**
|
||||
* @return Curve[]
|
||||
*/
|
||||
private function createCurves(float $fromX, $fromY) : array
|
||||
private function createCurves(float $fromX, float $fromY) : array
|
||||
{
|
||||
$xAngle = deg2rad($this->xAxisAngle);
|
||||
list($centerX, $centerY, $radiusX, $radiusY, $startAngle, $deltaAngle) =
|
||||
|
|
|
@ -17,10 +17,16 @@ use BaconQrCode\Writer;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Spatie\Snapshots\MatchesSnapshots;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
final class ImagickRenderingTest extends TestCase
|
||||
{
|
||||
use MatchesSnapshots;
|
||||
|
||||
/**
|
||||
* @requires extension imagick
|
||||
*/
|
||||
public function testGenericQrCode() : void
|
||||
{
|
||||
$renderer = new ImageRenderer(
|
||||
|
@ -35,6 +41,9 @@ final class ImagickRenderingTest extends TestCase
|
|||
unlink($tempName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension imagick
|
||||
*/
|
||||
public function testIssue79() : void
|
||||
{
|
||||
$eye = SquareEye::instance();
|
||||
|
|
10
vendor/bin/lessc
vendored
|
@ -108,10 +108,12 @@ if (PHP_VERSION_ID < 80000) {
|
|||
}
|
||||
}
|
||||
|
||||
if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
|
||||
include("phpvfscomposer://" . __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc');
|
||||
exit(0);
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc');
|
||||
}
|
||||
}
|
||||
|
||||
include __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc';
|
||||
return include __DIR__ . '/..'.'/wikimedia/less.php/bin/lessc';
|
||||
|
|
105
vendor/composer/ClassLoader.php
vendored
|
@ -42,35 +42,37 @@ namespace Composer\Autoload;
|
|||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var ?string */
|
||||
/** @var \Closure(string):void */
|
||||
private static $includeFile;
|
||||
|
||||
/** @var string|null */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, int>>
|
||||
* @var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<int, string>>
|
||||
* @var array<string, list<string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, string[]>>
|
||||
* List of PSR-0 prefixes
|
||||
*
|
||||
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||
*
|
||||
* @var array<string, array<string, list<string>>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
|
@ -78,8 +80,7 @@ class ClassLoader
|
|||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
* @psalm-var array<string, string>
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
|
@ -87,29 +88,29 @@ class ClassLoader
|
|||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var bool[]
|
||||
* @psalm-var array<string, bool>
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var ?string */
|
||||
/** @var string|null */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var self[]
|
||||
* @var array<string, self>
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param ?string $vendorDir
|
||||
* @param string|null $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
self::initializeIncludeClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
|
@ -121,8 +122,7 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, array<int, string>>
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
|
@ -130,8 +130,7 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
|
@ -139,8 +138,7 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
|
@ -148,8 +146,7 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* @return string[] Array of classname => path
|
||||
* @psalm-return array<string, string>
|
||||
* @return array<string, string> Array of classname => path
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
|
@ -157,8 +154,7 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string[] $classMap Class to filename map
|
||||
* @psalm-param array<string, string> $classMap
|
||||
* @param array<string, string> $classMap Class to filename map
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -176,23 +172,24 @@ class ClassLoader
|
|||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 root directories
|
||||
* @param list<string>|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
$paths
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -201,19 +198,19 @@ class ClassLoader
|
|||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +220,7 @@ class ClassLoader
|
|||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
|
@ -232,17 +229,18 @@ class ClassLoader
|
|||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
$paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
|
@ -252,18 +250,18 @@ class ClassLoader
|
|||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +271,7 @@ class ClassLoader
|
|||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 base directories
|
||||
* @param list<string>|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -291,7 +289,7 @@ class ClassLoader
|
|||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
|
@ -425,7 +423,8 @@ class ClassLoader
|
|||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
$includeFile = self::$includeFile;
|
||||
$includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -476,9 +475,9 @@ class ClassLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
* @return array<string, self>
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
|
@ -555,6 +554,14 @@ class ClassLoader
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private static function initializeIncludeClosure()
|
||||
{
|
||||
if (self::$includeFile !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -564,9 +571,9 @@ class ClassLoader
|
|||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
* @private
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
self::$includeFile = \Closure::bind(static function($file) {
|
||||
include $file;
|
||||
}, null, null);
|
||||
}
|
||||
}
|
||||
|
|
15
vendor/composer/InstalledVersions.php
vendored
|
@ -98,7 +98,7 @@ class InstalledVersions
|
|||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
||||
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class InstalledVersions
|
|||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$constraint = $parser->parseConstraints((string) $constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
|
@ -328,7 +328,9 @@ class InstalledVersions
|
|||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require $vendorDir.'/composer/installed.php';
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = $required;
|
||||
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||
self::$installed = $installed[count($installed) - 1];
|
||||
}
|
||||
|
@ -340,12 +342,17 @@ class InstalledVersions
|
|||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = require __DIR__ . '/installed.php';
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$installed !== array()) {
|
||||
$installed[] = self::$installed;
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
|
|
8
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit6bb82695b2f28e8ee61f74ae2d5c5202
|
||||
class ComposerAutoloaderInitd4957e04ba4dff37d0ecbf0a4b59e14a
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -24,12 +24,12 @@ class ComposerAutoloaderInit6bb82695b2f28e8ee61f74ae2d5c5202
|
|||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6bb82695b2f28e8ee61f74ae2d5c5202', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd4957e04ba4dff37d0ecbf0a4b59e14a', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6bb82695b2f28e8ee61f74ae2d5c5202', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd4957e04ba4dff37d0ecbf0a4b59e14a', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
|
|
10
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202
|
||||
class ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'E' =>
|
||||
|
@ -54,10 +54,10 @@ class ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$prefixesPsr0;
|
||||
$loader->classMap = ComposerStaticInit6bb82695b2f28e8ee61f74ae2d5c5202::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a::$prefixDirsPsr4;
|
||||
$loader->prefixesPsr0 = ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a::$prefixesPsr0;
|
||||
$loader->classMap = ComposerStaticInitd4957e04ba4dff37d0ecbf0a4b59e14a::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
84
vendor/composer/installed.json
vendored
|
@ -2,17 +2,17 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
"version": "2.0.7",
|
||||
"version_normalized": "2.0.7.0",
|
||||
"version": "2.0.8",
|
||||
"version_normalized": "2.0.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Bacon/BaconQrCode.git",
|
||||
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c"
|
||||
"reference": "8674e51bb65af933a5ffaf1c308a660387c35c22"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
|
||||
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
|
||||
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22",
|
||||
"reference": "8674e51bb65af933a5ffaf1c308a660387c35c22",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -29,7 +29,7 @@
|
|||
"suggest": {
|
||||
"ext-imagick": "to generate QR code images"
|
||||
},
|
||||
"time": "2022-03-14T02:02:36+00:00",
|
||||
"time": "2022-12-07T17:46:57+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -53,30 +53,33 @@
|
|||
"homepage": "https://github.com/Bacon/BaconQrCode",
|
||||
"support": {
|
||||
"issues": "https://github.com/Bacon/BaconQrCode/issues",
|
||||
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7"
|
||||
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8"
|
||||
},
|
||||
"install-path": "../bacon/bacon-qr-code"
|
||||
},
|
||||
{
|
||||
"name": "dasprid/enum",
|
||||
"version": "1.0.3",
|
||||
"version_normalized": "1.0.3.0",
|
||||
"version": "1.0.4",
|
||||
"version_normalized": "1.0.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DASPRiD/Enum.git",
|
||||
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2"
|
||||
"reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2",
|
||||
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2",
|
||||
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
|
||||
"reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1 <9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7 | ^8 | ^9",
|
||||
"squizlabs/php_codesniffer": "^3.4"
|
||||
"squizlabs/php_codesniffer": "*"
|
||||
},
|
||||
"time": "2020-10-02T16:03:48+00:00",
|
||||
"time": "2023-03-01T18:44:03+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -103,33 +106,36 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/DASPRiD/Enum/issues",
|
||||
"source": "https://github.com/DASPRiD/Enum/tree/1.0.3"
|
||||
"source": "https://github.com/DASPRiD/Enum/tree/1.0.4"
|
||||
},
|
||||
"install-path": "../dasprid/enum"
|
||||
},
|
||||
{
|
||||
"name": "endroid/qr-code",
|
||||
"version": "4.4.9",
|
||||
"version_normalized": "4.4.9.0",
|
||||
"version": "4.8.2",
|
||||
"version_normalized": "4.8.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/endroid/qr-code.git",
|
||||
"reference": "bf087fa1e93a1b7310e2d94d187e26ae51db199d"
|
||||
"reference": "2436c2333a3931c95e2b96eb82f16f53143d6bba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/endroid/qr-code/zipball/bf087fa1e93a1b7310e2d94d187e26ae51db199d",
|
||||
"reference": "bf087fa1e93a1b7310e2d94d187e26ae51db199d",
|
||||
"url": "https://api.github.com/repos/endroid/qr-code/zipball/2436c2333a3931c95e2b96eb82f16f53143d6bba",
|
||||
"reference": "2436c2333a3931c95e2b96eb82f16f53143d6bba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"bacon/bacon-qr-code": "^2.0.5",
|
||||
"php": "^7.4||^8.0"
|
||||
"php": "^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"endroid/quality": "dev-master",
|
||||
"ext-gd": "*",
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.4",
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.4||^2.0.2",
|
||||
"setasign/fpdf": "^1.8.2"
|
||||
},
|
||||
"suggest": {
|
||||
|
@ -138,7 +144,7 @@
|
|||
"roave/security-advisories": "Makes sure package versions with known security issues are not installed",
|
||||
"setasign/fpdf": "Enables you to use the PDF writer"
|
||||
},
|
||||
"time": "2022-05-10T07:25:08+00:00",
|
||||
"time": "2023-03-30T18:46:02+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -172,7 +178,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/endroid/qr-code/issues",
|
||||
"source": "https://github.com/endroid/qr-code/tree/4.4.9"
|
||||
"source": "https://github.com/endroid/qr-code/tree/4.8.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -184,30 +190,31 @@
|
|||
},
|
||||
{
|
||||
"name": "wikimedia/less.php",
|
||||
"version": "v3.1.0",
|
||||
"version_normalized": "3.1.0.0",
|
||||
"version": "v3.2.1",
|
||||
"version_normalized": "3.2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wikimedia/less.php.git",
|
||||
"reference": "a486d78b9bd16b72f237fc6093aa56d69ce8bd13"
|
||||
"reference": "0d5b30ba792bdbf8991a646fc9c30561b38a5559"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/wikimedia/less.php/zipball/a486d78b9bd16b72f237fc6093aa56d69ce8bd13",
|
||||
"reference": "a486d78b9bd16b72f237fc6093aa56d69ce8bd13",
|
||||
"url": "https://api.github.com/repos/wikimedia/less.php/zipball/0d5b30ba792bdbf8991a646fc9c30561b38a5559",
|
||||
"reference": "0d5b30ba792bdbf8991a646fc9c30561b38a5559",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"mediawiki/mediawiki-codesniffer": "34.0.0",
|
||||
"mediawiki/minus-x": "1.0.0",
|
||||
"php-parallel-lint/php-console-highlighter": "0.5.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.2.0",
|
||||
"mediawiki/mediawiki-codesniffer": "40.0.1",
|
||||
"mediawiki/mediawiki-phan-config": "0.12.0",
|
||||
"mediawiki/minus-x": "1.1.1",
|
||||
"php-parallel-lint/php-console-highlighter": "1.0.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.2",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"time": "2020-12-11T19:33:31+00:00",
|
||||
"time": "2023-02-03T06:43:41+00:00",
|
||||
"bin": [
|
||||
"bin/lessc"
|
||||
],
|
||||
|
@ -226,6 +233,10 @@
|
|||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Timo Tijhof",
|
||||
"homepage": "https://timotijhof.net"
|
||||
},
|
||||
{
|
||||
"name": "Josh Schmidt",
|
||||
"homepage": "https://github.com/oyejorge"
|
||||
|
@ -239,7 +250,8 @@
|
|||
"homepage": "https://github.com/Mordred"
|
||||
}
|
||||
],
|
||||
"description": "PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)",
|
||||
"description": "PHP port of the LESS processor",
|
||||
"homepage": "https://gerrit.wikimedia.org/g/mediawiki/libs/less.php",
|
||||
"keywords": [
|
||||
"css",
|
||||
"less",
|
||||
|
@ -250,7 +262,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/wikimedia/less.php/issues",
|
||||
"source": "https://github.com/wikimedia/less.php/tree/v3.1.0"
|
||||
"source": "https://github.com/wikimedia/less.php/tree/v3.2.1"
|
||||
},
|
||||
"install-path": "../wikimedia/less.php"
|
||||
}
|
||||
|
|
28
vendor/composer/installed.php
vendored
|
@ -3,7 +3,7 @@
|
|||
'name' => '__root__',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '5e455c1499d4fba2d9bb825e4db8b58a3a6a595e',
|
||||
'reference' => 'b4ef98673f4ec96aac0c1ff7bda444f72101c479',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
@ -13,43 +13,43 @@
|
|||
'__root__' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '5e455c1499d4fba2d9bb825e4db8b58a3a6a595e',
|
||||
'reference' => 'b4ef98673f4ec96aac0c1ff7bda444f72101c479',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'bacon/bacon-qr-code' => array(
|
||||
'pretty_version' => '2.0.7',
|
||||
'version' => '2.0.7.0',
|
||||
'reference' => 'd70c840f68657ce49094b8d91f9ee0cc07fbf66c',
|
||||
'pretty_version' => '2.0.8',
|
||||
'version' => '2.0.8.0',
|
||||
'reference' => '8674e51bb65af933a5ffaf1c308a660387c35c22',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'dasprid/enum' => array(
|
||||
'pretty_version' => '1.0.3',
|
||||
'version' => '1.0.3.0',
|
||||
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
|
||||
'pretty_version' => '1.0.4',
|
||||
'version' => '1.0.4.0',
|
||||
'reference' => '8e6b6ea76eabbf19ea2bf5b67b98e1860474012f',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../dasprid/enum',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'endroid/qr-code' => array(
|
||||
'pretty_version' => '4.4.9',
|
||||
'version' => '4.4.9.0',
|
||||
'reference' => 'bf087fa1e93a1b7310e2d94d187e26ae51db199d',
|
||||
'pretty_version' => '4.8.2',
|
||||
'version' => '4.8.2.0',
|
||||
'reference' => '2436c2333a3931c95e2b96eb82f16f53143d6bba',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../endroid/qr-code',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'wikimedia/less.php' => array(
|
||||
'pretty_version' => 'v3.1.0',
|
||||
'version' => '3.1.0.0',
|
||||
'reference' => 'a486d78b9bd16b72f237fc6093aa56d69ce8bd13',
|
||||
'pretty_version' => 'v3.2.1',
|
||||
'version' => '3.2.1.0',
|
||||
'reference' => '0d5b30ba792bdbf8991a646fc9c30561b38a5559',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../wikimedia/less.php',
|
||||
'aliases' => array(),
|
||||
|
|
4
vendor/composer/platform_check.php
vendored
|
@ -4,8 +4,8 @@
|
|||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70400)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
|
||||
if (!(PHP_VERSION_ID >= 80000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
|
|
47
vendor/dasprid/enum/.github/workflows/tests.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
name: Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
php-tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php: [8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1]
|
||||
dependency-version: [prefer-stable]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
|
||||
name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }}
|
||||
|
||||
steps:
|
||||
- name: Set git to use LF
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.composer/cache/files
|
||||
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
|
||||
|
||||
- name: Execute tests
|
||||
run: vendor/bin/phpunit
|
||||
|
||||
- name: Code Sniffer
|
||||
run: vendor/bin/phpcs
|
||||
|
2
vendor/dasprid/enum/README.md
vendored
|
@ -1,6 +1,6 @@
|
|||
# PHP 7.1 enums
|
||||
|
||||
[![Build Status](https://travis-ci.org/DASPRiD/Enum.svg?branch=master)](https://travis-ci.org/DASPRiD/Enum)
|
||||
[![Build Status](https://github.com/DASPRiD/Enum/actions/workflows/tests.yml/badge.svg)](https://github.com/DASPRiD/Enum/actions?query=workflow%3Atests)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/DASPRiD/Enum/badge.svg?branch=master)](https://coveralls.io/github/DASPRiD/Enum?branch=master)
|
||||
[![Latest Stable Version](https://poser.pugx.org/dasprid/enum/v/stable)](https://packagist.org/packages/dasprid/enum)
|
||||
[![Total Downloads](https://poser.pugx.org/dasprid/enum/downloads)](https://packagist.org/packages/dasprid/enum)
|
||||
|
|
5
vendor/dasprid/enum/composer.json
vendored
|
@ -14,9 +14,12 @@
|
|||
"enum",
|
||||
"map"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1 <9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7 | ^8 | ^9",
|
||||
"squizlabs/php_codesniffer": "^3.4"
|
||||
"squizlabs/php_codesniffer": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
42
vendor/dasprid/enum/src/EnumMap.php
vendored
|
@ -88,6 +88,31 @@ final class EnumMap implements Serializable, IteratorAggregate
|
|||
$this->values = array_fill(0, count($this->keyUniverse), null);
|
||||
}
|
||||
|
||||
public function __serialize(): array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return [
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->unserialize(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the map types match the supplied ones.
|
||||
*
|
||||
|
@ -261,22 +286,7 @@ final class EnumMap implements Serializable, IteratorAggregate
|
|||
|
||||
public function serialize() : string
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach ($this->values as $ordinal => $value) {
|
||||
if (null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$ordinal] = $this->unmaskNull($value);
|
||||
}
|
||||
|
||||
return serialize([
|
||||
'keyType' => $this->keyType,
|
||||
'valueType' => $this->valueType,
|
||||
'allowNullValues' => $this->allowNullValues,
|
||||
'values' => $values,
|
||||
]);
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($serialized) : void
|
||||
|
|
2
vendor/endroid/qr-code/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright 2020 (c) Jeroen van den Enden
|
||||
Copyright 2022 (c) Jeroen van den Enden
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
50
vendor/endroid/qr-code/README.md
vendored
|
@ -14,13 +14,17 @@ for validating generated QR codes. Further extended with Twig extensions, genera
|
|||
Symfony bundle for easy installation and configuration. Different writers are provided to generate the QR code
|
||||
as PNG, SVG, EPS or in binary format.
|
||||
|
||||
## Sponsored by
|
||||
|
||||
[![Blackfire.io](assets/blackfire.png)](https://www.blackfire.io)
|
||||
|
||||
## Installation
|
||||
|
||||
Use [Composer](https://getcomposer.org/) to install the library. Also make sure you have enabled and configured the
|
||||
[GD extension](https://www.php.net/manual/en/book.image.php) if you want to generate images.
|
||||
|
||||
``` bash
|
||||
$ composer require endroid/qr-code
|
||||
composer require endroid/qr-code
|
||||
```
|
||||
|
||||
## Usage: using the builder
|
||||
|
@ -47,6 +51,7 @@ $result = Builder::create()
|
|||
->labelText('This is the label')
|
||||
->labelFont(new NotoSans(20))
|
||||
->labelAlignment(new LabelAlignmentCenter())
|
||||
->validateResult(false)
|
||||
->build();
|
||||
```
|
||||
|
||||
|
@ -61,11 +66,12 @@ use Endroid\QrCode\Label\Label;
|
|||
use Endroid\QrCode\Logo\Logo;
|
||||
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
|
||||
use Endroid\QrCode\Writer\PngWriter;
|
||||
use Endroid\QrCode\Writer\ValidationException;
|
||||
|
||||
$writer = new PngWriter();
|
||||
|
||||
// Create QR code
|
||||
$qrCode = QrCode::create('Data')
|
||||
$qrCode = QrCode::create('Life is too short to be generating QR codes')
|
||||
->setEncoding(new Encoding('UTF-8'))
|
||||
->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
|
||||
->setSize(300)
|
||||
|
@ -83,6 +89,9 @@ $label = Label::create('Label')
|
|||
->setTextColor(new Color(255, 0, 0));
|
||||
|
||||
$result = $writer->write($qrCode, $logo, $label);
|
||||
|
||||
// Validate the result
|
||||
$writer->validateResult($result, 'Life is too short to be generating QR codes');
|
||||
```
|
||||
|
||||
## Usage: working with results
|
||||
|
@ -104,10 +113,32 @@ $dataUri = $result->getDataUri();
|
|||
|
||||
### Writer options
|
||||
|
||||
Some writers provide writer options. Each available writer option is can be
|
||||
found as a constant prefixed with WRITER_OPTION_ in the writer class.
|
||||
|
||||
* `PdfWriter`
|
||||
* `unit`: unit of measurement (default: mm)
|
||||
* `fpdf`: PDF to place the image in (default: new PDF)
|
||||
* `x`: image offset (default: 0)
|
||||
* `y`: image offset (default: 0)
|
||||
* `PngWriter`
|
||||
* `compression_level`: compression level (0-9, default: -1 = zlib default)
|
||||
* `SvgWriter`
|
||||
* `block_id`: id of the block element for external reference (default: block)
|
||||
* `exclude_xml_declaration`: exclude XML declaration (default: false)
|
||||
* `exclude_svg_width_and_height`: exclude width and height (default: false)
|
||||
* `force_xlink_href`: forces xlink namespace in case of compatibility issues (default: false)
|
||||
* `WebPWriter`
|
||||
* `quality`: image quality (0-100, default: 80)
|
||||
|
||||
You can provide any writer options like this.
|
||||
|
||||
```php
|
||||
use Endroid\QrCode\Writer\SvgWriter;
|
||||
|
||||
$builder->setWriterOptions([SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true]);
|
||||
$builder->setWriterOptions([
|
||||
SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true
|
||||
]);
|
||||
```
|
||||
|
||||
### Encoding
|
||||
|
@ -145,13 +176,14 @@ size can result in additional padding to compensate for the rounding difference.
|
|||
And finally the encoding (default UTF-8 to support large character sets) can be
|
||||
set to `ISO-8859-1` if possible to improve readability.
|
||||
|
||||
## Built-in validation reader
|
||||
## Validating the generated QR code
|
||||
|
||||
You can enable the built-in validation reader (disabled by default) by calling
|
||||
setValidateResult(true). This validation reader does not guarantee that the QR
|
||||
code will be readable by all readers but it helps you provide a minimum level
|
||||
of quality. Take note that the validator can consume quite amount of additional
|
||||
resources and it should be installed separately only if you use it.
|
||||
If you need to be extra sure the QR code you generated is readable and contains
|
||||
the exact data you requested you can enable the validation reader, which is
|
||||
disabled by default. You can do this either via the builder or directly on any
|
||||
writer that supports validation. See the examples above.
|
||||
|
||||
Please note that validation affects performance so only use it in case of problems.
|
||||
|
||||
## Symfony integration
|
||||
|
||||
|
|
BIN
vendor/endroid/qr-code/assets/blackfire.png
vendored
Normal file
After Width: | Height: | Size: 28 KiB |
10
vendor/endroid/qr-code/composer.json
vendored
|
@ -12,15 +12,18 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4||^8.0",
|
||||
"php": "^8.0",
|
||||
"bacon/bacon-qr-code": "^2.0.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-gd": "*",
|
||||
"endroid/quality": "dev-master",
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.4",
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.4||^2.0.2",
|
||||
"setasign/fpdf": "^1.8.2"
|
||||
},
|
||||
"conflict": {
|
||||
"khanamiryan/qrcode-detector-decoder": "^1.0.6"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "Enables you to write PNG images",
|
||||
"khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator",
|
||||
|
@ -41,6 +44,9 @@
|
|||
"sort-packages": true,
|
||||
"preferred-install": {
|
||||
"endroid/*": "source"
|
||||
},
|
||||
"allow-plugins": {
|
||||
"endroid/installer": true
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Endroid\QrCode\Builder;
|
|||
use Endroid\QrCode\Color\ColorInterface;
|
||||
use Endroid\QrCode\Encoding\EncodingInterface;
|
||||
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelInterface;
|
||||
use Endroid\QrCode\Exception\ValidationException;
|
||||
use Endroid\QrCode\Label\Alignment\LabelAlignmentInterface;
|
||||
use Endroid\QrCode\Label\Font\FontInterface;
|
||||
use Endroid\QrCode\Label\Label;
|
||||
|
@ -24,7 +25,7 @@ use Endroid\QrCode\Writer\WriterInterface;
|
|||
class Builder implements BuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var array<mixed>{
|
||||
* @var array<string, mixed>{
|
||||
* data: string,
|
||||
* writer: WriterInterface,
|
||||
* writerOptions: array,
|
||||
|
@ -77,7 +78,7 @@ class Builder implements BuilderInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/** @param array<mixed> $writerOptions */
|
||||
/** @param array<string, mixed> $writerOptions */
|
||||
public function writerOptions(array $writerOptions): BuilderInterface
|
||||
{
|
||||
$this->options['writerOptions'] = $writerOptions;
|
||||
|
@ -216,7 +217,7 @@ class Builder implements BuilderInterface
|
|||
$writer = $this->options['writer'];
|
||||
|
||||
if ($this->options['validateResult'] && !$writer instanceof ValidatingWriterInterface) {
|
||||
throw new \Exception('Unable to validate result with '.get_class($writer));
|
||||
throw ValidationException::createForUnsupportedWriter(strval(get_class($writer)));
|
||||
}
|
||||
|
||||
/** @var QrCode $qrCode */
|
||||
|
@ -242,7 +243,7 @@ class Builder implements BuilderInterface
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function buildObject(string $class, string $optionsPrefix = null)
|
||||
private function buildObject(string $class, string|null $optionsPrefix = null)
|
||||
{
|
||||
/** @var \ReflectionClass<object> $reflectionClass */
|
||||
$reflectionClass = new \ReflectionClass($class);
|
||||
|
|
|
@ -20,7 +20,7 @@ interface BuilderInterface
|
|||
|
||||
public function writer(WriterInterface $writer): BuilderInterface;
|
||||
|
||||
/** @param array<mixed> $writerOptions */
|
||||
/** @param array<string, mixed> $writerOptions */
|
||||
public function writerOptions(array $writerOptions): BuilderInterface;
|
||||
|
||||
public function data(string $data): BuilderInterface;
|
||||
|
|
22
vendor/endroid/qr-code/src/Color/Color.php
vendored
|
@ -6,17 +6,12 @@ namespace Endroid\QrCode\Color;
|
|||
|
||||
final class Color implements ColorInterface
|
||||
{
|
||||
private int $red;
|
||||
private int $green;
|
||||
private int $blue;
|
||||
private int $alpha;
|
||||
|
||||
public function __construct(int $red, int $green, int $blue, int $alpha = 0)
|
||||
{
|
||||
$this->red = $red;
|
||||
$this->green = $green;
|
||||
$this->blue = $blue;
|
||||
$this->alpha = $alpha;
|
||||
public function __construct(
|
||||
private int $red,
|
||||
private int $green,
|
||||
private int $blue,
|
||||
private int $alpha = 0
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRed(): int
|
||||
|
@ -44,6 +39,11 @@ final class Color implements ColorInterface
|
|||
return 1 - $this->alpha / 127;
|
||||
}
|
||||
|
||||
public function getHex(): string
|
||||
{
|
||||
return sprintf('#%02x%02x%02x', $this->red, $this->green, $this->blue);
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -16,6 +16,8 @@ interface ColorInterface
|
|||
|
||||
public function getOpacity(): float;
|
||||
|
||||
public function getHex(): string;
|
||||
|
||||
/** @return array<string, int> */
|
||||
public function toArray(): array;
|
||||
}
|
||||
|
|
|
@ -6,15 +6,12 @@ namespace Endroid\QrCode\Encoding;
|
|||
|
||||
final class Encoding implements EncodingInterface
|
||||
{
|
||||
private string $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
public function __construct(
|
||||
private string $value
|
||||
) {
|
||||
if (!in_array($value, mb_list_encodings())) {
|
||||
throw new \Exception(sprintf('Invalid encoding "%s"', $value));
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
|
|
23
vendor/endroid/qr-code/src/Exception/ValidationException.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Exception;
|
||||
|
||||
final class ValidationException extends \Exception
|
||||
{
|
||||
public static function createForUnsupportedWriter(string $writerClass): self
|
||||
{
|
||||
return new self(sprintf('Unable to validate the result: "%s" does not support validation', $writerClass));
|
||||
}
|
||||
|
||||
public static function createForMissingPackage(string $packageName): self
|
||||
{
|
||||
return new self(sprintf('Please install "%s" or disable image validation', $packageName));
|
||||
}
|
||||
|
||||
public static function createForInvalidData(string $expectedData, string $actualData): self
|
||||
{
|
||||
return new self('The validation reader read "'.$actualData.'" instead of "'.$expectedData.'". Adjust your parameters to increase readability or disable validation.');
|
||||
}
|
||||
}
|
|
@ -8,13 +8,10 @@ use Endroid\QrCode\Label\LabelInterface;
|
|||
|
||||
class LabelImageData
|
||||
{
|
||||
private int $width;
|
||||
private int $height;
|
||||
|
||||
private function __construct(int $width, int $height)
|
||||
{
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
private function __construct(
|
||||
private int $width,
|
||||
private int $height
|
||||
) {
|
||||
}
|
||||
|
||||
public static function createForLabel(LabelInterface $label): self
|
||||
|
|
|
@ -8,31 +8,14 @@ use Endroid\QrCode\Logo\LogoInterface;
|
|||
|
||||
class LogoImageData
|
||||
{
|
||||
private string $data;
|
||||
|
||||
/** @var mixed */
|
||||
private $image;
|
||||
|
||||
private string $mimeType;
|
||||
private int $width;
|
||||
private int $height;
|
||||
private bool $punchoutBackground;
|
||||
|
||||
/** @param mixed $image */
|
||||
private function __construct(
|
||||
string $data,
|
||||
$image,
|
||||
string $mimeType,
|
||||
int $width,
|
||||
int $height,
|
||||
bool $punchoutBackground
|
||||
private string $data,
|
||||
private \GdImage|null $image,
|
||||
private string $mimeType,
|
||||
private int $width,
|
||||
private int $height,
|
||||
private bool $punchoutBackground
|
||||
) {
|
||||
$this->data = $data;
|
||||
$this->image = $image;
|
||||
$this->mimeType = $mimeType;
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
$this->punchoutBackground = $punchoutBackground;
|
||||
}
|
||||
|
||||
public static function createForLogo(LogoInterface $logo): self
|
||||
|
@ -89,10 +72,9 @@ class LogoImageData
|
|||
return $this->data;
|
||||
}
|
||||
|
||||
/** @return mixed */
|
||||
public function getImage()
|
||||
public function getImage(): \GdImage
|
||||
{
|
||||
if (null === $this->image) {
|
||||
if (!$this->image instanceof \GdImage) {
|
||||
throw new \Exception('SVG Images have no image resource');
|
||||
}
|
||||
|
||||
|
@ -126,10 +108,7 @@ class LogoImageData
|
|||
|
||||
private static function detectMimeTypeFromUrl(string $url): string
|
||||
{
|
||||
/** @var mixed $format */
|
||||
$format = PHP_VERSION_ID >= 80000 ? true : 1;
|
||||
|
||||
$headers = get_headers($url, $format);
|
||||
$headers = get_headers($url, true);
|
||||
|
||||
if (!is_array($headers) || !isset($headers['Content-Type'])) {
|
||||
throw new \Exception(sprintf('Content type could not be determined for logo URL "%s"', $url));
|
||||
|
|
16
vendor/endroid/qr-code/src/Label/Font/Font.php
vendored
|
@ -6,18 +6,14 @@ namespace Endroid\QrCode\Label\Font;
|
|||
|
||||
final class Font implements FontInterface
|
||||
{
|
||||
private string $path;
|
||||
private int $size;
|
||||
|
||||
public function __construct(string $path, int $size = 16)
|
||||
{
|
||||
$this->validatePath($path);
|
||||
|
||||
$this->path = $path;
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private string $path,
|
||||
private int $size = 16
|
||||
) {
|
||||
$this->assertValidPath($path);
|
||||
}
|
||||
|
||||
private function validatePath(string $path): void
|
||||
private function assertValidPath(string $path): void
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
throw new \Exception(sprintf('Invalid font path "%s"', $path));
|
||||
|
|
|
@ -6,11 +6,9 @@ namespace Endroid\QrCode\Label\Font;
|
|||
|
||||
final class NotoSans implements FontInterface
|
||||
{
|
||||
private int $size;
|
||||
|
||||
public function __construct(int $size = 16)
|
||||
{
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private int $size = 16
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPath(): string
|
||||
|
|
|
@ -6,11 +6,9 @@ namespace Endroid\QrCode\Label\Font;
|
|||
|
||||
final class OpenSans implements FontInterface
|
||||
{
|
||||
private int $size;
|
||||
|
||||
public function __construct(int $size = 16)
|
||||
{
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private int $size = 16
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPath(): string
|
||||
|
|
20
vendor/endroid/qr-code/src/Label/Label.php
vendored
|
@ -15,24 +15,22 @@ use Endroid\QrCode\Label\Margin\MarginInterface;
|
|||
|
||||
final class Label implements LabelInterface
|
||||
{
|
||||
private string $text;
|
||||
private FontInterface $font;
|
||||
private LabelAlignmentInterface $alignment;
|
||||
private MarginInterface $margin;
|
||||
private ColorInterface $textColor;
|
||||
|
||||
public function __construct(
|
||||
string $text,
|
||||
FontInterface $font = null,
|
||||
LabelAlignmentInterface $alignment = null,
|
||||
MarginInterface $margin = null,
|
||||
ColorInterface $textColor = null
|
||||
private string $text,
|
||||
FontInterface|null $font = null,
|
||||
LabelAlignmentInterface|null $alignment = null,
|
||||
MarginInterface|null $margin = null,
|
||||
ColorInterface|null $textColor = null
|
||||
) {
|
||||
$this->text = $text;
|
||||
$this->font = isset($font) ? $font : new Font(__DIR__.'/../../assets/noto_sans.otf', 16);
|
||||
$this->alignment = isset($alignment) ? $alignment : new LabelAlignmentCenter();
|
||||
$this->margin = isset($margin) ? $margin : new Margin(0, 10, 10, 10);
|
||||
$this->textColor = isset($textColor) ? $textColor : new Color(0, 0, 0);
|
||||
$this->font = $font ?? new Font(__DIR__.'/../../assets/noto_sans.otf', 16);
|
||||
$this->alignment = $alignment ?? new LabelAlignmentCenter();
|
||||
$this->margin = $margin ?? new Margin(0, 10, 10, 10);
|
||||
$this->textColor = $textColor ?? new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
public static function create(string $text): self
|
||||
|
|
|
@ -6,17 +6,12 @@ namespace Endroid\QrCode\Label\Margin;
|
|||
|
||||
final class Margin implements MarginInterface
|
||||
{
|
||||
private int $top;
|
||||
private int $right;
|
||||
private int $bottom;
|
||||
private int $left;
|
||||
|
||||
public function __construct(int $top, int $right, int $bottom, int $left)
|
||||
{
|
||||
$this->top = $top;
|
||||
$this->right = $right;
|
||||
$this->bottom = $bottom;
|
||||
$this->left = $left;
|
||||
public function __construct(
|
||||
private int $top,
|
||||
private int $right,
|
||||
private int $bottom,
|
||||
private int $left
|
||||
) {
|
||||
}
|
||||
|
||||
public function getTop(): int
|
||||
|
|
25
vendor/endroid/qr-code/src/Logo/Logo.php
vendored
|
@ -6,17 +6,12 @@ namespace Endroid\QrCode\Logo;
|
|||
|
||||
final class Logo implements LogoInterface
|
||||
{
|
||||
private string $path;
|
||||
private ?int $resizeToWidth;
|
||||
private ?int $resizeToHeight;
|
||||
private bool $punchoutBackground;
|
||||
|
||||
public function __construct(string $path, ?int $resizeToWidth = null, ?int $resizeToHeight = null, bool $punchoutBackground = false)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->resizeToWidth = $resizeToWidth;
|
||||
$this->resizeToHeight = $resizeToHeight;
|
||||
$this->punchoutBackground = $punchoutBackground;
|
||||
public function __construct(
|
||||
private string $path,
|
||||
private int|null $resizeToWidth = null,
|
||||
private int|null $resizeToHeight = null,
|
||||
private bool $punchoutBackground = false
|
||||
) {
|
||||
}
|
||||
|
||||
public static function create(string $path): self
|
||||
|
@ -36,24 +31,24 @@ final class Logo implements LogoInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getResizeToWidth(): ?int
|
||||
public function getResizeToWidth(): int|null
|
||||
{
|
||||
return $this->resizeToWidth;
|
||||
}
|
||||
|
||||
public function setResizeToWidth(?int $resizeToWidth): self
|
||||
public function setResizeToWidth(int|null $resizeToWidth): self
|
||||
{
|
||||
$this->resizeToWidth = $resizeToWidth;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getResizeToHeight(): ?int
|
||||
public function getResizeToHeight(): int|null
|
||||
{
|
||||
return $this->resizeToHeight;
|
||||
}
|
||||
|
||||
public function setResizeToHeight(?int $resizeToHeight): self
|
||||
public function setResizeToHeight(int|null $resizeToHeight): self
|
||||
{
|
||||
$this->resizeToHeight = $resizeToHeight;
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ interface LogoInterface
|
|||
{
|
||||
public function getPath(): string;
|
||||
|
||||
public function getResizeToWidth(): ?int;
|
||||
public function getResizeToWidth(): int|null;
|
||||
|
||||
public function getResizeToHeight(): ?int;
|
||||
public function getResizeToHeight(): int|null;
|
||||
|
||||
public function getPunchoutBackground(): bool;
|
||||
}
|
||||
|
|
13
vendor/endroid/qr-code/src/Matrix/Matrix.php
vendored
|
@ -11,9 +11,6 @@ use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeShrink;
|
|||
|
||||
final class Matrix implements MatrixInterface
|
||||
{
|
||||
/** @var array<int, array<int, int>> */
|
||||
private array $blockValues = [];
|
||||
|
||||
private float $blockSize;
|
||||
private int $innerSize;
|
||||
private int $outerSize;
|
||||
|
@ -21,10 +18,12 @@ final class Matrix implements MatrixInterface
|
|||
private int $marginRight;
|
||||
|
||||
/** @param array<array<int>> $blockValues */
|
||||
public function __construct(array $blockValues, int $size, int $margin, RoundBlockSizeModeInterface $roundBlockSizeMode)
|
||||
{
|
||||
$this->blockValues = $blockValues;
|
||||
|
||||
public function __construct(
|
||||
private array $blockValues,
|
||||
int $size,
|
||||
int $margin,
|
||||
RoundBlockSizeModeInterface $roundBlockSizeMode
|
||||
) {
|
||||
$this->blockSize = $size / $this->getBlockCount();
|
||||
$this->innerSize = $size;
|
||||
$this->outerSize = $size + 2 * $margin;
|
||||
|
|
22
vendor/endroid/qr-code/src/QrCode.php
vendored
|
@ -15,30 +15,24 @@ use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
|
|||
|
||||
final class QrCode implements QrCodeInterface
|
||||
{
|
||||
private string $data;
|
||||
private EncodingInterface $encoding;
|
||||
private ErrorCorrectionLevelInterface $errorCorrectionLevel;
|
||||
private int $size;
|
||||
private int $margin;
|
||||
private RoundBlockSizeModeInterface $roundBlockSizeMode;
|
||||
private ColorInterface $foregroundColor;
|
||||
private ColorInterface $backgroundColor;
|
||||
|
||||
public function __construct(
|
||||
string $data,
|
||||
EncodingInterface $encoding = null,
|
||||
ErrorCorrectionLevelInterface $errorCorrectionLevel = null,
|
||||
int $size = 300,
|
||||
int $margin = 10,
|
||||
RoundBlockSizeModeInterface $roundBlockSizeMode = null,
|
||||
ColorInterface $foregroundColor = null,
|
||||
ColorInterface $backgroundColor = null
|
||||
private string $data,
|
||||
EncodingInterface|null $encoding = null,
|
||||
ErrorCorrectionLevelInterface|null $errorCorrectionLevel = null,
|
||||
private int $size = 300,
|
||||
private int $margin = 10,
|
||||
RoundBlockSizeModeInterface|null $roundBlockSizeMode = null,
|
||||
ColorInterface|null $foregroundColor = null,
|
||||
ColorInterface|null $backgroundColor = null
|
||||
) {
|
||||
$this->data = $data;
|
||||
$this->encoding = $encoding ?? new Encoding('UTF-8');
|
||||
$this->errorCorrectionLevel = $errorCorrectionLevel ?? new ErrorCorrectionLevelLow();
|
||||
$this->size = $size;
|
||||
$this->margin = $margin;
|
||||
$this->roundBlockSizeMode = $roundBlockSizeMode ?? new RoundBlockSizeModeMargin();
|
||||
$this->foregroundColor = $foregroundColor ?? new Color(0, 0, 0);
|
||||
$this->backgroundColor = $backgroundColor ?? new Color(255, 255, 255);
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
interface WritableInterface
|
||||
{
|
||||
}
|
205
vendor/endroid/qr-code/src/Writer/AbstractGdWriter.php
vendored
Normal file
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer;
|
||||
|
||||
use Endroid\QrCode\Bacon\MatrixFactory;
|
||||
use Endroid\QrCode\Exception\ValidationException;
|
||||
use Endroid\QrCode\ImageData\LabelImageData;
|
||||
use Endroid\QrCode\ImageData\LogoImageData;
|
||||
use Endroid\QrCode\Label\Alignment\LabelAlignmentLeft;
|
||||
use Endroid\QrCode\Label\Alignment\LabelAlignmentRight;
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeNone;
|
||||
use Endroid\QrCode\Writer\Result\GdResult;
|
||||
use Endroid\QrCode\Writer\Result\ResultInterface;
|
||||
use Zxing\QrReader;
|
||||
|
||||
abstract class AbstractGdWriter implements WriterInterface, ValidatingWriterInterface
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
if (!extension_loaded('gd')) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
}
|
||||
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
||||
$baseBlockSize = $qrCode->getRoundBlockSizeMode() instanceof RoundBlockSizeModeNone ? 10 : intval($matrix->getBlockSize());
|
||||
$baseImage = imagecreatetruecolor($matrix->getBlockCount() * $baseBlockSize, $matrix->getBlockCount() * $baseBlockSize);
|
||||
|
||||
if (!$baseImage) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
}
|
||||
|
||||
/** @var int $foregroundColor */
|
||||
$foregroundColor = imagecolorallocatealpha(
|
||||
$baseImage,
|
||||
$qrCode->getForegroundColor()->getRed(),
|
||||
$qrCode->getForegroundColor()->getGreen(),
|
||||
$qrCode->getForegroundColor()->getBlue(),
|
||||
$qrCode->getForegroundColor()->getAlpha()
|
||||
);
|
||||
|
||||
/** @var int $transparentColor */
|
||||
$transparentColor = imagecolorallocatealpha($baseImage, 255, 255, 255, 127);
|
||||
|
||||
imagefill($baseImage, 0, 0, $transparentColor);
|
||||
|
||||
for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
|
||||
for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
|
||||
if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) {
|
||||
imagefilledrectangle(
|
||||
$baseImage,
|
||||
$columnIndex * $baseBlockSize,
|
||||
$rowIndex * $baseBlockSize,
|
||||
($columnIndex + 1) * $baseBlockSize - 1,
|
||||
($rowIndex + 1) * $baseBlockSize - 1,
|
||||
$foregroundColor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$targetWidth = $matrix->getOuterSize();
|
||||
$targetHeight = $matrix->getOuterSize();
|
||||
|
||||
if ($label instanceof LabelInterface) {
|
||||
$labelImageData = LabelImageData::createForLabel($label);
|
||||
$targetHeight += $labelImageData->getHeight() + $label->getMargin()->getTop() + $label->getMargin()->getBottom();
|
||||
}
|
||||
|
||||
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||
|
||||
if (!$targetImage) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
}
|
||||
|
||||
/** @var int $backgroundColor */
|
||||
$backgroundColor = imagecolorallocatealpha(
|
||||
$targetImage,
|
||||
$qrCode->getBackgroundColor()->getRed(),
|
||||
$qrCode->getBackgroundColor()->getGreen(),
|
||||
$qrCode->getBackgroundColor()->getBlue(),
|
||||
$qrCode->getBackgroundColor()->getAlpha()
|
||||
);
|
||||
|
||||
imagefill($targetImage, 0, 0, $backgroundColor);
|
||||
|
||||
imagecopyresampled(
|
||||
$targetImage,
|
||||
$baseImage,
|
||||
$matrix->getMarginLeft(),
|
||||
$matrix->getMarginLeft(),
|
||||
0,
|
||||
0,
|
||||
$matrix->getInnerSize(),
|
||||
$matrix->getInnerSize(),
|
||||
imagesx($baseImage),
|
||||
imagesy($baseImage)
|
||||
);
|
||||
|
||||
if ($qrCode->getBackgroundColor()->getAlpha() > 0) {
|
||||
imagesavealpha($targetImage, true);
|
||||
}
|
||||
|
||||
$result = new GdResult($matrix, $targetImage);
|
||||
|
||||
if ($logo instanceof LogoInterface) {
|
||||
$result = $this->addLogo($logo, $result);
|
||||
}
|
||||
|
||||
if ($label instanceof LabelInterface) {
|
||||
$result = $this->addLabel($label, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function addLogo(LogoInterface $logo, GdResult $result): GdResult
|
||||
{
|
||||
$logoImageData = LogoImageData::createForLogo($logo);
|
||||
|
||||
if ('image/svg+xml' === $logoImageData->getMimeType()) {
|
||||
throw new \Exception('PNG Writer does not support SVG logo');
|
||||
}
|
||||
|
||||
$targetImage = $result->getImage();
|
||||
$matrix = $result->getMatrix();
|
||||
|
||||
if ($logoImageData->getPunchoutBackground()) {
|
||||
/** @var int $transparent */
|
||||
$transparent = imagecolorallocatealpha($targetImage, 255, 255, 255, 127);
|
||||
imagealphablending($targetImage, false);
|
||||
$xOffsetStart = intval($matrix->getOuterSize() / 2 - $logoImageData->getWidth() / 2);
|
||||
$yOffsetStart = intval($matrix->getOuterSize() / 2 - $logoImageData->getHeight() / 2);
|
||||
for ($xOffset = $xOffsetStart; $xOffset < $xOffsetStart + $logoImageData->getWidth(); ++$xOffset) {
|
||||
for ($yOffset = $yOffsetStart; $yOffset < $yOffsetStart + $logoImageData->getHeight(); ++$yOffset) {
|
||||
imagesetpixel($targetImage, $xOffset, $yOffset, $transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imagecopyresampled(
|
||||
$targetImage,
|
||||
$logoImageData->getImage(),
|
||||
intval($matrix->getOuterSize() / 2 - $logoImageData->getWidth() / 2),
|
||||
intval($matrix->getOuterSize() / 2 - $logoImageData->getHeight() / 2),
|
||||
0,
|
||||
0,
|
||||
$logoImageData->getWidth(),
|
||||
$logoImageData->getHeight(),
|
||||
imagesx($logoImageData->getImage()),
|
||||
imagesy($logoImageData->getImage())
|
||||
);
|
||||
|
||||
return new GdResult($matrix, $targetImage);
|
||||
}
|
||||
|
||||
private function addLabel(LabelInterface $label, GdResult $result): GdResult
|
||||
{
|
||||
$targetImage = $result->getImage();
|
||||
|
||||
$labelImageData = LabelImageData::createForLabel($label);
|
||||
|
||||
/** @var int $textColor */
|
||||
$textColor = imagecolorallocatealpha(
|
||||
$targetImage,
|
||||
$label->getTextColor()->getRed(),
|
||||
$label->getTextColor()->getGreen(),
|
||||
$label->getTextColor()->getBlue(),
|
||||
$label->getTextColor()->getAlpha()
|
||||
);
|
||||
|
||||
$x = intval(imagesx($targetImage) / 2 - $labelImageData->getWidth() / 2);
|
||||
$y = imagesy($targetImage) - $label->getMargin()->getBottom();
|
||||
|
||||
if ($label->getAlignment() instanceof LabelAlignmentLeft) {
|
||||
$x = $label->getMargin()->getLeft();
|
||||
} elseif ($label->getAlignment() instanceof LabelAlignmentRight) {
|
||||
$x = imagesx($targetImage) - $labelImageData->getWidth() - $label->getMargin()->getRight();
|
||||
}
|
||||
|
||||
imagettftext($targetImage, $label->getFont()->getSize(), 0, $x, $y, $textColor, $label->getFont()->getPath(), $label->getText());
|
||||
|
||||
return new GdResult($result->getMatrix(), $targetImage);
|
||||
}
|
||||
|
||||
public function validateResult(ResultInterface $result, string $expectedData): void
|
||||
{
|
||||
$string = $result->getString();
|
||||
|
||||
if (!class_exists(QrReader::class)) {
|
||||
throw ValidationException::createForMissingPackage('khanamiryan/qrcode-detector-decoder');
|
||||
}
|
||||
|
||||
$reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB);
|
||||
if ($reader->text() !== $expectedData) {
|
||||
throw ValidationException::createForInvalidData($expectedData, strval($reader->text()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ use Endroid\QrCode\Writer\Result\ResultInterface;
|
|||
|
||||
final class BinaryWriter implements WriterInterface
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
|
23
vendor/endroid/qr-code/src/Writer/ConsoleWriter.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer;
|
||||
|
||||
use Endroid\QrCode\Bacon\MatrixFactory;
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
use Endroid\QrCode\Writer\Result\ConsoleResult;
|
||||
use Endroid\QrCode\Writer\Result\ResultInterface;
|
||||
|
||||
final class ConsoleWriter implements WriterInterface
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, $options = []): ResultInterface
|
||||
{
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
||||
return new ConsoleResult($matrix, $qrCode->getForegroundColor(), $qrCode->getBackgroundColor());
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Endroid\QrCode\Writer;
|
||||
|
||||
use Endroid\QrCode\Bacon\MatrixFactory;
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
|
@ -12,9 +13,12 @@ use Endroid\QrCode\Writer\Result\ResultInterface;
|
|||
|
||||
final class DebugWriter implements WriterInterface, ValidatingWriterInterface
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
return new DebugResult($qrCode, $logo, $label, $options);
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
||||
return new DebugResult($matrix, $qrCode, $logo, $label, $options);
|
||||
}
|
||||
|
||||
public function validateResult(ResultInterface $result, string $expectedData): void
|
||||
|
|
|
@ -15,7 +15,7 @@ final class EpsWriter implements WriterInterface
|
|||
{
|
||||
public const DECIMAL_PRECISION = 10;
|
||||
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
@ -39,6 +39,6 @@ final class EpsWriter implements WriterInterface
|
|||
}
|
||||
}
|
||||
|
||||
return new EpsResult($lines);
|
||||
return new EpsResult($matrix, $lines);
|
||||
}
|
||||
}
|
||||
|
|
23
vendor/endroid/qr-code/src/Writer/GifWriter.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer;
|
||||
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
use Endroid\QrCode\Writer\Result\GdResult;
|
||||
use Endroid\QrCode\Writer\Result\GifResult;
|
||||
use Endroid\QrCode\Writer\Result\ResultInterface;
|
||||
|
||||
final class GifWriter extends AbstractGdWriter
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
/** @var GdResult $gdResult */
|
||||
$gdResult = parent::write($qrCode, $logo, $label, $options);
|
||||
|
||||
return new GifResult($gdResult->getMatrix(), $gdResult->getImage());
|
||||
}
|
||||
}
|
10
vendor/endroid/qr-code/src/Writer/PdfWriter.php
vendored
|
@ -17,8 +17,9 @@ final class PdfWriter implements WriterInterface
|
|||
public const WRITER_OPTION_PDF = 'fpdf';
|
||||
public const WRITER_OPTION_X = 'x';
|
||||
public const WRITER_OPTION_Y = 'y';
|
||||
public const WRITER_OPTION_LINK = 'link';
|
||||
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
|
@ -99,7 +100,12 @@ final class PdfWriter implements WriterInterface
|
|||
$fpdf->Cell($matrix->getOuterSize(), 0, $label->getText(), 0, 0, 'C');
|
||||
}
|
||||
|
||||
return new PdfResult($fpdf);
|
||||
if (isset($options[self::WRITER_OPTION_LINK])) {
|
||||
$link = $options[self::WRITER_OPTION_LINK];
|
||||
$fpdf->Link($x, $y, $x + $matrix->getOuterSize(), $y + $matrix->getOuterSize(), $link);
|
||||
}
|
||||
|
||||
return new PdfResult($matrix, $fpdf);
|
||||
}
|
||||
|
||||
private function addLogo(LogoInterface $logo, \FPDF $fpdf, float $x, float $y, float $size): void
|
||||
|
|
218
vendor/endroid/qr-code/src/Writer/PngWriter.php
vendored
|
@ -4,224 +4,26 @@ declare(strict_types=1);
|
|||
|
||||
namespace Endroid\QrCode\Writer;
|
||||
|
||||
use Endroid\QrCode\Bacon\MatrixFactory;
|
||||
use Endroid\QrCode\ImageData\LabelImageData;
|
||||
use Endroid\QrCode\ImageData\LogoImageData;
|
||||
use Endroid\QrCode\Label\Alignment\LabelAlignmentLeft;
|
||||
use Endroid\QrCode\Label\Alignment\LabelAlignmentRight;
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeNone;
|
||||
use Endroid\QrCode\Writer\Result\GdResult;
|
||||
use Endroid\QrCode\Writer\Result\PngResult;
|
||||
use Endroid\QrCode\Writer\Result\ResultInterface;
|
||||
use Zxing\QrReader;
|
||||
|
||||
final class PngWriter implements WriterInterface, ValidatingWriterInterface
|
||||
final class PngWriter extends AbstractGdWriter
|
||||
{
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
|
||||
public const WRITER_OPTION_COMPRESSION_LEVEL = 'compression_level';
|
||||
|
||||
public function write(QrCodeInterface $qrCode, LogoInterface|null $logo = null, LabelInterface|null $label = null, array $options = []): ResultInterface
|
||||
{
|
||||
if (!extension_loaded('gd')) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
if (!isset($options[self::WRITER_OPTION_COMPRESSION_LEVEL])) {
|
||||
$options[self::WRITER_OPTION_COMPRESSION_LEVEL] = -1;
|
||||
}
|
||||
|
||||
$matrixFactory = new MatrixFactory();
|
||||
$matrix = $matrixFactory->create($qrCode);
|
||||
/** @var GdResult $gdResult */
|
||||
$gdResult = parent::write($qrCode, $logo, $label, $options);
|
||||
|
||||
$baseBlockSize = $qrCode->getRoundBlockSizeMode() instanceof RoundBlockSizeModeNone ? 10 : intval($matrix->getBlockSize());
|
||||
$baseImage = imagecreatetruecolor($matrix->getBlockCount() * $baseBlockSize, $matrix->getBlockCount() * $baseBlockSize);
|
||||
|
||||
if (!$baseImage) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
}
|
||||
|
||||
/** @var int $foregroundColor */
|
||||
$foregroundColor = imagecolorallocatealpha(
|
||||
$baseImage,
|
||||
$qrCode->getForegroundColor()->getRed(),
|
||||
$qrCode->getForegroundColor()->getGreen(),
|
||||
$qrCode->getForegroundColor()->getBlue(),
|
||||
$qrCode->getForegroundColor()->getAlpha()
|
||||
);
|
||||
|
||||
/** @var int $transparentColor */
|
||||
$transparentColor = imagecolorallocatealpha($baseImage, 255, 255, 255, 127);
|
||||
|
||||
imagefill($baseImage, 0, 0, $transparentColor);
|
||||
|
||||
for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
|
||||
for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
|
||||
if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) {
|
||||
imagefilledrectangle(
|
||||
$baseImage,
|
||||
$columnIndex * $baseBlockSize,
|
||||
$rowIndex * $baseBlockSize,
|
||||
($columnIndex + 1) * $baseBlockSize - 1,
|
||||
($rowIndex + 1) * $baseBlockSize - 1,
|
||||
$foregroundColor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$targetWidth = $matrix->getOuterSize();
|
||||
$targetHeight = $matrix->getOuterSize();
|
||||
|
||||
if ($label instanceof LabelInterface) {
|
||||
$labelImageData = LabelImageData::createForLabel($label);
|
||||
$targetHeight += $labelImageData->getHeight() + $label->getMargin()->getTop() + $label->getMargin()->getBottom();
|
||||
}
|
||||
|
||||
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||
|
||||
if (!$targetImage) {
|
||||
throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
|
||||
}
|
||||
|
||||
/** @var int $backgroundColor */
|
||||
$backgroundColor = imagecolorallocatealpha(
|
||||
$targetImage,
|
||||
$qrCode->getBackgroundColor()->getRed(),
|
||||
$qrCode->getBackgroundColor()->getGreen(),
|
||||
$qrCode->getBackgroundColor()->getBlue(),
|
||||
$qrCode->getBackgroundColor()->getAlpha()
|
||||
);
|
||||
|
||||
imagefill($targetImage, 0, 0, $backgroundColor);
|
||||
|
||||
imagecopyresampled(
|
||||
$targetImage,
|
||||
$baseImage,
|
||||
$matrix->getMarginLeft(),
|
||||
$matrix->getMarginLeft(),
|
||||
0,
|
||||
0,
|
||||
$matrix->getInnerSize(),
|
||||
$matrix->getInnerSize(),
|
||||
imagesx($baseImage),
|
||||
imagesy($baseImage)
|
||||
);
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
imagedestroy($baseImage);
|
||||
}
|
||||
|
||||
if ($qrCode->getBackgroundColor()->getAlpha() > 0) {
|
||||
imagesavealpha($targetImage, true);
|
||||
}
|
||||
|
||||
$result = new PngResult($targetImage);
|
||||
|
||||
if ($logo instanceof LogoInterface) {
|
||||
$result = $this->addLogo($logo, $result);
|
||||
}
|
||||
|
||||
if ($label instanceof LabelInterface) {
|
||||
$result = $this->addLabel($label, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function addLogo(LogoInterface $logo, PngResult $result): PngResult
|
||||
{
|
||||
$logoImageData = LogoImageData::createForLogo($logo);
|
||||
|
||||
if ('image/svg+xml' === $logoImageData->getMimeType()) {
|
||||
throw new \Exception('PNG Writer does not support SVG logo');
|
||||
}
|
||||
|
||||
$targetImage = $result->getImage();
|
||||
|
||||
if ($logoImageData->getPunchoutBackground()) {
|
||||
/** @var int $transparent */
|
||||
$transparent = imagecolorallocatealpha($targetImage, 255, 255, 255, 127);
|
||||
imagealphablending($targetImage, false);
|
||||
for (
|
||||
$x_offset = intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2);
|
||||
$x_offset < intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2) + $logoImageData->getWidth();
|
||||
++$x_offset
|
||||
) {
|
||||
for (
|
||||
$y_offset = intval(imagesy($targetImage) / 2 - $logoImageData->getHeight() / 2);
|
||||
$y_offset < intval(imagesy($targetImage) / 2 - $logoImageData->getHeight() / 2) + $logoImageData->getHeight();
|
||||
++$y_offset
|
||||
) {
|
||||
imagesetpixel(
|
||||
$targetImage,
|
||||
$x_offset,
|
||||
$y_offset,
|
||||
$transparent
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imagecopyresampled(
|
||||
$targetImage,
|
||||
$logoImageData->getImage(),
|
||||
intval(imagesx($targetImage) / 2 - $logoImageData->getWidth() / 2),
|
||||
intval(imagesx($targetImage) / 2 - $logoImageData->getHeight() / 2),
|
||||
0,
|
||||
0,
|
||||
$logoImageData->getWidth(),
|
||||
$logoImageData->getHeight(),
|
||||
imagesx($logoImageData->getImage()),
|
||||
imagesy($logoImageData->getImage())
|
||||
);
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
imagedestroy($logoImageData->getImage());
|
||||
}
|
||||
|
||||
return new PngResult($targetImage);
|
||||
}
|
||||
|
||||
private function addLabel(LabelInterface $label, PngResult $result): PngResult
|
||||
{
|
||||
$targetImage = $result->getImage();
|
||||
|
||||
$labelImageData = LabelImageData::createForLabel($label);
|
||||
|
||||
/** @var int $textColor */
|
||||
$textColor = imagecolorallocatealpha(
|
||||
$targetImage,
|
||||
$label->getTextColor()->getRed(),
|
||||
$label->getTextColor()->getGreen(),
|
||||
$label->getTextColor()->getBlue(),
|
||||
$label->getTextColor()->getAlpha()
|
||||
);
|
||||
|
||||
$x = intval(imagesx($targetImage) / 2 - $labelImageData->getWidth() / 2);
|
||||
$y = imagesy($targetImage) - $label->getMargin()->getBottom();
|
||||
|
||||
if ($label->getAlignment() instanceof LabelAlignmentLeft) {
|
||||
$x = $label->getMargin()->getLeft();
|
||||
} elseif ($label->getAlignment() instanceof LabelAlignmentRight) {
|
||||
$x = imagesx($targetImage) - $labelImageData->getWidth() - $label->getMargin()->getRight();
|
||||
}
|
||||
|
||||
imagettftext($targetImage, $label->getFont()->getSize(), 0, $x, $y, $textColor, $label->getFont()->getPath(), $label->getText());
|
||||
|
||||
return new PngResult($targetImage);
|
||||
}
|
||||
|
||||
public function validateResult(ResultInterface $result, string $expectedData): void
|
||||
{
|
||||
$string = $result->getString();
|
||||
|
||||
if (!class_exists(QrReader::class)) {
|
||||
throw new \Exception('Please install khanamiryan/qrcode-detector-decoder or disable image validation');
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
throw new \Exception('The validator is not compatible with PHP 8 yet, see https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103');
|
||||
}
|
||||
|
||||
$reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB);
|
||||
if ($reader->text() !== $expectedData) {
|
||||
throw new \Exception('Built-in validation reader read "'.$reader->text().'" instead of "'.$expectedData.'".
|
||||
Adjust your parameters to increase readability or disable built-in validation.');
|
||||
}
|
||||
return new PngResult($gdResult->getMatrix(), $gdResult->getImage(), $options[self::WRITER_OPTION_COMPRESSION_LEVEL]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
|
||||
abstract class AbstractResult implements ResultInterface
|
||||
{
|
||||
public function __construct(
|
||||
private MatrixInterface $matrix
|
||||
) {
|
||||
}
|
||||
|
||||
public function getMatrix(): MatrixInterface
|
||||
{
|
||||
return $this->matrix;
|
||||
}
|
||||
|
||||
public function getDataUri(): string
|
||||
{
|
||||
return 'data:'.$this->getMimeType().';base64,'.base64_encode($this->getString());
|
||||
|
|
|
@ -8,19 +8,19 @@ use Endroid\QrCode\Matrix\MatrixInterface;
|
|||
|
||||
final class BinaryResult extends AbstractResult
|
||||
{
|
||||
private MatrixInterface $matrix;
|
||||
|
||||
public function __construct(MatrixInterface $matrix)
|
||||
{
|
||||
$this->matrix = $matrix;
|
||||
parent::__construct($matrix);
|
||||
}
|
||||
|
||||
public function getString(): string
|
||||
{
|
||||
$matrix = $this->getMatrix();
|
||||
|
||||
$binaryString = '';
|
||||
for ($rowIndex = 0; $rowIndex < $this->matrix->getBlockCount(); ++$rowIndex) {
|
||||
for ($columnIndex = 0; $columnIndex < $this->matrix->getBlockCount(); ++$columnIndex) {
|
||||
$binaryString .= $this->matrix->getBlockValue($rowIndex, $columnIndex);
|
||||
for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
|
||||
for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
|
||||
$binaryString .= $matrix->getBlockValue($rowIndex, $columnIndex);
|
||||
}
|
||||
$binaryString .= "\n";
|
||||
}
|
||||
|
|
69
vendor/endroid/qr-code/src/Writer/Result/ConsoleResult.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
use Endroid\QrCode\Color\ColorInterface;
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
|
||||
class ConsoleResult extends AbstractResult
|
||||
{
|
||||
private const TWO_BLOCKS = [
|
||||
0 => ' ',
|
||||
1 => "\xe2\x96\x80",
|
||||
2 => "\xe2\x96\x84",
|
||||
3 => "\xe2\x96\x88",
|
||||
];
|
||||
|
||||
private string $colorEscapeCode;
|
||||
|
||||
public function __construct(
|
||||
MatrixInterface $matrix,
|
||||
ColorInterface $foreground,
|
||||
ColorInterface $background
|
||||
) {
|
||||
parent::__construct($matrix);
|
||||
|
||||
$this->colorEscapeCode = sprintf(
|
||||
"\e[38;2;%d;%d;%dm\e[48;2;%d;%d;%dm",
|
||||
$foreground->getRed(),
|
||||
$foreground->getGreen(),
|
||||
$foreground->getBlue(),
|
||||
$background->getRed(),
|
||||
$background->getGreen(),
|
||||
$background->getBlue()
|
||||
);
|
||||
}
|
||||
|
||||
public function getMimeType(): string
|
||||
{
|
||||
return 'text/plain';
|
||||
}
|
||||
|
||||
public function getString(): string
|
||||
{
|
||||
$matrix = $this->getMatrix();
|
||||
|
||||
$side = $matrix->getBlockCount();
|
||||
$marginLeft = $this->colorEscapeCode.self::TWO_BLOCKS[0].self::TWO_BLOCKS[0];
|
||||
$marginRight = self::TWO_BLOCKS[0].self::TWO_BLOCKS[0]."\e[0m".PHP_EOL;
|
||||
$marginVertical = $marginLeft.str_repeat(self::TWO_BLOCKS[0], $side).$marginRight;
|
||||
|
||||
$qrCodeString = $marginVertical;
|
||||
for ($rowIndex = 0; $rowIndex < $side; $rowIndex += 2) {
|
||||
$qrCodeString .= $marginLeft;
|
||||
for ($columnIndex = 0; $columnIndex < $side; ++$columnIndex) {
|
||||
$combined = $matrix->getBlockValue($rowIndex, $columnIndex);
|
||||
if ($rowIndex + 1 < $side) {
|
||||
$combined |= $matrix->getBlockValue($rowIndex + 1, $columnIndex) << 1;
|
||||
}
|
||||
$qrCodeString .= self::TWO_BLOCKS[$combined];
|
||||
}
|
||||
$qrCodeString .= $marginRight;
|
||||
}
|
||||
$qrCodeString .= $marginVertical;
|
||||
|
||||
return $qrCodeString;
|
||||
}
|
||||
}
|
|
@ -6,26 +6,22 @@ namespace Endroid\QrCode\Writer\Result;
|
|||
|
||||
use Endroid\QrCode\Label\LabelInterface;
|
||||
use Endroid\QrCode\Logo\LogoInterface;
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
use Endroid\QrCode\QrCodeInterface;
|
||||
|
||||
final class DebugResult extends AbstractResult
|
||||
{
|
||||
private QrCodeInterface $qrCode;
|
||||
private ?LogoInterface $logo;
|
||||
private ?LabelInterface $label;
|
||||
|
||||
/** @var array<mixed> */
|
||||
private array $options;
|
||||
|
||||
private bool $validateResult = false;
|
||||
|
||||
/** @param array<mixed> $options */
|
||||
public function __construct(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = [])
|
||||
{
|
||||
$this->qrCode = $qrCode;
|
||||
$this->logo = $logo;
|
||||
$this->label = $label;
|
||||
$this->options = $options;
|
||||
public function __construct(
|
||||
MatrixInterface $matrix,
|
||||
private QrCodeInterface $qrCode,
|
||||
private LogoInterface|null $logo = null,
|
||||
private LabelInterface|null $label = null,
|
||||
/** @var array<string, mixed> $options */
|
||||
private array $options = []
|
||||
) {
|
||||
parent::__construct($matrix);
|
||||
}
|
||||
|
||||
public function setValidateResult(bool $validateResult): void
|
||||
|
|
|
@ -4,15 +4,16 @@ declare(strict_types=1);
|
|||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
|
||||
final class EpsResult extends AbstractResult
|
||||
{
|
||||
/** @var array<string> */
|
||||
private array $lines;
|
||||
|
||||
/** @param array<string> $lines */
|
||||
public function __construct(array $lines)
|
||||
{
|
||||
$this->lines = $lines;
|
||||
public function __construct(
|
||||
MatrixInterface $matrix,
|
||||
/** @var array<string> $lines */
|
||||
private array $lines
|
||||
) {
|
||||
parent::__construct($matrix);
|
||||
}
|
||||
|
||||
public function getString(): string
|
||||
|
|
32
vendor/endroid/qr-code/src/Writer/Result/GdResult.php
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
|
||||
class GdResult extends AbstractResult
|
||||
{
|
||||
public function __construct(
|
||||
MatrixInterface $matrix,
|
||||
protected \GdImage $image
|
||||
) {
|
||||
parent::__construct($matrix);
|
||||
}
|
||||
|
||||
public function getImage(): \GdImage
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
public function getString(): string
|
||||
{
|
||||
throw new \Exception('You can only use this method in a concrete implementation');
|
||||
}
|
||||
|
||||
public function getMimeType(): string
|
||||
{
|
||||
throw new \Exception('You can only use this method in a concrete implementation');
|
||||
}
|
||||
}
|
21
vendor/endroid/qr-code/src/Writer/Result/GifResult.php
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
final class GifResult extends GdResult
|
||||
{
|
||||
public function getString(): string
|
||||
{
|
||||
ob_start();
|
||||
imagegif($this->image);
|
||||
|
||||
return strval(ob_get_clean());
|
||||
}
|
||||
|
||||
public function getMimeType(): string
|
||||
{
|
||||
return 'image/gif';
|
||||
}
|
||||
}
|
|
@ -4,13 +4,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Endroid\QrCode\Writer\Result;
|
||||
|
||||
use Endroid\QrCode\Matrix\MatrixInterface;
|
||||
|
||||
final class PdfResult extends AbstractResult
|
||||
{
|
||||
private \FPDF $fpdf;
|
||||
|
||||
public function __construct(\FPDF $fpdf)
|
||||
{
|
||||
$this->fpdf = $fpdf;
|
||||
public function __construct(
|
||||
MatrixInterface $matrix,
|
||||
private \FPDF $fpdf
|
||||
) {
|
||||
parent::__construct($matrix);
|
||||
}
|
||||
|
||||
public function getPdf(): \FPDF
|
||||
|
|